From b62de079998227cd5d89fbcdd002511532f7280a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 27 Jun 2024 10:09:04 +0000 Subject: [PATCH 001/271] Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 --- eng/Version.Details.xml | 8 +++--- eng/Versions.props | 2 +- eng/common/post-build/publish-using-darc.ps1 | 15 +++++----- .../job/publish-build-assets.yml | 12 ++++---- .../post-build/post-build.yml | 8 ++++-- .../templates/job/publish-build-assets.yml | 12 ++++---- .../templates/post-build/post-build.yml | 8 ++++-- .../post-build/setup-maestro-vars.yml | 28 +++++++++---------- global.json | 2 +- 9 files changed, 51 insertions(+), 44 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 37f2a7fd3f3..1bf15110933 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - a95bcc256e9bdf47394e4dab04872811c16daaea + 3fe41d9e97519a4e9b48293906dbf58714ea9a0d - + https://github.com/dotnet/arcade - a95bcc256e9bdf47394e4dab04872811c16daaea + 3fe41d9e97519a4e9b48293906dbf58714ea9a0d diff --git a/eng/Versions.props b/eng/Versions.props index 74476828edc..bfbe0526427 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24321.3 + 8.0.0-beta.24324.7 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 5a3a32ea8d7..238945cb5ab 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -2,7 +2,6 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, [Parameter(Mandatory=$true)][string] $AzdoToken, - [Parameter(Mandatory=$true)][string] $MaestroToken, [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, @@ -31,13 +30,13 @@ try { } & $darc add-build-to-channel ` - --id $buildId ` - --publishing-infra-version $PublishingInfraVersion ` - --default-channels ` - --source-branch main ` - --azdev-pat $AzdoToken ` - --bar-uri $MaestroApiEndPoint ` - --password $MaestroToken ` + --id $buildId ` + --publishing-infra-version $PublishingInfraVersion ` + --default-channels ` + --source-branch main ` + --azdev-pat "$AzdoToken" ` + --bar-uri "$MaestroApiEndPoint" ` + --ci ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index 589ac80a18b..d01739c1285 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -76,13 +76,16 @@ jobs: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Build Assets inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: > + -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) @@ -144,7 +147,6 @@ jobs: arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml index da1f40958b4..0dfa387e7b7 100644 --- a/eng/common/templates-official/post-build/post-build.yml +++ b/eng/common/templates-official/post-build/post-build.yml @@ -272,14 +272,16 @@ stages: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 8ec0151def2..9fd69fa7c9b 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -74,13 +74,16 @@ jobs: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Build Assets inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: > + -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro.dot.net /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) @@ -140,7 +143,6 @@ jobs: arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index aba44a25a33..2db4933468f 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -268,14 +268,16 @@ stages: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 0c87f149a4a..64b9abc6850 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -11,13 +11,14 @@ steps: artifactName: ReleaseConfigs checkDownloadedFiles: true - - task: PowerShell@2 + - task: AzureCLI@2 name: setReleaseVars displayName: Set Release Configs Vars inputs: - targetType: inline - pwsh: true - script: | + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | try { if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt @@ -31,15 +32,16 @@ steps: $AzureDevOpsBuildId = $Env:Build_BuildId } else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + . $(Build.SourcesDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId + $BarId = ${{ parameters.BARBuildId }} $Channels = $Env:PromoteToMaestroChannels -split "," $Channels = $Channels -join "][" $Channels = "[$Channels]" @@ -65,6 +67,4 @@ steps: exit 1 } env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/global.json b/global.json index cff8214f13a..f06ea153cbc 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24321.3", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24324.7", "Microsoft.Build.NoTargets": "3.7.0" } } From 26fefec976564b1e84976e32498fa7d425c990e1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 27 Jun 2024 13:19:47 +0000 Subject: [PATCH 002/271] Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 From 924c61ee9c20b7fdd098e2ba2b69490f9d3a82d7 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 28 Jun 2024 13:10:39 +0000 Subject: [PATCH 003/271] Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 From 64797b3f0ecddebac9b71c9ba0c2bf435e0ff553 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 29 Jun 2024 13:01:48 +0000 Subject: [PATCH 004/271] Update dependencies from https://github.com/dotnet/arcade build 20240626.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24326.4 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 1bf15110933..82e92edd6b1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 3fe41d9e97519a4e9b48293906dbf58714ea9a0d + bee35f3044609d08c40566f8a008baa4d0451a9e - + https://github.com/dotnet/arcade - 3fe41d9e97519a4e9b48293906dbf58714ea9a0d + bee35f3044609d08c40566f8a008baa4d0451a9e diff --git a/eng/Versions.props b/eng/Versions.props index bfbe0526427..bf4b5059817 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24324.7 + 8.0.0-beta.24326.4 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index f06ea153cbc..e0305aff4ff 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24324.7", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24326.4", "Microsoft.Build.NoTargets": "3.7.0" } } From f74d573585dce238b868d2598686a9401d135c2f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 30 Jun 2024 12:57:48 +0000 Subject: [PATCH 005/271] Update dependencies from https://github.com/dotnet/arcade build 20240626.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24326.4 From a2c71e33fe29a41be1da331366f9cacd97cf2d96 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 1 Jul 2024 12:58:15 +0000 Subject: [PATCH 006/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240627.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24327.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 37f2a7fd3f3..2dc462465d6 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 9ae78a4e6412926d19ba97cfed159bf9de70b538 + 0b53e839fa2f09a5994cc6006533dcc3d45a4226 diff --git a/eng/Versions.props b/eng/Versions.props index 00160ae657e..eebf197540e 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24304.1 + 9.0.0-alpha.1.24327.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 3c5c32c199a451142d2339e3524658185e449a31 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 1 Jul 2024 12:58:22 +0000 Subject: [PATCH 007/271] Update dependencies from https://github.com/dotnet/arcade build 20240628.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24328.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 82e92edd6b1..7d7df016bd3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - bee35f3044609d08c40566f8a008baa4d0451a9e + 761c516b64fee3941d8909d24205ced835eed83e - + https://github.com/dotnet/arcade - bee35f3044609d08c40566f8a008baa4d0451a9e + 761c516b64fee3941d8909d24205ced835eed83e diff --git a/eng/Versions.props b/eng/Versions.props index bf4b5059817..499a20ab32d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24326.4 + 8.0.0-beta.24328.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index e0305aff4ff..f9090403576 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24326.4", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24328.2", "Microsoft.Build.NoTargets": "3.7.0" } } From 5c55c198ac490545ecf22a2819c1e48c7799de04 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 2 Jul 2024 13:12:44 +0000 Subject: [PATCH 008/271] Update dependencies from https://github.com/dotnet/arcade build 20240628.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24328.2 From dbd10ce67ba57a9daf01666f25bf5c2b17dde82e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 3 Jul 2024 13:09:14 +0000 Subject: [PATCH 009/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 7d7df016bd3..20c270a335e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 761c516b64fee3941d8909d24205ced835eed83e + 8b879da4e449c48d99f3f642fc429379a64e8fe8 - + https://github.com/dotnet/arcade - 761c516b64fee3941d8909d24205ced835eed83e + 8b879da4e449c48d99f3f642fc429379a64e8fe8 diff --git a/eng/Versions.props b/eng/Versions.props index 499a20ab32d..c9011b45633 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24328.2 + 8.0.0-beta.24352.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index f9090403576..84da89a24e8 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24328.2", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24352.1", "Microsoft.Build.NoTargets": "3.7.0" } } From c32fa83f99b89fe7de847777c02aedf9cb748f82 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 4 Jul 2024 12:49:30 +0000 Subject: [PATCH 010/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From d38b2e0ffc220c6eed679db0110715e38c2d6907 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 5 Jul 2024 12:49:44 +0000 Subject: [PATCH 011/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From 5b7918d5d436e8c54dcbd0c1726a5a74e2a9598e Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 6 Jul 2024 12:46:40 +0000 Subject: [PATCH 012/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From 79ee27e081b650da8df83d4f3b6519577c607a80 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 7 Jul 2024 12:45:48 +0000 Subject: [PATCH 013/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From 01b3f2e192c077de3f7a49596d6c960ac96b70f5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 8 Jul 2024 12:51:16 +0000 Subject: [PATCH 014/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From 3c00a23f885a83ae18be3bec62bf985f93cad154 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 8 Jul 2024 12:58:48 +0000 Subject: [PATCH 015/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240702.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24352.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2dc462465d6..87626e9d8a8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 0b53e839fa2f09a5994cc6006533dcc3d45a4226 + cc732c57199f725857c201da146525e3be6bc504 diff --git a/eng/Versions.props b/eng/Versions.props index eebf197540e..6677d2d020d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24327.1 + 9.0.0-alpha.1.24352.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 957031b568441307574ee1e0ceda1320f6cf7594 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 9 Jul 2024 12:42:52 +0000 Subject: [PATCH 016/271] Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 From d3f595d7ea49c15e964e3387bdb98edd23868ef1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 10 Jul 2024 12:52:24 +0000 Subject: [PATCH 017/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.1 --- eng/Version.Details.xml | 8 +++--- eng/Versions.props | 2 +- .../job/publish-build-assets.yml | 27 +++---------------- global.json | 2 +- 4 files changed, 10 insertions(+), 29 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a0f6047e63c..9fd33272d5c 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + f20056daa31b4a08f2ce379cfe4610042c3bc26c - + https://github.com/dotnet/arcade - 4a7d983f833d6b86365ea1b2b4d6ee72fbdbf944 + f20056daa31b4a08f2ce379cfe4610042c3bc26c diff --git a/eng/Versions.props b/eng/Versions.props index ab3d814a8d8..75411b90f1c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24352.2 + 9.0.0-beta.24360.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index d99a1a3b284..ec3cd14191a 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -113,38 +113,19 @@ jobs: Add-Content -Path $filePath -Value "$(DefaultChannels)" Add-Content -Path $filePath -Value $(IsStableBuild) - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: ${{ parameters.is1ESPipeline }} - args: - displayName: Publish ReleaseConfigs Artifact - pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' - publishLocation: Container - artifactName: ReleaseConfigs - - - task: powershell@2 - displayName: Check if SymbolPublishingExclusionsFile.txt exists - inputs: - targetType: inline - script: | $symbolExclusionfile = "$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt" - if(Test-Path -Path $symbolExclusionfile) + if (Test-Path -Path $symbolExclusionfile) { Write-Host "SymbolExclusionFile exists" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]true" - } - else{ - Write-Host "Symbols Exclusion file does not exist" - Write-Host "##vso[task.setvariable variable=SymbolExclusionFile]false" + Copy-Item -Path $symbolExclusionfile -Destination "$(Build.StagingDirectory)/ReleaseConfigs" } - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: ${{ parameters.is1ESPipeline }} args: - displayName: Publish SymbolPublishingExclusionsFile Artifact - condition: eq(variables['SymbolExclusionFile'], 'true') - pathToPublish: '$(Build.SourcesDirectory)/eng/SymbolPublishingExclusionsFile.txt' + displayName: Publish ReleaseConfigs Artifact + pathToPublish: '$(Build.StagingDirectory)/ReleaseConfigs' publishLocation: Container artifactName: ReleaseConfigs diff --git a/global.json b/global.json index 9af5736134a..c9f2e26ce61 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24352.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.1", "Microsoft.Build.NoTargets": "3.7.0" } } From dc5f56743c2fc29d153aeb912a260d9009623013 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 10 Jul 2024 13:17:17 +0000 Subject: [PATCH 018/271] Update dependencies from https://github.com/dotnet/arcade build 20240709.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24359.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- .../templates-official/job/publish-build-assets.yml | 9 ++++++--- eng/common/templates/job/publish-build-assets.yml | 9 ++++++--- global.json | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 20c270a335e..09713863985 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 8b879da4e449c48d99f3f642fc429379a64e8fe8 + db87887481d4110c09a1004191002482fdd7e4f2 - + https://github.com/dotnet/arcade - 8b879da4e449c48d99f3f642fc429379a64e8fe8 + db87887481d4110c09a1004191002482fdd7e4f2 diff --git a/eng/Versions.props b/eng/Versions.props index c9011b45633..14ce4360c4f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24352.1 + 8.0.0-beta.24359.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index d01739c1285..ba3e7df8158 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -140,11 +140,14 @@ jobs: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' -WaitPublishingFinish true diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 9fd69fa7c9b..57a41f0a3e1 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -136,11 +136,14 @@ jobs: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' -WaitPublishingFinish true diff --git a/global.json b/global.json index 84da89a24e8..85e70f443a3 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24352.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24359.3", "Microsoft.Build.NoTargets": "3.7.0" } } From b06864f10b3cc1aeb1aeba65c3548627e9efe4e9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Jul 2024 12:51:05 +0000 Subject: [PATCH 019/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/cross/build-rootfs.sh | 2 +- global.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9fd33272d5c..3fa5b3420f1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - f20056daa31b4a08f2ce379cfe4610042c3bc26c + 731d793be2d0a66bafc96b1a79dc96b4d1f0301b - + https://github.com/dotnet/arcade - f20056daa31b4a08f2ce379cfe4610042c3bc26c + 731d793be2d0a66bafc96b1a79dc96b4d1f0301b diff --git a/eng/Versions.props b/eng/Versions.props index 75411b90f1c..f95bd0f7a1c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24360.1 + 9.0.0-beta.24360.4 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index eb1a9080464..6d99d1263c0 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -72,7 +72,7 @@ __AlpinePackages+=" krb5-dev" __AlpinePackages+=" openssl-dev" __AlpinePackages+=" zlib-dev" -__FreeBSDBase="13.2-RELEASE" +__FreeBSDBase="13.3-RELEASE" __FreeBSDPkg="1.17.0" __FreeBSDABI="13" __FreeBSDPackages="libunwind" diff --git a/global.json b/global.json index c9f2e26ce61..364cf58b9bd 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.1", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.4", "Microsoft.Build.NoTargets": "3.7.0" } } From a8e68455a9fb988345531078b5d182153284745c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Jul 2024 13:18:41 +0000 Subject: [PATCH 020/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 09713863985..9e5c4be91a0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - db87887481d4110c09a1004191002482fdd7e4f2 + c9efa535175049eb9cba06cae1f8c3d5dbe768a9 - + https://github.com/dotnet/arcade - db87887481d4110c09a1004191002482fdd7e4f2 + c9efa535175049eb9cba06cae1f8c3d5dbe768a9 diff --git a/eng/Versions.props b/eng/Versions.props index 14ce4360c4f..75cdb2720dc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24359.3 + 8.0.0-beta.24360.5 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 85e70f443a3..60227c0154b 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24359.3", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24360.5", "Microsoft.Build.NoTargets": "3.7.0" } } From 7f06c7a7f6b74ab8dc4e6cba211b13ad0946720c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 11 Jul 2024 16:53:25 +0000 Subject: [PATCH 021/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From d098532b0c33086e3b69adc48c75c271b1f0451c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Jul 2024 12:30:03 +0000 Subject: [PATCH 022/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From f7808e965791787bae0a58aed1b4f4db3c1e2d7c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 12 Jul 2024 12:41:25 +0000 Subject: [PATCH 023/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From fa8dd7ce1f480963f0f56c8e4091d84ecd052972 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 13 Jul 2024 12:33:49 +0000 Subject: [PATCH 024/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From cb6e9fd60523abe18ef34c55aea31508a637cd8f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 13 Jul 2024 12:46:45 +0000 Subject: [PATCH 025/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From 3e7a827e10e61527179cf462c261c47015912800 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 14 Jul 2024 12:32:52 +0000 Subject: [PATCH 026/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From 4139db6172f73c3443f5099fab4d37a65709d35a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 14 Jul 2024 12:44:37 +0000 Subject: [PATCH 027/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From 9e91fac6229596b87de0a84c3d66b049e21e73fe Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Jul 2024 12:31:28 +0000 Subject: [PATCH 028/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From 4905457e5bfe6b28140f3a0b25388d681c07647f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Jul 2024 12:43:05 +0000 Subject: [PATCH 029/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From 1233d15ad18eb6f6ae749b3fd0eadd6f29a89449 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 15 Jul 2024 12:55:34 +0000 Subject: [PATCH 030/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240712.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24362.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 87626e9d8a8..89bac7398c3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - cc732c57199f725857c201da146525e3be6bc504 + 2fa4c4f8c0b17b48d2f37839563d6862d1974736 diff --git a/eng/Versions.props b/eng/Versions.props index 6677d2d020d..fd5e1c05bd8 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24352.1 + 9.0.0-alpha.1.24362.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 441b820ed256815765375fd0aa81cf6b2ab4faf9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Jul 2024 12:38:37 +0000 Subject: [PATCH 031/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From 833e6d2d8ff9a38db9b3264e96dd40bc8531e784 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 16 Jul 2024 12:55:33 +0000 Subject: [PATCH 032/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 From 5aee3c7a2595336dfb124e3812ca68d1be97d604 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Jul 2024 12:39:16 +0000 Subject: [PATCH 033/271] Update dependencies from https://github.com/dotnet/arcade build 20240710.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24360.4 From f74dda325d001f71a5b4c397dc754c9dc0332d82 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 17 Jul 2024 13:04:22 +0000 Subject: [PATCH 034/271] Update dependencies from https://github.com/dotnet/arcade build 20240716.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24366.7 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/sdl/NuGet.config | 4 ++-- eng/common/sdl/sdl.ps1 | 4 +++- .../templates-official/steps/execute-sdl.yml | 2 -- .../steps/get-federated-access-token.yml | 14 +++++++++++++- eng/common/templates/steps/execute-sdl.yml | 2 -- .../templates/steps/get-federated-access-token.yml | 14 +++++++++++++- global.json | 6 +++--- 9 files changed, 39 insertions(+), 17 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9e5c4be91a0..00530113aa1 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - c9efa535175049eb9cba06cae1f8c3d5dbe768a9 + 94d461b3cffed34241b7be548b6983ec8506bfc3 - + https://github.com/dotnet/arcade - c9efa535175049eb9cba06cae1f8c3d5dbe768a9 + 94d461b3cffed34241b7be548b6983ec8506bfc3 diff --git a/eng/Versions.props b/eng/Versions.props index 75cdb2720dc..bccd1d6d967 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24360.5 + 8.0.0-beta.24366.7 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config index 3849bdb3cf5..5bfbb02ef04 100644 --- a/eng/common/sdl/NuGet.config +++ b/eng/common/sdl/NuGet.config @@ -5,11 +5,11 @@ - + - + diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 index 648c5068d7d..7fe603fe995 100644 --- a/eng/common/sdl/sdl.ps1 +++ b/eng/common/sdl/sdl.ps1 @@ -4,6 +4,8 @@ function Install-Gdn { [Parameter(Mandatory=$true)] [string]$Path, + [string]$Source = "https://pkgs.dev.azure.com/dnceng/_packaging/Guardian1ESPTUpstreamOrgFeed/nuget/v3/index.json", + # If omitted, install the latest version of Guardian, otherwise install that specific version. [string]$Version ) @@ -19,7 +21,7 @@ function Install-Gdn { $ci = $true . $PSScriptRoot\..\tools.ps1 - $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") + $argumentList = @("install", "Microsoft.Guardian.Cli.win-x64", "-Source $Source", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") if ($Version) { $argumentList += "-Version $Version" diff --git a/eng/common/templates-official/steps/execute-sdl.yml b/eng/common/templates-official/steps/execute-sdl.yml index 07426fde05d..301d5c591eb 100644 --- a/eng/common/templates-official/steps/execute-sdl.yml +++ b/eng/common/templates-official/steps/execute-sdl.yml @@ -9,8 +9,6 @@ parameters: steps: - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' diff --git a/eng/common/templates-official/steps/get-federated-access-token.yml b/eng/common/templates-official/steps/get-federated-access-token.yml index e3786cef6df..55e33bd38f7 100644 --- a/eng/common/templates-official/steps/get-federated-access-token.yml +++ b/eng/common/templates-official/steps/get-federated-access-token.yml @@ -3,6 +3,12 @@ parameters: type: string - name: outputVariableName type: string +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +16,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +37,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml index 07426fde05d..301d5c591eb 100644 --- a/eng/common/templates/steps/execute-sdl.yml +++ b/eng/common/templates/steps/execute-sdl.yml @@ -9,8 +9,6 @@ parameters: steps: - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' diff --git a/eng/common/templates/steps/get-federated-access-token.yml b/eng/common/templates/steps/get-federated-access-token.yml index c8c49cc0e8f..55e33bd38f7 100644 --- a/eng/common/templates/steps/get-federated-access-token.yml +++ b/eng/common/templates/steps/get-federated-access-token.yml @@ -3,6 +3,12 @@ parameters: type: string - name: outputVariableName type: string +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +16,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +37,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" \ No newline at end of file + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/global.json b/global.json index 60227c0154b..f32532eddbb 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "8.0.101", + "dotnet": "8.0.107", "runtimes": { "dotnet": [ "2.1.30", @@ -16,12 +16,12 @@ } }, "sdk": { - "version": "8.0.101", + "version": "8.0.107", "allowPrerelease": false, "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24360.5", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24366.7", "Microsoft.Build.NoTargets": "3.7.0" } } From e45bbc798743adb93a6288de0e016f30ccba1240 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 18 Jul 2024 12:47:09 +0000 Subject: [PATCH 035/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24367.4 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- .../steps/get-federated-access-token.yml | 16 +++++++++++++++- global.json | 2 +- 4 files changed, 21 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 3fa5b3420f1..a51522f831a 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 731d793be2d0a66bafc96b1a79dc96b4d1f0301b + 9711d78c7efe6f542b764ef961697474043899e5 - + https://github.com/dotnet/arcade - 731d793be2d0a66bafc96b1a79dc96b4d1f0301b + 9711d78c7efe6f542b764ef961697474043899e5 diff --git a/eng/Versions.props b/eng/Versions.props index f95bd0f7a1c..e68742ca527 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24360.4 + 9.0.0-beta.24367.4 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/core-templates/steps/get-federated-access-token.yml b/eng/common/core-templates/steps/get-federated-access-token.yml index c8c49cc0e8f..3a4d4410c48 100644 --- a/eng/common/core-templates/steps/get-federated-access-token.yml +++ b/eng/common/core-templates/steps/get-federated-access-token.yml @@ -3,6 +3,14 @@ parameters: type: string - name: outputVariableName type: string +- name: is1ESPipeline + type: boolean +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +18,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +39,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" \ No newline at end of file + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/global.json b/global.json index 364cf58b9bd..c6ad6203bcb 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24360.4", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24367.4", "Microsoft.Build.NoTargets": "3.7.0" } } From 4d773effe24f5ce8e401ecfdef2e25f2f8149fa9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 18 Jul 2024 13:10:50 +0000 Subject: [PATCH 036/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/sdl/execute-all-sdl-tools.ps1 | 4 +--- eng/common/sdl/init-sdl.ps1 | 8 -------- eng/common/templates/steps/execute-sdl.yml | 5 ++++- global.json | 2 +- 6 files changed, 11 insertions(+), 18 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 00530113aa1..607308df457 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 94d461b3cffed34241b7be548b6983ec8506bfc3 + fa3d544b066661522f1ec5d5e8cfd461a29b0f8a - + https://github.com/dotnet/arcade - 94d461b3cffed34241b7be548b6983ec8506bfc3 + fa3d544b066661522f1ec5d5e8cfd461a29b0f8a diff --git a/eng/Versions.props b/eng/Versions.props index bccd1d6d967..f111cfbb3b1 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24366.7 + 8.0.0-beta.24367.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 4715d75e974..81ded5b7f47 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -6,7 +6,6 @@ Param( [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ('artifacts')), # Required: the directory where build artifacts are located - [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault # Optional: list of SDL tools to run on source code. See 'configure-sdl-tool.ps1' for tools list # format. @@ -75,7 +74,7 @@ try { } Exec-BlockVerbosely { - & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -GuardianLoggerLevel $GuardianLoggerLevel } $gdnFolder = Join-Path $workingDirectory '.gdn' @@ -104,7 +103,6 @@ try { -TargetDirectory $targetDirectory ` -GdnFolder $gdnFolder ` -ToolsList $tools ` - -AzureDevOpsAccessToken $AzureDevOpsAccessToken ` -GuardianLoggerLevel $GuardianLoggerLevel ` -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams ` -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams ` diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index 3ac1d92b370..588ff8e22fb 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -3,7 +3,6 @@ Param( [string] $Repository, [string] $BranchName='master', [string] $WorkingDirectory, - [string] $AzureDevOpsAccessToken, [string] $GuardianLoggerLevel='Standard' ) @@ -21,14 +20,7 @@ $ci = $true # Don't display the console progress UI - it's a huge perf hit $ProgressPreference = 'SilentlyContinue' -# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file -$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) -$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") -$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0" -$zipFile = "$WorkingDirectory/gdn.zip" - Add-Type -AssemblyName System.IO.Compression.FileSystem -$gdnFolder = (Join-Path $WorkingDirectory '.gdn') try { # if the folder does not exist, we'll do a guardian init and push it to the remote repository diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml index 301d5c591eb..fe0ebf8c904 100644 --- a/eng/common/templates/steps/execute-sdl.yml +++ b/eng/common/templates/steps/execute-sdl.yml @@ -34,16 +34,19 @@ steps: displayName: Execute SDL (Overridden) continueOnError: ${{ parameters.sdlContinueOnError }} condition: ${{ parameters.condition }} + env: + GUARDIAN_DEFAULT_PACKAGE_SOURCE_SECRET: $(System.AccessToken) - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: ${{ parameters.executeAllSdlToolsScript }} -GuardianCliLocation $(GuardianCliLocation) -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} displayName: Execute SDL continueOnError: ${{ parameters.sdlContinueOnError }} condition: ${{ parameters.condition }} + env: + GUARDIAN_DEFAULT_PACKAGE_SOURCE_SECRET: $(System.AccessToken) - ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: # We want to publish the Guardian results and configuration for easy diagnosis. However, the diff --git a/global.json b/global.json index f32532eddbb..32983b1cbad 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24366.7", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24367.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 017716c19babc4574333b01af49cb1796c5559e5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 19 Jul 2024 13:03:47 +0000 Subject: [PATCH 037/271] Update dependencies from https://github.com/dotnet/arcade build 20240718.9 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24368.9 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/core-templates/job/publish-build-assets.yml | 5 +++-- eng/common/core-templates/post-build/post-build.yml | 5 +++-- eng/common/core-templates/steps/publish-logs.yml | 1 - eng/common/post-build/publish-using-darc.ps1 | 1 + global.json | 2 +- 7 files changed, 13 insertions(+), 11 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a51522f831a..b9a101af661 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 9711d78c7efe6f542b764ef961697474043899e5 + b4e499d1f6e6b3a981feabfed290d99261762382 - + https://github.com/dotnet/arcade - 9711d78c7efe6f542b764ef961697474043899e5 + b4e499d1f6e6b3a981feabfed290d99261762382 diff --git a/eng/Versions.props b/eng/Versions.props index e68742ca527..e601f15b24b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24367.4 + 9.0.0-beta.24368.9 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/core-templates/job/publish-build-assets.yml b/eng/common/core-templates/job/publish-build-assets.yml index ec3cd14191a..3d3356e3196 100644 --- a/eng/common/core-templates/job/publish-build-assets.yml +++ b/eng/common/core-templates/job/publish-build-assets.yml @@ -143,9 +143,10 @@ jobs: scriptType: ps scriptLocation: scriptPath scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: > + -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/post-build/post-build.yml b/eng/common/core-templates/post-build/post-build.yml index 20924366b8a..454fd75c7af 100644 --- a/eng/common/core-templates/post-build/post-build.yml +++ b/eng/common/core-templates/post-build/post-build.yml @@ -307,9 +307,10 @@ stages: scriptType: ps scriptLocation: scriptPath scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + arguments: > + -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/core-templates/steps/publish-logs.yml b/eng/common/core-templates/steps/publish-logs.yml index 8c5ea77b586..80788c52319 100644 --- a/eng/common/core-templates/steps/publish-logs.yml +++ b/eng/common/core-templates/steps/publish-logs.yml @@ -32,7 +32,6 @@ steps: '$(MaestroAccessToken)' '$(dn-bot-all-orgs-artifact-feeds-rw)' '$(akams-client-id)' - '$(akams-client-secret)' '$(microsoft-symbol-server-pat)' '$(symweb-symbol-server-pat)' '$(dn-bot-all-orgs-build-rw-code-rw)' diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 4ff587ca46a..90b58e32a87 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -42,6 +42,7 @@ try { --azdev-pat "$AzdoToken" ` --bar-uri "$MaestroApiEndPoint" ` --ci ` + --verbose ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/global.json b/global.json index c6ad6203bcb..6ae7e94c30d 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24367.4", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24368.9", "Microsoft.Build.NoTargets": "3.7.0" } } From bb866ebc67b88040809dbb375d2bfbd8fa0f1120 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 19 Jul 2024 13:25:59 +0000 Subject: [PATCH 038/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 From 90fa5ce2eb48479f6c8d7ac5272d17d39a69b929 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Jul 2024 12:50:48 +0000 Subject: [PATCH 039/271] Update dependencies from https://github.com/dotnet/arcade build 20240718.9 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24368.9 From 30dc292cb1d321070282e27478b73adda1cbf194 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 20 Jul 2024 13:11:13 +0000 Subject: [PATCH 040/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 From 812363b1639a0c8abbef7aaf62d2aeda9f53e7d2 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 21 Jul 2024 12:43:47 +0000 Subject: [PATCH 041/271] Update dependencies from https://github.com/dotnet/arcade build 20240718.9 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24368.9 From 0c8a3f22fa1b06ac7546efb2d15c68c0ebcde7c5 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 21 Jul 2024 13:04:12 +0000 Subject: [PATCH 042/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 From d7ae07d7db1d58ef2920f4d84c2db6128eb3e494 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 22 Jul 2024 12:43:56 +0000 Subject: [PATCH 043/271] Update dependencies from https://github.com/dotnet/arcade build 20240718.9 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24368.9 From 1b961c6604eb7ac8dd6e2787dd33bd1b2e22de13 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 22 Jul 2024 13:00:41 +0000 Subject: [PATCH 044/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240715.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24365.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 89bac7398c3..cec4a3272eb 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 2fa4c4f8c0b17b48d2f37839563d6862d1974736 + 4d5ba7206ed1d56612b36560334494652ed486b2 diff --git a/eng/Versions.props b/eng/Versions.props index fd5e1c05bd8..2322c2e95e2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24362.1 + 9.0.0-alpha.1.24365.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 495ffdbd8074c478b3ffb7a65b004474fcc569c9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 22 Jul 2024 13:04:53 +0000 Subject: [PATCH 045/271] Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 From f8f4793d836e76ff4384921bb2066c34fdf0de02 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Jul 2024 13:00:19 +0000 Subject: [PATCH 046/271] Update dependencies from https://github.com/dotnet/arcade build 20240722.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24372.7 --- eng/Version.Details.xml | 8 +-- eng/Versions.props | 2 +- .../job/source-index-stage1.yml | 6 +- eng/common/native/init-compiler.sh | 56 +++++++------------ global.json | 2 +- 5 files changed, 30 insertions(+), 44 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b9a101af661..ffa8331348e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - b4e499d1f6e6b3a981feabfed290d99261762382 + 4dc25182f9153b892628ef0d4e98663774ad2f01 - + https://github.com/dotnet/arcade - b4e499d1f6e6b3a981feabfed290d99261762382 + 4dc25182f9153b892628ef0d4e98663774ad2f01 diff --git a/eng/Versions.props b/eng/Versions.props index e601f15b24b..e94cbe5844d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24368.9 + 9.0.0-beta.24372.7 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/core-templates/job/source-index-stage1.yml b/eng/common/core-templates/job/source-index-stage1.yml index 945c1c19e82..205fb5b3a39 100644 --- a/eng/common/core-templates/job/source-index-stage1.yml +++ b/eng/common/core-templates/job/source-index-stage1.yml @@ -34,10 +34,12 @@ jobs: pool: ${{ if eq(variables['System.TeamProject'], 'public') }}: name: $(DncEngPublicBuildPool) - image: windows.vs2022.amd64.open + image: 1es-windows-2022-open + os: windows ${{ if eq(variables['System.TeamProject'], 'internal') }}: name: $(DncEngInternalBuildPool) - image: windows.vs2022.amd64 + image: 1es-windows-2022 + os: windows steps: - ${{ if eq(parameters.is1ESPipeline, '') }}: diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 62900e12b21..14175343cc6 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -19,11 +19,9 @@ case "$compiler" in # clangx.y or clang-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" - if [ -z "$minorVersion" ] && [ -n "$majorVersion" ] && [ "$majorVersion" -le 6 ]; then - minorVersion=0; - fi + # LLVM based on v18 released in early 2024, with two releases per year + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%m) - 3) / 6)))" compiler=clang ;; @@ -31,7 +29,9 @@ case "$compiler" in # gccx.y or gcc-x.y version="$(echo "$compiler" | tr -d '[:alpha:]-=')" majorVersion="${version%%.*}" - [ -z "${version##*.*}" ] && minorVersion="${version#*.}" + + # GCC based on v14 released in early 2024, with one release per year + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%m) - 3) / 12)))" compiler=gcc ;; esac @@ -49,12 +49,10 @@ check_version_exists() { desired_version=-1 # Set up the environment to be used for building with the desired compiler. - if command -v "$compiler-$1.$2" > /dev/null; then - desired_version="-$1.$2" - elif command -v "$compiler$1$2" > /dev/null; then - desired_version="$1$2" - elif command -v "$compiler-$1$2" > /dev/null; then - desired_version="-$1$2" + if command -v "$compiler-$1" > /dev/null; then + desired_version="-$1" + elif command -v "$compiler$1" > /dev/null; then + desired_version="$1" fi echo "$desired_version" @@ -75,7 +73,7 @@ set_compiler_version_from_CC() { fi # gcc and clang often display 3 part versions. However, gcc can show only 1 part in some environments. - IFS=. read -r majorVersion minorVersion _ < /dev/null; then - echo "Error: No usable version of $compiler found." + echo "Error: No compatible version of $compiler was found within the range of $minVersion to $maxVersion. Please upgrade your toolchain or specify the compiler explicitly using CLR_CC and CLR_CXX environment variables." exit 1 fi CC="$(command -v "$compiler" 2> /dev/null)" CXX="$(command -v "$cxxCompiler" 2> /dev/null)" set_compiler_version_from_CC - else - if [ "$compiler" = "clang" ] && [ "$majorVersion" -lt 5 ] && { [ "$build_arch" = "arm" ] || [ "$build_arch" = "armel" ]; }; then - # If a major version was provided explicitly, and it was too old, find a newer compiler instead - if ! command -v "$compiler" > /dev/null; then - echo "Error: Found clang version $majorVersion which is not supported on arm/armel architectures, and there is no clang in PATH." - exit 1 - fi - - CC="$(command -v "$compiler" 2> /dev/null)" - CXX="$(command -v "$cxxCompiler" 2> /dev/null)" - set_compiler_version_from_CC - fi fi else - desired_version="$(check_version_exists "$majorVersion" "$minorVersion")" + desired_version="$(check_version_exists "$majorVersion")" if [ "$desired_version" = "-1" ]; then - echo "Error: Could not find specific version of $compiler: $majorVersion $minorVersion." + echo "Error: Could not find specific version of $compiler: $majorVersion." exit 1 fi fi diff --git a/global.json b/global.json index 6ae7e94c30d..9a6fc526323 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24368.9", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24372.7", "Microsoft.Build.NoTargets": "3.7.0" } } From 0024af68be4d3c0720c5e284f138c7c423d672ab Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 23 Jul 2024 13:30:30 +0000 Subject: [PATCH 047/271] Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- .../templates-official/job/publish-build-assets.yml | 2 +- eng/common/templates-official/post-build/post-build.yml | 2 +- eng/common/templates/job/publish-build-assets.yml | 2 +- eng/common/templates/post-build/post-build.yml | 2 +- global.json | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 607308df457..9f27b13e25d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - fa3d544b066661522f1ec5d5e8cfd461a29b0f8a + 48c3fe3df7c28caa8d5e3122195125b55b4a0c26 - + https://github.com/dotnet/arcade - fa3d544b066661522f1ec5d5e8cfd461a29b0f8a + 48c3fe3df7c28caa8d5e3122195125b55b4a0c26 diff --git a/eng/Versions.props b/eng/Versions.props index f111cfbb3b1..a98bc80b298 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24367.1 + 8.0.0-beta.24372.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index ba3e7df8158..0117328800c 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -149,7 +149,7 @@ jobs: scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml index 0dfa387e7b7..b81b8770b34 100644 --- a/eng/common/templates-official/post-build/post-build.yml +++ b/eng/common/templates-official/post-build/post-build.yml @@ -281,7 +281,7 @@ stages: scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 57a41f0a3e1..cc2b346ba8b 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -145,7 +145,7 @@ jobs: scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index 2db4933468f..c3b6a3012fe 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -277,7 +277,7 @@ stages: scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/global.json b/global.json index 32983b1cbad..85afe21d327 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24367.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24372.3", "Microsoft.Build.NoTargets": "3.7.0" } } From 97abe5ff81038e893ec449a70a0c45a88b53795b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Jul 2024 12:47:39 +0000 Subject: [PATCH 048/271] Update dependencies from https://github.com/dotnet/arcade build 20240722.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24372.7 From e932e4806e11fb30427385f67b7666107138e6c1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 24 Jul 2024 13:16:13 +0000 Subject: [PATCH 049/271] Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 From d64490ab4036fcdd5042606649a176bc965cfe5c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Jul 2024 12:59:56 +0000 Subject: [PATCH 050/271] Update dependencies from https://github.com/dotnet/arcade build 20240724.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24374.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ffa8331348e..8db15c878e8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 4dc25182f9153b892628ef0d4e98663774ad2f01 + c45d41114722ff910cde462f4be003b1d7fde58f - + https://github.com/dotnet/arcade - 4dc25182f9153b892628ef0d4e98663774ad2f01 + c45d41114722ff910cde462f4be003b1d7fde58f diff --git a/eng/Versions.props b/eng/Versions.props index e94cbe5844d..08404edeefa 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24372.7 + 9.0.0-beta.24374.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 9a6fc526323..324acd3bc71 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24372.7", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24374.3", "Microsoft.Build.NoTargets": "3.7.0" } } From ccac853bc3720bbd489d17975824e5578087abca Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 25 Jul 2024 13:30:01 +0000 Subject: [PATCH 051/271] Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 From a13e9ad4e463aa84cfa700938f66520086a815f1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Jul 2024 13:03:06 +0000 Subject: [PATCH 052/271] Update dependencies from https://github.com/dotnet/arcade build 20240725.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24375.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/cross/build-rootfs.sh | 14 +++++++------- global.json | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 8db15c878e8..5cae588cefc 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - c45d41114722ff910cde462f4be003b1d7fde58f + 3e18bd4f62388b829d0b9dcd1ee131431674aa5f - + https://github.com/dotnet/arcade - c45d41114722ff910cde462f4be003b1d7fde58f + 3e18bd4f62388b829d0b9dcd1ee131431674aa5f diff --git a/eng/Versions.props b/eng/Versions.props index 08404edeefa..cfceb37a632 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24374.3 + 9.0.0-beta.24375.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/cross/build-rootfs.sh b/eng/common/cross/build-rootfs.sh index 6d99d1263c0..4b5e8d7166b 100755 --- a/eng/common/cross/build-rootfs.sh +++ b/eng/common/cross/build-rootfs.sh @@ -605,18 +605,18 @@ elif [[ "$__CodeName" == "illumos" ]]; then fi echo "Building binutils. Please wait.." if [[ "$__hasWget" == 1 ]]; then - wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf - + wget -O- https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - else - curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.bz2 | tar -xjf - + curl -SL https://ftp.gnu.org/gnu/binutils/binutils-2.42.tar.xz | tar -xJf - fi mkdir build-binutils && cd build-binutils - ../binutils-2.33.1/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" + ../binutils-2.42/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" make -j "$JOBS" && make install && cd .. echo "Building gcc. Please wait.." if [[ "$__hasWget" == 1 ]]; then - wget -O- https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf - + wget -O- https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - else - curl -SL https://ftp.gnu.org/gnu/gcc/gcc-8.4.0/gcc-8.4.0.tar.xz | tar -xJf - + curl -SL https://ftp.gnu.org/gnu/gcc/gcc-13.3.0/gcc-13.3.0.tar.xz | tar -xJf - fi CFLAGS="-fPIC" CXXFLAGS="-fPIC" @@ -624,7 +624,7 @@ elif [[ "$__CodeName" == "illumos" ]]; then CFLAGS_FOR_TARGET="-fPIC" export CFLAGS CXXFLAGS CXXFLAGS_FOR_TARGET CFLAGS_FOR_TARGET mkdir build-gcc && cd build-gcc - ../gcc-8.4.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.10" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ + ../gcc-13.3.0/configure --prefix="$__RootfsDir" --target="${__illumosArch}-sun-solaris2.11" --program-prefix="${__illumosArch}-illumos-" --with-sysroot="$__RootfsDir" --with-gnu-as \ --with-gnu-ld --disable-nls --disable-libgomp --disable-libquadmath --disable-libssp --disable-libvtv --disable-libcilkrts --disable-libada --disable-libsanitizer \ --disable-libquadmath-support --disable-shared --enable-tls make -j "$JOBS" && make install && cd .. @@ -632,7 +632,7 @@ elif [[ "$__CodeName" == "illumos" ]]; then if [[ "$__UseMirror" == 1 ]]; then BaseUrl=https://pkgsrc.smartos.skylime.net fi - BaseUrl="$BaseUrl/packages/SmartOS/trunk/${__illumosArch}/All" + BaseUrl="$BaseUrl/packages/SmartOS/2019Q4/${__illumosArch}/All" echo "Downloading manifest" if [[ "$__hasWget" == 1 ]]; then wget "$BaseUrl" diff --git a/global.json b/global.json index 324acd3bc71..4de5fa72419 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24374.3", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24375.3", "Microsoft.Build.NoTargets": "3.7.0" } } From bb46e7919fc2e3708d47eea058bd708539c9373b Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 26 Jul 2024 13:33:28 +0000 Subject: [PATCH 053/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 9f27b13e25d..c82d3837f10 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 48c3fe3df7c28caa8d5e3122195125b55b4a0c26 + 1e2be7464703499cf98e20536fb4da4218c8fce1 - + https://github.com/dotnet/arcade - 48c3fe3df7c28caa8d5e3122195125b55b4a0c26 + 1e2be7464703499cf98e20536fb4da4218c8fce1 diff --git a/eng/Versions.props b/eng/Versions.props index a98bc80b298..3cb51b4a92b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24372.3 + 8.0.0-beta.24376.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 85afe21d327..d2da2009ac8 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24372.3", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24376.1", "Microsoft.Build.NoTargets": "3.7.0" } } From cd11f74af8b02c1446481fdc77a02250a77a5c63 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 27 Jul 2024 12:51:10 +0000 Subject: [PATCH 054/271] Update dependencies from https://github.com/dotnet/arcade build 20240725.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24375.3 From cfb4682d3cf1f8edcacb5f4ea251ce982b287426 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 27 Jul 2024 13:19:13 +0000 Subject: [PATCH 055/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From f4875da87ac75ce80f5843664e2a874b97f0569c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 28 Jul 2024 12:51:18 +0000 Subject: [PATCH 056/271] Update dependencies from https://github.com/dotnet/arcade build 20240725.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24375.3 From 2d8f6a49f48a031669ba0b4f8c48efd53e2c7bfb Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 28 Jul 2024 13:19:59 +0000 Subject: [PATCH 057/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 28b80013caf9a599d8b919a3ea93b9f850f5b9c1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 29 Jul 2024 12:50:09 +0000 Subject: [PATCH 058/271] Update dependencies from https://github.com/dotnet/arcade build 20240725.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24375.3 From c666f0f1847cb4a855504e739864fec9fe4c5d3a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 29 Jul 2024 13:09:27 +0000 Subject: [PATCH 059/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240724.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24304.1 -> To Version 9.0.0-alpha.1.24374.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index cec4a3272eb..b5503df4168 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 4d5ba7206ed1d56612b36560334494652ed486b2 + 26ae006620fb4518276b494efac55dbcd8f80224 diff --git a/eng/Versions.props b/eng/Versions.props index 2322c2e95e2..0dcfbf24b28 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24365.1 + 9.0.0-alpha.1.24374.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From a14113629d2a784438d93dc0d8047e2ad9d635de Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 29 Jul 2024 13:20:31 +0000 Subject: [PATCH 060/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 8cf7cef8abae0657c3efb34750a271f15179291d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 30 Jul 2024 13:00:07 +0000 Subject: [PATCH 061/271] Update dependencies from https://github.com/dotnet/arcade build 20240729.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24379.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 5cae588cefc..ef8fdd56bdd 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 3e18bd4f62388b829d0b9dcd1ee131431674aa5f + 4f5a4ad88d27b56ceeaa43ced670999c33bd2598 - + https://github.com/dotnet/arcade - 3e18bd4f62388b829d0b9dcd1ee131431674aa5f + 4f5a4ad88d27b56ceeaa43ced670999c33bd2598 diff --git a/eng/Versions.props b/eng/Versions.props index cfceb37a632..e1767dcaa60 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24375.3 + 9.0.0-beta.24379.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 4de5fa72419..ca4ef98acc8 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24375.3", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24379.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 4ef57e50aa9e25ab7dcaa0d8df57a729a2721871 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 30 Jul 2024 13:28:52 +0000 Subject: [PATCH 062/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 8f5597823409c36efc0821c807b2d7587be87c97 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 31 Jul 2024 12:46:05 +0000 Subject: [PATCH 063/271] Update dependencies from https://github.com/dotnet/arcade build 20240729.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24379.1 From beeba173e47ad3fb4af6fa6c3bc449f211437322 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 31 Jul 2024 13:14:25 +0000 Subject: [PATCH 064/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From cdc027116b294ec53e1d3fe64bb96a66180d8c26 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 1 Aug 2024 12:34:58 +0000 Subject: [PATCH 065/271] Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24401.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/native/init-compiler.sh | 4 ++-- global.json | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index ef8fdd56bdd..25a1c8dd400 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 4f5a4ad88d27b56ceeaa43ced670999c33bd2598 + a3dae8d4fd5a17c147cbecfd31e61463731ac0cc - + https://github.com/dotnet/arcade - 4f5a4ad88d27b56ceeaa43ced670999c33bd2598 + a3dae8d4fd5a17c147cbecfd31e61463731ac0cc diff --git a/eng/Versions.props b/eng/Versions.props index e1767dcaa60..e009d75c859 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24379.1 + 9.0.0-beta.24401.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/native/init-compiler.sh b/eng/common/native/init-compiler.sh index 14175343cc6..9a0e1f2b456 100644 --- a/eng/common/native/init-compiler.sh +++ b/eng/common/native/init-compiler.sh @@ -21,7 +21,7 @@ case "$compiler" in majorVersion="${version%%.*}" # LLVM based on v18 released in early 2024, with two releases per year - maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%m) - 3) / 6)))" + maxVersion="$((18 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 6)))" compiler=clang ;; @@ -31,7 +31,7 @@ case "$compiler" in majorVersion="${version%%.*}" # GCC based on v14 released in early 2024, with one release per year - maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%m) - 3) / 12)))" + maxVersion="$((14 + ((($(date +%Y) - 2024) * 12 + $(date +%-m) - 3) / 12)))" compiler=gcc ;; esac diff --git a/global.json b/global.json index ca4ef98acc8..717c46b0b60 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24379.1", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24401.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 31d17321d6b67ffb2603ef334db3ffa4907c408a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 1 Aug 2024 13:04:15 +0000 Subject: [PATCH 066/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 8efa78569501862944b4585bdd43a9eb3fcb6c6f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 2 Aug 2024 12:50:46 +0000 Subject: [PATCH 067/271] Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24401.1 From 60562e8b00110dfa2e8af8edbe12aa87fdafd11d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 2 Aug 2024 13:18:25 +0000 Subject: [PATCH 068/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 683db2afa8e6413c62b70abb4fa99262a57cd6e4 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 3 Aug 2024 12:39:36 +0000 Subject: [PATCH 069/271] Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24401.1 From caef67c59631a4d1b8e4717be669b122dbeb5504 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 3 Aug 2024 13:06:45 +0000 Subject: [PATCH 070/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 799fadca41aba69c556683355f9aa4f78b144a88 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 4 Aug 2024 12:48:58 +0000 Subject: [PATCH 071/271] Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24401.1 From f0a3b5a074cc78304db078f89f0242bee1a3b0ed Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 4 Aug 2024 13:18:37 +0000 Subject: [PATCH 072/271] Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 From 44eec4620f10dedb60e3721dc3d7ac3edd5c8bed Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 5 Aug 2024 12:39:24 +0000 Subject: [PATCH 073/271] Update dependencies from https://github.com/dotnet/arcade build 20240801.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24352.2 -> To Version 9.0.0-beta.24401.1 From b169e89f1fbf7d13e69f151445f329064ecf2293 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 7 Aug 2024 12:49:54 +0000 Subject: [PATCH 074/271] Update dependencies from https://github.com/dotnet/arcade build 20240805.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24401.1 -> To Version 9.0.0-beta.24405.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 25a1c8dd400..b699a487db3 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - a3dae8d4fd5a17c147cbecfd31e61463731ac0cc + 2c829550b968e29389ce8392244da2b006d71301 - + https://github.com/dotnet/arcade - a3dae8d4fd5a17c147cbecfd31e61463731ac0cc + 2c829550b968e29389ce8392244da2b006d71301 diff --git a/eng/Versions.props b/eng/Versions.props index e009d75c859..9fca6f7c09c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24401.1 + 9.0.0-beta.24405.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 717c46b0b60..f27b05b47b1 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24401.1", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24405.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 60926b85aa5fe15254564a09ca354b2213236762 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 8 Aug 2024 12:47:14 +0000 Subject: [PATCH 075/271] Update dependencies from https://github.com/dotnet/arcade build 20240808.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24405.1 -> To Version 9.0.0-beta.24408.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b699a487db3..a13abc14ba8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 2c829550b968e29389ce8392244da2b006d71301 + 610e251fc34686333b98188320ca1eecd7e6af6c - + https://github.com/dotnet/arcade - 2c829550b968e29389ce8392244da2b006d71301 + 610e251fc34686333b98188320ca1eecd7e6af6c diff --git a/eng/Versions.props b/eng/Versions.props index 9fca6f7c09c..be059735f7f 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24405.1 + 9.0.0-beta.24408.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index f27b05b47b1..55a3fefbfb5 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24405.1", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.1", "Microsoft.Build.NoTargets": "3.7.0" } } From a8ead7168525b779b048734c7692e1beddc531c6 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 9 Aug 2024 12:42:08 +0000 Subject: [PATCH 076/271] Update dependencies from https://github.com/dotnet/arcade build 20240808.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24408.1 -> To Version 9.0.0-beta.24408.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/darc-init.ps1 | 2 +- eng/common/darc-init.sh | 2 +- global.json | 2 +- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a13abc14ba8..76f9e043b17 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 610e251fc34686333b98188320ca1eecd7e6af6c + 60ae233c3d77f11c5fdb53e570b64d503b13ba59 - + https://github.com/dotnet/arcade - 610e251fc34686333b98188320ca1eecd7e6af6c + 60ae233c3d77f11c5fdb53e570b64d503b13ba59 diff --git a/eng/Versions.props b/eng/Versions.props index be059735f7f..bb76ebd6c09 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24408.1 + 9.0.0-beta.24408.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/darc-init.ps1 b/eng/common/darc-init.ps1 index 8fda30bdce2..e3374310563 100644 --- a/eng/common/darc-init.ps1 +++ b/eng/common/darc-init.ps1 @@ -1,6 +1,6 @@ param ( $darcVersion = $null, - $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16', + $versionEndpoint = 'https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20', $verbosity = 'minimal', $toolpath = $null ) diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh index c305ae6bd77..36dbd45e1ce 100755 --- a/eng/common/darc-init.sh +++ b/eng/common/darc-init.sh @@ -2,7 +2,7 @@ source="${BASH_SOURCE[0]}" darcVersion='' -versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2019-01-16' +versionEndpoint='https://maestro.dot.net/api/assets/darc-version?api-version=2020-02-20' verbosity='minimal' while [[ $# > 0 ]]; do diff --git a/global.json b/global.json index 55a3fefbfb5..4c7a8f700f4 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.1", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.2", "Microsoft.Build.NoTargets": "3.7.0" } } From ae5c378660837808a0ca3116966ed408239ecb04 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 10 Aug 2024 12:07:16 +0000 Subject: [PATCH 077/271] Failed to perform coherency update for one or more dependencies. From 204efc45d257a7e8d6bbaa1244666954945dae1a Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 12 Aug 2024 12:42:48 +0000 Subject: [PATCH 078/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240805.2 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24374.1 -> To Version 9.0.0-alpha.1.24405.2 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b5503df4168..b9901fbfdc4 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - 26ae006620fb4518276b494efac55dbcd8f80224 + 0d066e61a30c2599d0ced871ea45acf0e10571af diff --git a/eng/Versions.props b/eng/Versions.props index 0dcfbf24b28..ffa20a9acee 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24374.1 + 9.0.0-alpha.1.24405.2 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 718cea3013b94c037580bf2319c52e63bce225ff Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 14 Aug 2024 12:34:08 +0000 Subject: [PATCH 079/271] Update dependencies from https://github.com/dotnet/arcade build 20240812.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24376.1 -> To Version 8.0.0-beta.24412.1 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index c82d3837f10..296eefb7923 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 1e2be7464703499cf98e20536fb4da4218c8fce1 + 770e16f44e6727d0efe1168e62279a399cc92edd - + https://github.com/dotnet/arcade - 1e2be7464703499cf98e20536fb4da4218c8fce1 + 770e16f44e6727d0efe1168e62279a399cc92edd diff --git a/eng/Versions.props b/eng/Versions.props index 3cb51b4a92b..4d26f56b0bc 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24376.1 + 8.0.0-beta.24412.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index d2da2009ac8..e89a34a82ba 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24376.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24412.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 9e63e09781a5776054a84e29a96b6a16f2820b6c Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Aug 2024 12:54:01 +0000 Subject: [PATCH 080/271] Update dependencies from https://github.com/dotnet/arcade build 20240814.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24408.2 -> To Version 9.0.0-beta.24414.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 76f9e043b17..e888013264e 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 4d15f8d1f2d61f6513b70f0bcd4bd3c1828a3a68 - + https://github.com/dotnet/arcade - 60ae233c3d77f11c5fdb53e570b64d503b13ba59 + 4d15f8d1f2d61f6513b70f0bcd4bd3c1828a3a68 diff --git a/eng/Versions.props b/eng/Versions.props index bb76ebd6c09..3b6f2e471ab 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24408.2 + 9.0.0-beta.24414.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 4c7a8f700f4..c545052a5aa 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24408.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24414.3", "Microsoft.Build.NoTargets": "3.7.0" } } From f38b165f41f8417544417520264b6f0bf4f40863 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 15 Aug 2024 13:20:23 +0000 Subject: [PATCH 081/271] Update dependencies from https://github.com/dotnet/arcade build 20240813.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24412.1 -> To Version 8.0.0-beta.24413.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 296eefb7923..228c071e3f0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 770e16f44e6727d0efe1168e62279a399cc92edd + 51321b7e150a2f426cb9e1334687bdfab68ec323 - + https://github.com/dotnet/arcade - 770e16f44e6727d0efe1168e62279a399cc92edd + 51321b7e150a2f426cb9e1334687bdfab68ec323 diff --git a/eng/Versions.props b/eng/Versions.props index 4d26f56b0bc..085902e05e4 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24412.1 + 8.0.0-beta.24413.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index e89a34a82ba..1734d1724cc 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "8.0.107", + "dotnet": "8.0.108", "runtimes": { "dotnet": [ "2.1.30", @@ -16,12 +16,12 @@ } }, "sdk": { - "version": "8.0.107", + "version": "8.0.108", "allowPrerelease": false, "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24412.1", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24413.2", "Microsoft.Build.NoTargets": "3.7.0" } } From c2894e201ba6287902689c9add80f6d3768640e2 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 21 Jun 2024 17:13:04 +1000 Subject: [PATCH 082/271] Add a numeric version to document snapshot, and increment it automatically --- .../ProjectSystem/DocumentSnapshot.cs | 2 ++ .../ProjectSystem/DocumentState.cs | 31 ++++++++++++++----- .../ProjectSystem/IDocumentSnapshot.cs | 2 ++ .../ProjectSystem/ImportDocumentSnapshot.cs | 2 ++ .../ProjectSystem/ProjectState.cs | 2 +- .../ProjectSystem/RemoteDocumentSnapshot.cs | 2 ++ 6 files changed, 33 insertions(+), 8 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs index e43ca72a06c..fb46ddb484f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs @@ -17,6 +17,8 @@ internal class DocumentSnapshot : IDocumentSnapshot public IProjectSnapshot Project => ProjectInternal; public bool SupportsOutput => true; + public int Version => State.Version; + public ProjectSnapshot ProjectInternal { get; } public DocumentState State { get; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs index 859673968b2..64385538afa 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs @@ -28,9 +28,11 @@ internal partial class DocumentState private Task? _loaderTask; private SourceText? _sourceText; private VersionStamp? _version; + private readonly int _numericVersion; public static DocumentState Create( HostDocument hostDocument, + int numericVersion, Func>? loader) { if (hostDocument is null) @@ -38,7 +40,19 @@ public static DocumentState Create( throw new ArgumentNullException(nameof(hostDocument)); } - return new DocumentState(hostDocument, null, null, loader); + return new DocumentState(hostDocument, null, null, numericVersion, loader); + } + + public static DocumentState Create( + HostDocument hostDocument, + Func>? loader) + { + if (hostDocument is null) + { + throw new ArgumentNullException(nameof(hostDocument)); + } + + return new DocumentState(hostDocument, null, null, 1, loader); } // Internal for testing @@ -46,16 +60,19 @@ internal DocumentState( HostDocument hostDocument, SourceText? text, VersionStamp? version, + int numericVersion, Func>? loader) { HostDocument = hostDocument; _sourceText = text; _version = version; + _numericVersion = numericVersion; _loader = loader ?? EmptyLoader; _lock = new object(); } public HostDocument HostDocument { get; } + public int Version => _numericVersion; public bool IsGeneratedOutputResultAvailable => ComputedState.IsResultAvailable == true; @@ -152,12 +169,12 @@ public bool TryGetTextVersion(out VersionStamp result) public virtual DocumentState WithConfigurationChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _loader) + var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, _version = _version, - _loaderTask = _loaderTask + _loaderTask = _loaderTask, }; // Do not cache computed state @@ -167,7 +184,7 @@ public virtual DocumentState WithConfigurationChange() public virtual DocumentState WithImportsChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _loader) + var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, @@ -183,7 +200,7 @@ public virtual DocumentState WithImportsChange() public virtual DocumentState WithProjectWorkspaceStateChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _loader) + var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, @@ -206,7 +223,7 @@ public virtual DocumentState WithText(SourceText sourceText, VersionStamp versio // Do not cache the computed state - return new DocumentState(HostDocument, sourceText, version, null); + return new DocumentState(HostDocument, sourceText, version, _numericVersion + 1, null); } public virtual DocumentState WithTextLoader(Func> loader) @@ -218,7 +235,7 @@ public virtual DocumentState WithTextLoader(Func> loader) // Do not cache the computed state - return new DocumentState(HostDocument, null, null, loader); + return new DocumentState(HostDocument, null, null, _numericVersion + 1, loader); } // Internal, because we are temporarily sharing code with CohostDocumentSnapshot diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs index c1306beee09..460cfac55d5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs @@ -16,6 +16,8 @@ internal interface IDocumentSnapshot IProjectSnapshot Project { get; } bool SupportsOutput { get; } + int Version { get; } + Task GetTextAsync(); Task GetTextVersionAsync(); Task GetGeneratedOutputAsync(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs index 68f7b345d16..2cc8f3cba02 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs @@ -32,6 +32,8 @@ public ImportDocumentSnapshot(IProjectSnapshot project, RazorProjectItem item) _version = VersionStamp.Default; } + public int Version => 1; + public Task GetGeneratedOutputAsync() => throw new NotSupportedException(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs index e8db1a11848..b51e3bbd285 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs @@ -243,7 +243,7 @@ public ProjectState WithAddedHostDocument(HostDocument hostDocument, Func true; + public int Version => throw new NotImplementedException("We don't expect to use this in cohosting because we do not control generated document creation."); + public Task GetTextAsync() => _textDocument.GetTextAsync(); public Task GetTextVersionAsync() => _textDocument.GetTextVersionAsync(); From 546a349bcd0123b94d40020b0392b98bf67e5dc3 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 21 Jun 2024 17:13:28 +1000 Subject: [PATCH 083/271] Remove document version cache --- .../RazorSemanticTokensBenchmark.cs | 9 - ...zorSemanticTokensRangeEndpointBenchmark.cs | 8 - .../RazorSemanticTokensScrollingBenchmark.cs | 7 - .../DocumentContextFactory.cs | 11 +- .../DocumentVersionCache.DocumentEntry.cs | 17 - .../DocumentVersionCache.TestAccessor.cs | 57 ---- .../DocumentVersionCache.cs | 179 ---------- .../IServiceCollectionExtensions.cs | 3 - .../Formatting/HtmlFormatter.cs | 20 +- .../Formatting/HtmlFormattingPass.cs | 3 +- .../GeneratedDocumentSynchronizer.cs | 12 +- .../IDocumentVersionCache.cs | 16 - .../ProjectSystem/RazorProjectService.cs | 35 -- .../Endpoints/RazorCustomMessageTarget.cs | 16 + ...RazorCustomMessageTarget_SemanticTokens.cs | 6 +- ...rCustomMessageTarget_UpdateCSharpBuffer.cs | 13 +- .../CodeActionEndToEndTest.NetFx.cs | 2 +- .../DocumentContextFactoryTest.cs | 15 +- ...extDocumentUriPresentationEndpointTests.cs | 16 +- .../DocumentVersionCacheTest.cs | 322 ------------------ .../Formatting_NetFx/FormattingTestBase.cs | 5 +- .../TestRazorFormattingService.cs | 8 +- .../GeneratedDocumentSynchronizerTest.cs | 9 +- .../RazorComponentSearchEngineTest.cs | 3 - .../RazorProjectServiceTest.cs | 11 +- .../Refactoring/RenameEndpointTest.cs | 4 +- .../TestRazorProjectService.cs | 2 - .../ProjectSystem/TestDocumentSnapshot.cs | 2 + .../ProjectSystem/ProjectStateTest.cs | 2 +- 29 files changed, 64 insertions(+), 749 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs delete mode 100644 src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs index d7825241214..8afb6f83298 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.AspNetCore.Razor.LanguageServer.Semantic; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; @@ -28,8 +27,6 @@ public class RazorSemanticTokensBenchmark : RazorLanguageServerBenchmarkBase { private IRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - private Uri DocumentUri => DocumentContext.Uri; private IDocumentSnapshot DocumentSnapshot => DocumentContext.Snapshot; @@ -75,9 +72,6 @@ public async Task InitializeRazorSemanticAsync() public async Task RazorSemanticTokensRangeAsync() { var cancellationToken = CancellationToken.None; - var documentVersion = 1; - - VersionCache.TrackDocumentVersion(DocumentSnapshot, documentVersion); await RazorSemanticTokenService.GetSemanticTokensAsync(DocumentContext, Range.ToLinePositionSpan(), colorBackground: false, Guid.Empty, cancellationToken: cancellationToken).ConfigureAwait(false); } @@ -98,10 +92,7 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { - var capabilitiesService = new BenchmarkClientCapabilitiesService(new VSInternalClientCapabilities { SupportsVisualStudioExtensions = true }); - var legend = new RazorSemanticTokensLegendService(capabilitiesService); RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } internal class TestRazorSemanticTokensInfoService : RazorSemanticTokensInfoService diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs index 8258f197fc8..041413a31b5 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs @@ -32,12 +32,8 @@ public class RazorSemanticTokensRangeEndpointBenchmark : RazorLanguageServerBenc private SemanticTokensRangeEndpoint SemanticTokensRangeEndpoint { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - private Uri DocumentUri => DocumentContext.Uri; - private IDocumentSnapshot DocumentSnapshot => DocumentContext.Snapshot; - private VersionedDocumentContext DocumentContext { get; set; } private Range Range { get; set; } @@ -83,9 +79,6 @@ public async Task InitializeRazorSemanticAsync() start: (0, 0), end: (text.Lines.Count - 1, text.Lines[^1].Span.Length - 1)); - var documentVersion = 1; - VersionCache.TrackDocumentVersion(DocumentSnapshot, documentVersion); - RequestContext = new RazorRequestContext(DocumentContext, RazorLanguageServerHost.GetRequiredService(), "lsp/method", uri: null); var random = new Random(); @@ -133,7 +126,6 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } internal class TestCustomizableRazorSemanticTokensInfoService : RazorSemanticTokensInfoService diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs index 4063270b669..6f5107bb265 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs @@ -8,7 +8,6 @@ using System.Threading; using System.Threading.Tasks; using BenchmarkDotNet.Attributes; -using Microsoft.AspNetCore.Razor.LanguageServer; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.CodeAnalysis.Text; @@ -23,8 +22,6 @@ public class RazorSemanticTokensScrollingBenchmark : RazorLanguageServerBenchmar { private IRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; } - private IDocumentVersionCache VersionCache { get; set; } - private VersionedDocumentContext DocumentContext { get; set; } private Uri DocumentUri => DocumentContext.Uri; @@ -66,9 +63,6 @@ public async Task InitializeRazorSemanticAsync() public async Task RazorSemanticTokensRangeScrollingAsync() { var cancellationToken = CancellationToken.None; - var documentVersion = 1; - - VersionCache!.TrackDocumentVersion(DocumentSnapshot, documentVersion); var documentLineCount = Range.End.Line; @@ -105,6 +99,5 @@ protected internal override void Builder(IServiceCollection collection) private void EnsureServicesInitialized() { RazorSemanticTokenService = RazorLanguageServerHost.GetRequiredService(); - VersionCache = RazorLanguageServerHost.GetRequiredService(); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index c752e617e0b..7f46807c2a3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -18,12 +18,10 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal sealed class DocumentContextFactory( IProjectSnapshotManager projectManager, - IDocumentVersionCache documentVersionCache, ILoggerFactory loggerFactory) : IDocumentContextFactory { private readonly IProjectSnapshotManager _projectManager = projectManager; - private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool TryCreate( @@ -80,13 +78,8 @@ private bool TryGetDocumentAndVersion( return true; } - if (_documentVersionCache.TryGetDocumentVersion(documentSnapshot, out var version)) - { - documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, version.Value); - return true; - } - - _logger.LogWarning($"Tried to create context for document {filePath} and project {projectContext?.Id} and a document was found, but version didn't match."); + documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, documentSnapshot.Version); + return true; } // This is super rare, if we get here it could mean many things. Some of which: diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs deleted file mode 100644 index 8c75ad73168..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.DocumentEntry.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache -{ - private readonly struct DocumentEntry(IDocumentSnapshot document, int version) - { - public WeakReference Document { get; } = new WeakReference(document); - - public int Version { get; } = version; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs deleted file mode 100644 index 8af39581c2a..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.TestAccessor.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -#if !NET -using System.Collections.Generic; -#endif -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache -{ - internal TestAccessor GetTestAccessor() => new(this); - - internal class TestAccessor(DocumentVersionCache @this) - { - private readonly DocumentVersionCache _this = @this; - - public record struct DocumentEntry(IDocumentSnapshot? Document, int Version); - - public ImmutableDictionary> GetEntries() - { - using var result = new PooledDictionaryBuilder>(); - using var _ = _this._lock.EnterReadLock(); - - foreach (var (key, entries) in _this._documentLookup_NeedsLock) - { - using var versions = new PooledArrayBuilder(); - - foreach (var entry in entries) - { - var document = entry.Document.TryGetTarget(out var target) - ? target - : null; - - var version = entry.Version; - - versions.Add(new(document, version)); - } - - result.Add(key, versions.ToImmutable()); - } - - return result.ToImmutable(); - } - - public void MarkAsLatestVersion(IDocumentSnapshot document) - { - using (_this._lock.EnterUpgradeableReadLock()) - { - _this.MarkAsLatestVersion(document); - } - } - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs deleted file mode 100644 index b92fc2a926e..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentVersionCache.cs +++ /dev/null @@ -1,179 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Workspaces; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal sealed partial class DocumentVersionCache : IDocumentVersionCache, IRazorStartupService -{ - internal const int MaxDocumentTrackingCount = 20; - - private readonly Dictionary> _documentLookup_NeedsLock = new(FilePathComparer.Instance); - private readonly ReadWriterLocker _lock = new(); - private readonly IProjectSnapshotManager _projectManager; - - public DocumentVersionCache(IProjectSnapshotManager projectManager) - { - _projectManager = projectManager; - _projectManager.Changed += ProjectManager_Changed; - } - - private void ProjectManager_Changed(object? sender, ProjectChangeEventArgs args) - { - // Don't do any work if the solution is closing - if (args.SolutionIsClosing) - { - return; - } - - if (args.Kind == ProjectChangeKind.DocumentChanged) - { - var documentFilePath = args.DocumentFilePath.AssumeNotNull(); - - using (_lock.EnterUpgradeableReadLock()) - { - if (_documentLookup_NeedsLock.ContainsKey(documentFilePath) && - !_projectManager.IsDocumentOpen(documentFilePath)) - { - using (_lock.EnterWriteLock()) - { - // Document closed, evict entry. - _documentLookup_NeedsLock.Remove(documentFilePath); - } - } - } - } - - // Any event that has a project may have changed the state of the documents - // and therefore requires us to mark all existing documents as latest. - if (!_projectManager.TryGetLoadedProject(args.ProjectKey, out var project)) - { - // Project no longer loaded, so there's no work to do. - return; - } - - CaptureProjectDocumentsAsLatest(project); - } - - public void TrackDocumentVersion(IDocumentSnapshot documentSnapshot, int version) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - using (_lock.EnterUpgradeableReadLock()) - { - TrackDocumentVersionCore(documentSnapshot, version); - } - } - - private void TrackDocumentVersionCore(IDocumentSnapshot documentSnapshot, int version) - { - Debug.Assert(_lock.IsUpgradeableReadLockHeld); - - // Need to ensure the write lock covers all uses of documentEntries, not just DocumentLookup - using (_lock.EnterWriteLock()) - { - var key = documentSnapshot.FilePath.AssumeNotNull(); - if (!_documentLookup_NeedsLock.TryGetValue(key, out var documentEntries)) - { - documentEntries = []; - _documentLookup_NeedsLock.Add(key, documentEntries); - } - - if (documentEntries.Count == MaxDocumentTrackingCount) - { - // Clear the oldest document entry - - // With this approach we'll slowly leak memory as new documents are added to the system. We don't clear up - // document file paths where where all of the corresponding entries are expired. - documentEntries.RemoveAt(0); - } - - var entry = new DocumentEntry(documentSnapshot, version); - documentEntries.Add(entry); - } - } - - public int GetLatestDocumentVersion(string filePath) - { - using var _ = _lock.EnterReadLock(); - - if (!_documentLookup_NeedsLock.TryGetValue(filePath, out var documentEntries)) - { - return -1; - } - - return documentEntries[^1].Version; - } - - public bool TryGetDocumentVersion(IDocumentSnapshot documentSnapshot, [NotNullWhen(true)] out int? version) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - using var _ = _lock.EnterReadLock(); - - var filePath = documentSnapshot.FilePath.AssumeNotNull(); - if (!_documentLookup_NeedsLock.TryGetValue(filePath, out var documentEntries)) - { - version = null; - return false; - } - - // We iterate backwards over the entries to prioritize newer entries. - for (var i = documentEntries.Count - 1; i >= 0; i--) - { - if (documentEntries[i].Document.TryGetTarget(out var document) && - document == documentSnapshot) - { - version = documentEntries[i].Version; - return true; - } - } - - version = null; - return false; - } - - private void CaptureProjectDocumentsAsLatest(IProjectSnapshot projectSnapshot) - { - Debug.Assert(!_lock.IsUpgradeableReadLockHeld); - - using var _ = _lock.EnterUpgradeableReadLock(); - - foreach (var documentPath in projectSnapshot.DocumentFilePaths) - { - if (_documentLookup_NeedsLock.ContainsKey(documentPath) && - projectSnapshot.GetDocument(documentPath) is { } document) - { - MarkAsLatestVersion(document); - } - } - } - - private void MarkAsLatestVersion(IDocumentSnapshot document) - { - Debug.Assert(_lock.IsUpgradeableReadLockHeld); - - if (!_documentLookup_NeedsLock.TryGetValue(document.FilePath.AssumeNotNull(), out var documentEntries)) - { - return; - } - - var latestEntry = documentEntries[^1]; - - // Update our internal tracking state to track the changed document as the latest document. - TrackDocumentVersionCore(document, latestEntry.Version); - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 38dfdb87dfb..42a5baee4c9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -195,9 +195,6 @@ public static void AddDocumentManagementServices(this IServiceCollection service services.AddSingleton(); services.AddSingleton(sp => new Lazy(sp.GetRequiredService)); - services.AddSingleton(); - services.AddSingleton((services) => (IRazorStartupService)services.GetRequiredService()); - services.AddSingleton(); services.AddSingleton(); services.AddSingleton((services) => (RazorProjectService)services.GetRequiredService()); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 288afdeacac..4e990827dea 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -16,15 +16,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class HtmlFormatter { - private readonly IDocumentVersionCache _documentVersionCache; private readonly IClientConnection _clientConnection; - public HtmlFormatter( - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache) + public HtmlFormatter(IClientConnection clientConnection) { _clientConnection = clientConnection; - _documentVersionCache = documentVersionCache; } public async Task FormatAsync( @@ -36,10 +32,7 @@ public async Task FormatAsync( throw new ArgumentNullException(nameof(context)); } - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) - { - return Array.Empty(); - } + var documentVersion = context.OriginalSnapshot.Version; var @params = new RazorDocumentFormattingParams() { @@ -47,7 +40,7 @@ public async Task FormatAsync( { Uri = context.Uri, }, - HostDocumentVersion = documentVersion.Value, + HostDocumentVersion = documentVersion, Options = context.Options }; @@ -63,10 +56,7 @@ public async Task FormatOnTypeAsync( FormattingContext context, CancellationToken cancellationToken) { - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) - { - return Array.Empty(); - } + var documentVersion = context.OriginalSnapshot.Version; var @params = new RazorDocumentOnTypeFormattingParams() { @@ -74,7 +64,7 @@ public async Task FormatOnTypeAsync( Character = context.TriggerCharacter.ToString(), TextDocument = new TextDocumentIdentifier { Uri = context.Uri }, Options = context.Options, - HostDocumentVersion = documentVersion.Value, + HostDocumentVersion = documentVersion, }; var result = await _clientConnection.SendRequestAsync( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs index f522ea5790c..3e9f87b7ea7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs @@ -19,11 +19,10 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal sealed class HtmlFormattingPass( IDocumentMappingService documentMappingService, IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, ILoggerFactory loggerFactory) : FormattingPassBase(documentMappingService) { - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); + private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); // We want this to run first because it uses the client HTML formatter. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs index 2fe06d466d3..b3a01451ce5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs @@ -9,20 +9,14 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal class GeneratedDocumentSynchronizer( IGeneratedDocumentPublisher publisher, - IDocumentVersionCache documentVersionCache, LanguageServerFeatureOptions languageServerFeatureOptions) : IDocumentProcessedListener { private readonly IGeneratedDocumentPublisher _publisher = publisher; - private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; public void DocumentProcessed(RazorCodeDocument codeDocument, IDocumentSnapshot document) { - if (!_documentVersionCache.TryGetDocumentVersion(document, out var hostDocumentVersion)) - { - // Could not resolve document version - return; - } + var hostDocumentVersion = document.Version; var filePath = document.FilePath.AssumeNotNull(); @@ -31,11 +25,11 @@ public void DocumentProcessed(RazorCodeDocument codeDocument, IDocumentSnapshot { var htmlText = codeDocument.GetHtmlSourceText(); - _publisher.PublishHtml(document.Project.Key, filePath, htmlText, hostDocumentVersion.Value); + _publisher.PublishHtml(document.Project.Key, filePath, htmlText, hostDocumentVersion); } var csharpText = codeDocument.GetCSharpSourceText(); - _publisher.PublishCSharp(document.Project.Key, filePath, csharpText, hostDocumentVersion.Value); + _publisher.PublishCSharp(document.Project.Key, filePath, csharpText, hostDocumentVersion); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs deleted file mode 100644 index 932d55ea68a..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/IDocumentVersionCache.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -internal interface IDocumentVersionCache -{ - bool TryGetDocumentVersion(IDocumentSnapshot documentSnapshot, [NotNullWhen(true)] out int? version); - void TrackDocumentVersion(IDocumentSnapshot documentSnapshot, int version); - - // HACK: This is temporary to allow the cohosting and normal language server to co-exist and share code - int GetLatestDocumentVersion(string filePath); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index 74ebb392272..696129efb99 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -36,7 +36,6 @@ internal partial class RazorProjectService : IRazorProjectService, IRazorProject private readonly IRazorProjectInfoDriver _projectInfoDriver; private readonly IProjectSnapshotManager _projectManager; private readonly RemoteTextLoaderFactory _remoteTextLoaderFactory; - private readonly IDocumentVersionCache _documentVersionCache; private readonly ILogger _logger; private readonly CancellationTokenSource _disposeTokenSource; @@ -45,14 +44,12 @@ internal partial class RazorProjectService : IRazorProjectService, IRazorProject public RazorProjectService( IProjectSnapshotManager projectManager, IRazorProjectInfoDriver projectInfoDriver, - IDocumentVersionCache documentVersionCache, RemoteTextLoaderFactory remoteTextLoaderFactory, ILoggerFactory loggerFactory) { _projectInfoDriver = projectInfoDriver; _projectManager = projectManager; _remoteTextLoaderFactory = remoteTextLoaderFactory; - _documentVersionCache = documentVersionCache; _logger = loggerFactory.GetOrCreateLogger(); // We kick off initialization immediately to ensure that the IRazorProjectService @@ -208,14 +205,6 @@ await _projectManager.UpdateAsync( _logger.LogInformation($"Opening document '{textDocumentPath}' in project '{projectSnapshot.Key}'."); updater.DocumentOpened(projectSnapshot.Key, textDocumentPath, sourceText); }); - - // Use a separate loop, as the above call modified out projects, so we have to make sure we're operating on the latest snapshot - ActOnDocumentInMultipleProjects( - filePath, - (projectSnapshot, textDocumentPath) => - { - TrackDocumentVersion(projectSnapshot, textDocumentPath, version, startGenerating: true); - }); }, cancellationToken) .ConfigureAwait(false); @@ -304,14 +293,6 @@ await _projectManager.UpdateAsync( updater.DocumentChanged(project.Key, textDocumentPath, sourceText); }); - - // Use a separate loop, as the above call modified out projects, so we have to make sure we're operating on the latest snapshot - ActOnDocumentInMultipleProjects( - filePath, - (projectSnapshot, textDocumentPath) => - { - TrackDocumentVersion(projectSnapshot, textDocumentPath, version, startGenerating: false); - }); }, cancellationToken) .ConfigureAwait(false); @@ -672,20 +653,4 @@ private void TryMigrateMiscellaneousDocumentsToProject(ProjectSnapshotManager.Up updater.DocumentAdded(projectSnapshot.Key, newHostDocument, textLoader); } } - - private void TrackDocumentVersion(IProjectSnapshot projectSnapshot, string textDocumentPath, int version, bool startGenerating) - { - if (projectSnapshot.GetDocument(FilePathNormalizer.Normalize(textDocumentPath)) is not { } documentSnapshot) - { - return; - } - - _documentVersionCache.TrackDocumentVersion(documentSnapshot, version); - - if (startGenerating) - { - // Start generating the C# for the document so it can immediately be ready for incoming requests. - documentSnapshot.GetGeneratedOutputAsync().Forget(); - } - } } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs index 1ae779026f7..c16944aa492 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs @@ -136,6 +136,7 @@ private async Task> TrySynchronizeV int requiredHostDocumentVersion, TextDocumentIdentifier hostDocument, CancellationToken cancellationToken, + Range? _ = null, bool rejectOnNewerParallelRequest = true, [CallerMemberName] string? caller = null) where TVirtualDocumentSnapshot : VirtualDocumentSnapshot @@ -200,6 +201,21 @@ private async Task> TrySynchronizeV _logger.LogDebug($"{(result.Synchronized ? "Did" : "Did NOT")} synchronize for {caller}: Version {requiredHostDocumentVersion} for {result.VirtualSnapshot?.Uri}"); } + //if (requiredHostDocumentVersion == 1 && + // result.Synchronized && + // result.VirtualSnapshot is not null && + // range is not null) + //{ + // // If we're at version 1, and we're synced, lets make sure the buffer has enough lines to handle the request + // if (range.Start.Line > result.VirtualSnapshot.Snapshot.LineCount || + // range.End.Line > result.VirtualSnapshot.Snapshot.LineCount) + // { + // Debug.Fail("It worked!"); + // _logger.LogWarning($"Requested line ({range.Start.Line} or {range.End.Line}) is out of bounds for {result.VirtualSnapshot.Uri}. Sync failed."); + // return new SynchronizedResult(false, null); + // } + //} + return result; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs index 1d895280ad4..90656ea4453 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs @@ -3,6 +3,7 @@ using System; using System.Diagnostics; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; @@ -70,7 +71,8 @@ internal partial class RazorCustomMessageTarget var (synchronized, csharpDoc) = await TrySynchronizeVirtualDocumentAsync( (int)semanticTokensParams.RequiredHostDocumentVersion, semanticTokensParams.TextDocument, - cancellationToken); + cancellationToken, + semanticTokensParams.Ranges.FirstOrDefault()); if (csharpDoc is null) { @@ -92,6 +94,8 @@ internal partial class RazorCustomMessageTarget if (csharpDoc.Snapshot.LineCount < lastGeneratedDocumentLine) { + _logger.LogWarning($"Pretending we're not synced because we're asking for line {lastGeneratedDocumentLine} but there are only {csharpDoc.Snapshot.LineCount} lines in the buffer."); + Debug.Fail("Rejecting!"); // We report this as a fail to synchronize, as that's essentially what it is: We were asked for v1, with X lines // and whilst we have v1, we don't have X lines, so we need to wait for a future update to arrive and give us // more content. diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs index 9ebc750ea31..e2b6355c927 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs @@ -78,7 +78,7 @@ request.ProjectKeyId is not null && { if (virtualDocument.ProjectKey.Equals(new ProjectKey(request.ProjectKeyId))) { - _logger.LogDebug($"UpdateCSharpBuffer virtual doc for {request.HostDocumentVersion} of {virtualDocument.Uri}"); + _logger.LogDebug($"UpdateCSharpBuffer virtual doc for {request.HostDocumentVersion} of {virtualDocument.Uri}. Previous lines: {virtualDocument.Snapshot.LineCount}"); _documentManager.UpdateVirtualDocument( hostDocumentUri, @@ -86,6 +86,17 @@ request.ProjectKeyId is not null && request.Changes.Select(change => change.ToVisualStudioTextChange()).ToArray(), request.HostDocumentVersion.Value, state: request.PreviousWasEmpty); + + if (_documentManager.TryGetDocument(hostDocumentUri, out var newDocSnapshot)) + { + var newDoc = newDocSnapshot.VirtualDocuments.Where(e => e.Uri == virtualDocument.Uri).FirstOrDefault(); + + if (newDoc is not null) + { + _logger.LogDebug($"UpdateCSharpBuffer finished updating doc for {request.HostDocumentVersion} of {virtualDocument.Uri}. New lines: {newDoc.Snapshot.LineCount}"); + } + } + return; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs index 33b35e3df98..3afd4bc01c2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs @@ -1131,7 +1131,7 @@ private async Task ValidateCodeActionAsync( Assert.NotNull(codeActionToRun); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentContext.Snapshot, optionsMonitor?.CurrentValue); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, optionsMonitor?.CurrentValue); var changes = await GetEditsAsync( codeActionToRun, requestContext, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs index 31394f347d2..295533b052e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs @@ -21,13 +21,11 @@ public class DocumentContextFactoryTest : LanguageServerTestBase private static readonly string s_baseDirectory = PathUtilities.CreateRootedPath("path", "to"); private readonly TestProjectSnapshotManager _projectManager; - private readonly IDocumentVersionCache _documentVersionCache; public DocumentContextFactoryTest(ITestOutputHelper testOutput) : base(testOutput) { _projectManager = CreateProjectSnapshotManager(); - _documentVersionCache = new DocumentVersionCache(_projectManager); } [Fact] @@ -37,7 +35,7 @@ public void TryCreateAsync_CanNotResolveDocument_ReturnsNull() var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.False(factory.TryCreate(uri, out _)); @@ -50,7 +48,7 @@ public void TryCreateForOpenDocumentAsync_CanNotResolveDocument_ReturnsNull() var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.False(factory.TryCreateForOpenDocument(uri, out _)); @@ -70,7 +68,7 @@ await _projectManager.UpdateAsync(updater => updater.DocumentAdded(MiscFilesHostProject.Instance.Key, hostDocument, TestMocks.CreateTextLoader(filePath, "")); }); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.False(factory.TryCreateForOpenDocument(uri, out _)); @@ -94,7 +92,7 @@ await _projectManager.UpdateAsync(updater => var documentSnapshot = miscFilesProject.GetDocument(filePath); Assert.NotNull(documentSnapshot); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.True(factory.TryCreate(uri, out var documentContext)); @@ -113,7 +111,7 @@ public async Task TryCreateAsync_WithProjectContext_Resolves() var projectFilePath = Path.Combine(s_baseDirectory, "project.csproj"); var uri = new Uri(filePath); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); var hostProject = new HostProject(projectFilePath, intermediateOutputPath, RazorConfiguration.Default, rootNamespace: null); var hostDocument = new HostDocument(filePath, "file.cshtml"); @@ -149,8 +147,7 @@ await _projectManager.UpdateAsync(updater => var documentSnapshot = miscFilesProject.GetDocument(filePath); Assert.NotNull(documentSnapshot); - _documentVersionCache.TrackDocumentVersion(documentSnapshot, version: 1337); - var factory = new DocumentContextFactory(_projectManager, _documentVersionCache, LoggerFactory); + var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act Assert.True(factory.TryCreateForOpenDocument(uri, out var documentContext)); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs index 318436e546a..100667df822 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs @@ -47,11 +47,9 @@ public async Task Handle_SimpleComponent_ReturnsResult() var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -105,11 +103,9 @@ public async Task Handle_SimpleComponentWithChildFile_ReturnsResult() var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -174,11 +170,9 @@ public async Task Handle_ComponentWithRequiredAttribute_ReturnsResult() var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -382,11 +376,9 @@ public async Task Handle_ComponentWithNestedFiles_ReturnsResult() var razorFilePath = "c:/path/index.razor"; var uri = new Uri(razorFilePath); - var documentVersionCache = new DocumentVersionCache(projectManager); await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); - documentVersionCache.TrackDocumentVersion(documentSnapshot, 1); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs deleted file mode 100644 index acad8a273e2..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentVersionCacheTest.cs +++ /dev/null @@ -1,322 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -#if NETFRAMEWORK -using System; -using System.Collections.Generic; -#endif -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; -using Microsoft.CodeAnalysis; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Razor.LanguageServer; - -public class DocumentVersionCacheTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) -{ - [Fact] - public void MarkAsLatestVersion_UntrackedDocument_Noops() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(document, 123); - var untrackedDocument = TestDocumentSnapshot.Create("C:/other.cshtml"); - - // Act - cacheAccessor.MarkAsLatestVersion(untrackedDocument); - - // Assert - Assert.False(cache.TryGetDocumentVersion(untrackedDocument, out var version)); - Assert.Null(version); - } - - [Fact] - public void MarkAsLatestVersion_KnownDocument_TracksNewDocumentAsLatest() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var documentInitial = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(documentInitial, 123); - var documentLatest = TestDocumentSnapshot.Create(documentInitial.FilePath); - - // Act - cacheAccessor.MarkAsLatestVersion(documentLatest); - - // Assert - Assert.True(cache.TryGetDocumentVersion(documentLatest, out var version)); - Assert.Equal(123, version); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_DocumentRemoved_DoesNotEvictDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, TextLoader.From(textAndVersion)); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentRemoved(document.ProjectInternal.Key, document.State.HostDocument)); - result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 2 - Assert.True(result); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_OpenDocumentRemoved_DoesNotEvictDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, TextLoader.From(textAndVersion)); - updater.DocumentOpened(document.ProjectInternal.Key, document.FilePath, textAndVersion.Text); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - Assert.True(projectManager.IsDocumentOpen(document.FilePath)); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentRemoved(document.ProjectInternal.Key, document.State.HostDocument)); - result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 2 - Assert.True(result); - } - - [Fact] - public async Task ProjectSnapshotManager_Changed_DocumentClosed_EvictsDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - Assert.True(document.TryGetText(out var text)); - Assert.True(document.TryGetTextVersion(out var textVersion)); - var textAndVersion = TextAndVersion.Create(text, textVersion); - cache.TrackDocumentVersion(document, 1337); - var textLoader = TextLoader.From(textAndVersion); - - await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(document.ProjectInternal.HostProject); - updater.DocumentAdded(document.ProjectInternal.Key, document.State.HostDocument, textLoader); - }); - - // Act - 1 - var result = cache.TryGetDocumentVersion(document, out _); - - // Assert - 1 - Assert.True(result); - - // Act - 2 - await projectManager.UpdateAsync(updater => - updater.DocumentClosed(document.ProjectInternal.HostProject.Key, document.State.HostDocument.FilePath, textLoader)); - result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - 2 - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TrackDocumentVersion_AddsFirstEntry() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - // Act - cache.TrackDocumentVersion(document, 1337); - - // Assert - var entries = cacheAccessor.GetEntries(); - var (filePath, entry) = Assert.Single(entries); - Assert.Equal(document.FilePath, filePath); - var (actualDocument, actualVersion) = Assert.Single(entry); - Assert.Same(document, actualDocument); - Assert.Equal(1337, actualVersion); - } - - [Fact] - public void TrackDocumentVersion_EvictsOldEntries() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - for (var i = 0; i < DocumentVersionCache.MaxDocumentTrackingCount; i++) - { - cache.TrackDocumentVersion(document, i); - } - - // Act - cache.TrackDocumentVersion(document, 1337); - - // Assert - var (_, entry) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(DocumentVersionCache.MaxDocumentTrackingCount, entry.Length); - Assert.Equal(1337, entry[^1].Version); - } - - [Fact] - public void TryGetDocumentVersion_UntrackedDocumentPath_ReturnsFalse() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - - // Act - var result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TryGetDocumentVersion_EvictedDocument_ReturnsFalse() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - var evictedDocument = TestDocumentSnapshot.Create(document.FilePath); - cache.TrackDocumentVersion(document, 1337); - - // Act - var result = cache.TryGetDocumentVersion(evictedDocument, out var version); - - // Assert - Assert.False(result); - Assert.Null(version); - } - - [Fact] - public void TryGetDocumentVersion_KnownDocument_ReturnsTrue() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var document = TestDocumentSnapshot.Create("C:/file.cshtml"); - cache.TrackDocumentVersion(document, 1337); - - // Act - var result = cache.TryGetDocumentVersion(document, out var version); - - // Assert - Assert.True(result); - Assert.Equal(1337, version); - } - - [Fact] - public async Task ProjectSnapshotManager_KnownDocumentAdded_TracksNewDocument() - { - // Arrange - var projectManager = CreateProjectSnapshotManager(); - var cache = new DocumentVersionCache(projectManager); - var cacheAccessor = cache.GetTestAccessor(); - - var project1 = TestProjectSnapshot.Create( - "C:/path/to/project1.csproj", - intermediateOutputPath: "C:/path/to/obj1", - documentFilePaths: [], - RazorConfiguration.Default, - projectWorkspaceState: null); - - var document1 = await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(project1.HostProject); - return updater.CreateAndAddDocument(project1, @"C:\path\to\file.razor"); - }); - - // Act - cache.TrackDocumentVersion(document1, 1337); - - // Assert - var (filePath, entries) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(document1.FilePath, filePath); - var (actualDocument, actualVersion) = Assert.Single(entries); - Assert.Same(document1, actualDocument); - Assert.Equal(1337, actualVersion); - - // Act II - var project2 = TestProjectSnapshot.Create( - "C:/path/to/project2.csproj", - intermediateOutputPath: "C:/path/to/obj2", - documentFilePaths: [], - RazorConfiguration.Default, - projectWorkspaceState: null); - - var document2 = await projectManager.UpdateAsync(updater => - { - updater.ProjectAdded(project2.HostProject); - updater.CreateAndAddDocument(project2, @"C:\path\to\file.razor"); - - return updater - .GetLoadedProject(project2.Key) - .GetDocument(document1.FilePath); - }); - - // Assert II - (filePath, entries) = Assert.Single(cacheAccessor.GetEntries()); - Assert.Equal(document1.FilePath, filePath); - Assert.Equal(2, entries.Length); - - // Should still be tracking document 1 with no changes - (actualDocument, actualVersion) = entries[0]; - Assert.Same(document1, actualDocument); - Assert.Equal(1337, actualVersion); - - (actualDocument, actualVersion) = entries[1]; - Assert.Same(document2, actualDocument); - Assert.Equal(1337, actualVersion); - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 112e7ae0016..b785c9fadc0 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -76,7 +76,7 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab InsertSpaces = insertSpaces, }; - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act @@ -120,8 +120,7 @@ private protected async Task RunOnTypeFormattingTestAsync( filePathService, new TestDocumentContextFactory(), LoggerFactory); var languageKind = mappingService.GetLanguageKind(codeDocument, positionAfterTrigger, rightAssociative: false); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync( - LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var options = new FormattingOptions() { TabSize = tabSize, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 12c22645152..4aeed2f02c1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -21,7 +21,6 @@ internal static class TestRazorFormattingService public static async Task CreateWithFullSupportAsync( ILoggerFactory loggerFactory, RazorCodeDocument? codeDocument = null, - IDocumentSnapshot? documentSnapshot = null, RazorLSPOptions? razorLSPOptions = null) { codeDocument ??= TestRazorCodeDocument.CreateEmpty(); @@ -30,11 +29,6 @@ public static async Task CreateWithFullSupportAsync( var mappingService = new LspDocumentMappingService(filePathService, new TestDocumentContextFactory(), loggerFactory); var projectManager = StrictMock.Of(); - var versionCache = new DocumentVersionCache(projectManager); - if (documentSnapshot is not null) - { - versionCache.TrackDocumentVersion(documentSnapshot, version: 1); - } var client = new FormattingLanguageServerClient(loggerFactory); client.AddCodeDocument(codeDocument); @@ -54,7 +48,7 @@ public static async Task CreateWithFullSupportAsync( var passes = new List() { - new HtmlFormattingPass(mappingService, client, versionCache, loggerFactory), + new HtmlFormattingPass(mappingService, client, loggerFactory), new CSharpFormattingPass(mappingService, loggerFactory), new CSharpOnTypeFormattingPass(mappingService, loggerFactory), new RazorFormattingPass(mappingService, optionsMonitor), diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs index cd462b579ec..5ae7ee253ca 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs @@ -3,7 +3,6 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.ProjectSystem; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; @@ -16,7 +15,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; public class GeneratedDocumentSynchronizerTest : LanguageServerTestBase { - private readonly DocumentVersionCache _cache; private readonly GeneratedDocumentSynchronizer _synchronizer; private readonly TestGeneratedDocumentPublisher _publisher; private readonly IDocumentSnapshot _document; @@ -25,10 +23,8 @@ public class GeneratedDocumentSynchronizerTest : LanguageServerTestBase public GeneratedDocumentSynchronizerTest(ITestOutputHelper testOutput) : base(testOutput) { - var projectManager = StrictMock.Of(); - _cache = new DocumentVersionCache(projectManager); _publisher = new TestGeneratedDocumentPublisher(); - _synchronizer = new GeneratedDocumentSynchronizer(_publisher, _cache, TestLanguageServerFeatureOptions.Instance); + _synchronizer = new GeneratedDocumentSynchronizer(_publisher, TestLanguageServerFeatureOptions.Instance); _document = TestDocumentSnapshot.Create("C:/path/to/file.razor"); _codeDocument = CreateCodeDocument("

Hello World

"); } @@ -49,9 +45,6 @@ public void DocumentProcessed_UnknownVersion_Noops() [Fact] public void DocumentProcessed_KnownVersion_Publishes() { - // Arrange - _cache.TrackDocumentVersion(_document, version: 1337); - // Act _synchronizer.DocumentProcessed(_codeDocument, _document); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs index 453c64f7064..3fd1cbf2fb6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs @@ -48,8 +48,6 @@ protected override async Task InitializeAsync() { _projectManager = CreateProjectSnapshotManager(); - var documentVersionCache = new DocumentVersionCache(_projectManager); - var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock .Setup(x => x.Create(It.IsAny())) @@ -65,7 +63,6 @@ protected override async Task InitializeAsync() var projectService = new TestRazorProjectService( remoteTextLoaderFactoryMock.Object, - documentVersionCache, _projectManager, LoggerFactory); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs index 0802a4cf61d..25555ab946a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs @@ -32,7 +32,6 @@ public class RazorProjectServiceTest(ITestOutputHelper testOutput) : LanguageSer // Each of these is initialized by InitializeAsync() below. #nullable disable private TestProjectSnapshotManager _projectManager; - private DocumentVersionCache _documentVersionCache; private TestRazorProjectService _projectService; #nullable enable @@ -41,7 +40,6 @@ protected override Task InitializeAsync() var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); var projectEngineFactoryProvider = new LspProjectEngineFactoryProvider(optionsMonitor); _projectManager = CreateProjectSnapshotManager(projectEngineFactoryProvider); - _documentVersionCache = new DocumentVersionCache(_projectManager); var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock @@ -50,7 +48,6 @@ protected override Task InitializeAsync() _projectService = new TestRazorProjectService( remoteTextLoaderFactoryMock.Object, - _documentVersionCache, _projectManager, LoggerFactory); @@ -850,14 +847,8 @@ public async Task RemoveDocument_RemovesDocumentFromMiscellaneousProject() public async Task RemoveDocument_NoopsIfOwnerProjectDoesNotContainDocument() { // Arrange - const string ProjectFilePath = "C:/path/to/project.csproj"; - const string IntermediateOutputPath = "C:/path/to/obj"; - const string RootNamespace = "TestRootNamespace"; const string DocumentFilePath = "C:/path/to/document.cshtml"; - var ownerProjectKey = await _projectService.AddProjectAsync( - ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); - using var listener = _projectManager.ListenToNotifications(); // Act @@ -998,7 +989,7 @@ public async Task UpdateDocument_TracksKnownDocumentVersion() listener.AssertNotifications( x => x.DocumentChanged(DocumentFilePath, ownerProject.Key)); - var latestVersion = _documentVersionCache.GetLatestDocumentVersion(DocumentFilePath); + var latestVersion = _projectManager.GetLoadedProject(ownerProjectKey).GetDocument(DocumentFilePath)!.Version;// _documentVersionCache.GetLatestDocumentVersion(DocumentFilePath); Assert.Equal(43, latestVersion); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs index 3aa916de91a..8792aeca17a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs @@ -625,8 +625,7 @@ public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() var projectManager = CreateProjectSnapshotManager(); - var documentVersionCache = new DocumentVersionCache(projectManager); - var documentContextFactory = new DocumentContextFactory(projectManager, documentVersionCache, LoggerFactory); + var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); var remoteTextLoaderFactoryMock = new StrictMock(); remoteTextLoaderFactoryMock @@ -643,7 +642,6 @@ public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() var projectService = new TestRazorProjectService( remoteTextLoaderFactoryMock.Object, - documentVersionCache, projectManager, LoggerFactory); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs index f0acf1af497..e4f29f50c72 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/TestRazorProjectService.cs @@ -19,13 +19,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; internal class TestRazorProjectService( RemoteTextLoaderFactory remoteTextLoaderFactory, - IDocumentVersionCache documentVersionCache, IProjectSnapshotManager projectManager, ILoggerFactory loggerFactory) : RazorProjectService( projectManager, CreateProjectInfoDriver(), - documentVersionCache, remoteTextLoaderFactory, loggerFactory) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs index 707786555aa..a419a5bff05 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs @@ -41,6 +41,7 @@ public static TestDocumentSnapshot Create(string filePath, string text, VersionS hostDocument, SourceText.From(text), version, + 1, () => Task.FromResult(TextAndVersion.Create(sourceText, version))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); @@ -64,6 +65,7 @@ internal static TestDocumentSnapshot Create(ProjectSnapshot projectSnapshot, str hostDocument, SourceText.From(text), version, + 1, () => Task.FromResult(TextAndVersion.Create(sourceText, version.Value))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs index 77fd4a8f7b2..3cc38fe40d3 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs @@ -1026,7 +1026,7 @@ private TestDocumentState( Action? onConfigurationChange, Action? onImportsChange, Action? onProjectWorkspaceStateChange) - : base(hostDocument, text, version, loader) + : base(hostDocument, text, version, 1, loader) { _onTextChange = onTextChange; _onTextLoaderChange = onTextLoaderChange; From 032f7ca74d3d3938665adc69327812682f6bfccc Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 24 Jun 2024 17:20:11 +1000 Subject: [PATCH 084/271] Semantic tokens tweaks fixup semantic tokens tweask --- .../ProvideSemanticTokensRangesParams.cs | 4 +- .../AbstractRazorSemanticTokensInfoService.cs | 2 + .../Endpoints/RazorCustomMessageTarget.cs | 2 +- ...RazorCustomMessageTarget_SemanticTokens.cs | 51 +++++-------------- .../RazorCSharpInterceptionMiddleLayer.cs | 11 ++-- 5 files changed, 22 insertions(+), 48 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/SemanticTokens/ProvideSemanticTokensRangesParams.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/SemanticTokens/ProvideSemanticTokensRangesParams.cs index 73e62bf91db..b1f7082ecbe 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/SemanticTokens/ProvideSemanticTokensRangesParams.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/SemanticTokens/ProvideSemanticTokensRangesParams.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; internal class ProvideSemanticTokensRangesParams : SemanticTokensParams { [JsonPropertyName("requiredHostDocumentVersion")] - public long RequiredHostDocumentVersion { get; } + public int RequiredHostDocumentVersion { get; } [JsonPropertyName("ranges")] public Range[] Ranges { get; } @@ -19,7 +19,7 @@ internal class ProvideSemanticTokensRangesParams : SemanticTokensParams [JsonPropertyName("correlationId")] public Guid CorrelationId { get; } - public ProvideSemanticTokensRangesParams(TextDocumentIdentifier textDocument, long requiredHostDocumentVersion, Range[] ranges, Guid correlationId) + public ProvideSemanticTokensRangesParams(TextDocumentIdentifier textDocument, int requiredHostDocumentVersion, Range[] ranges, Guid correlationId) { TextDocument = textDocument; RequiredHostDocumentVersion = requiredHostDocumentVersion; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs index 712506f4e53..0acf4494658 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs @@ -170,6 +170,8 @@ private static ImmutableArray CombineSemanticRanges(ImmutableArra csharpRanges = [csharpRange]; } + _logger.LogDebug($"Requesting C# semantic tokens for host version {documentContext.Version}, correlation ID {correlationId}, and the server thinks there are {codeDocument.GetCSharpSourceText().Lines.Count} lines of C#"); + var csharpResponse = await _csharpSemanticTokensProvider.GetCSharpSemanticTokensResponseAsync(documentContext, csharpRanges, correlationId, cancellationToken).ConfigureAwait(false); // Indicates an issue with retrieving the C# response (e.g. no response or C# is out of sync with us). diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs index c16944aa492..1c52c7fd813 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs @@ -136,7 +136,7 @@ private async Task> TrySynchronizeV int requiredHostDocumentVersion, TextDocumentIdentifier hostDocument, CancellationToken cancellationToken, - Range? _ = null, + LanguageServer.Protocol.Range? _ = null, bool rejectOnNewerParallelRequest = true, [CallerMemberName] string? caller = null) where TVirtualDocumentSnapshot : VirtualDocumentSnapshot diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs index 90656ea4453..15b5ae81682 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs @@ -6,7 +6,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces.Protocol.SemanticTokens; @@ -58,18 +57,10 @@ internal partial class RazorCustomMessageTarget SemanticTokensParams requestParams, CancellationToken cancellationToken) { - if (semanticTokensParams is null) - { - throw new ArgumentNullException(nameof(semanticTokensParams)); - } - - if (semanticTokensParams.Ranges is null) - { - throw new ArgumentNullException(nameof(semanticTokensParams.Ranges)); - } + _logger.LogDebug($"Semantic tokens request for {semanticTokensParams.Ranges.Max(r => r.End.Line)} max line number, host version {semanticTokensParams.RequiredHostDocumentVersion}, correlation ID {semanticTokensParams.CorrelationId}"); var (synchronized, csharpDoc) = await TrySynchronizeVirtualDocumentAsync( - (int)semanticTokensParams.RequiredHostDocumentVersion, + semanticTokensParams.RequiredHostDocumentVersion, semanticTokensParams.TextDocument, cancellationToken, semanticTokensParams.Ranges.FirstOrDefault()); @@ -79,30 +70,6 @@ internal partial class RazorCustomMessageTarget return null; } - if (synchronized && csharpDoc.HostDocumentSyncVersion == 1) - { - // HACK: Workaround for https://github.com/dotnet/razor/issues/9197 to stop Roslyn NFWs - // Sometimes we get asked for semantic tokens on v1, and we have sent a v1 to Roslyn, but its the wrong v1. - // To prevent Roslyn throwing, let's validate the range we're asking about with the generated document they - // would have seen. - var lastGeneratedDocumentLine = requestParams switch - { - SemanticTokensRangeParams range => range.Range.End.Line, - SemanticTokensRangesParams ranges => ranges.Ranges[^1].End.Line, - _ => Assumed.Unreachable() - }; - - if (csharpDoc.Snapshot.LineCount < lastGeneratedDocumentLine) - { - _logger.LogWarning($"Pretending we're not synced because we're asking for line {lastGeneratedDocumentLine} but there are only {csharpDoc.Snapshot.LineCount} lines in the buffer."); - Debug.Fail("Rejecting!"); - // We report this as a fail to synchronize, as that's essentially what it is: We were asked for v1, with X lines - // and whilst we have v1, we don't have X lines, so we need to wait for a future update to arrive and give us - // more content. - return new ProvideSemanticTokensResponse(tokens: null, -1); - } - } - if (!synchronized) { // If we're unable to synchronize we won't produce useful results, but we have to indicate @@ -110,15 +77,19 @@ internal partial class RazorCustomMessageTarget return new ProvideSemanticTokensResponse(tokens: null, hostDocumentSyncVersion: csharpDoc.HostDocumentSyncVersion ?? -1); } - semanticTokensParams.TextDocument.Uri = csharpDoc.Uri; + requestParams.TextDocument.Uri = csharpDoc.Uri; var textBuffer = csharpDoc.Snapshot.TextBuffer; + _logger.LogDebug($"Requesting semantic tokens for {csharpDoc.Uri}, for buffer version {textBuffer.CurrentSnapshot.Version.VersionNumber} and snapshot version {csharpDoc.Snapshot.Version.VersionNumber}, host version {semanticTokensParams.RequiredHostDocumentVersion}, correlation ID {semanticTokensParams.CorrelationId}"); + cancellationToken.ThrowIfCancellationRequested(); var languageServerName = RazorLSPConstants.RazorCSharpLanguageServerName; SemanticTokens? response; using (var disposable = _telemetryReporter.TrackLspRequest(lspMethodName, languageServerName, semanticTokensParams.CorrelationId)) { + try + { var result = await _requestInvoker.ReinvokeRequestOnServerAsync( textBuffer, lspMethodName, @@ -126,7 +97,13 @@ internal partial class RazorCustomMessageTarget requestParams, cancellationToken).ConfigureAwait(false); - response = result?.Response; + response = result?.Response; + } + catch + { + _logger.LogWarning($"Error getting semantic tokens from Roslyn for host version {semanticTokensParams.RequiredHostDocumentVersion}, correlation ID {semanticTokensParams.CorrelationId}"); + throw; + } } if (response?.Data is null) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorCSharpInterceptionMiddleLayer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorCSharpInterceptionMiddleLayer.cs index b2f6692ba35..7a7415f1455 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorCSharpInterceptionMiddleLayer.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/RazorCSharpInterceptionMiddleLayer.cs @@ -16,15 +16,10 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient; [Export(typeof(IRazorCSharpInterceptionMiddleLayer))] -internal class RazorCSharpInterceptionMiddleLayer : IRazorCSharpInterceptionMiddleLayer +[method: ImportingConstructor] +internal class RazorCSharpInterceptionMiddleLayer(LSPRequestInvoker requestInvoker) : IRazorCSharpInterceptionMiddleLayer { - private readonly LSPRequestInvoker _requestInvoker; - - [ImportingConstructor] - public RazorCSharpInterceptionMiddleLayer(LSPRequestInvoker requestInvoker) - { - _requestInvoker = requestInvoker; - } + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; public bool CanHandle(string methodName) => methodName.Equals(Methods.WorkspaceSemanticTokensRefreshName); From 97be219f90651dfd5ce56ca92e3f01e65c704e38 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 24 Jun 2024 17:34:53 +1000 Subject: [PATCH 085/271] Fix tests --- .../DocumentContextFactoryTest.cs | 22 +------------------ .../Formatting_NetFx/FormattingTestBase.cs | 3 +++ .../GeneratedDocumentSynchronizerTest.cs | 13 ----------- .../RazorProjectServiceTest.cs | 6 ++--- 4 files changed, 7 insertions(+), 37 deletions(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs index 295533b052e..61e48cb7880 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs @@ -54,26 +54,6 @@ public void TryCreateForOpenDocumentAsync_CanNotResolveDocument_ReturnsNull() Assert.False(factory.TryCreateForOpenDocument(uri, out _)); } - [Fact] - public async Task TryCreateForOpenDocumentAsync_CanNotResolveVersion_ReturnsNull() - { - // Arrange - var filePath = FilePathNormalizer.Normalize(Path.Combine(s_baseDirectory, "file.cshtml")); - var uri = new Uri(filePath); - - var hostDocument = new HostDocument(filePath, "file.cshtml"); - - await _projectManager.UpdateAsync(updater => - { - updater.DocumentAdded(MiscFilesHostProject.Instance.Key, hostDocument, TestMocks.CreateTextLoader(filePath, "")); - }); - - var factory = new DocumentContextFactory(_projectManager, LoggerFactory); - - // Act - Assert.False(factory.TryCreateForOpenDocument(uri, out _)); - } - [Fact] public async Task TryCreateAsync_ResolvesContent() { @@ -153,7 +133,7 @@ await _projectManager.UpdateAsync(updater => Assert.True(factory.TryCreateForOpenDocument(uri, out var documentContext)); // Assert - Assert.Equal(1337, documentContext.Version); + Assert.Equal(1, documentContext.Version); Assert.Equal(uri, documentContext.Uri); Assert.Same(documentSnapshot, documentContext.Snapshot); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index b785c9fadc0..a6089dfe1d8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -312,6 +312,9 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA documentSnapshot .Setup(d => d.FileKind) .Returns(fileKind); + documentSnapshot + .Setup(d => d.Version) + .Returns(1); documentSnapshot .Setup(d => d.WithText(It.IsAny())) .Returns(text => diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs index 5ae7ee253ca..7805abd04b1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs @@ -29,19 +29,6 @@ public GeneratedDocumentSynchronizerTest(ITestOutputHelper testOutput) _codeDocument = CreateCodeDocument("

Hello World

"); } - [Fact] - public void DocumentProcessed_UnknownVersion_Noops() - { - // Arrange - - // Act - _synchronizer.DocumentProcessed(_codeDocument, _document); - - // Assert - Assert.False(_publisher.PublishedCSharp); - Assert.False(_publisher.PublishedHtml); - } - [Fact] public void DocumentProcessed_KnownVersion_Publishes() { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs index 25555ab946a..08ca59d78db 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs @@ -966,7 +966,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() } [Fact] - public async Task UpdateDocument_TracksKnownDocumentVersion() + public async Task UpdateDocument_DocumentVersionUpdated() { // Arrange const string ProjectFilePath = "C:/path/to/project.csproj"; @@ -989,8 +989,8 @@ public async Task UpdateDocument_TracksKnownDocumentVersion() listener.AssertNotifications( x => x.DocumentChanged(DocumentFilePath, ownerProject.Key)); - var latestVersion = _projectManager.GetLoadedProject(ownerProjectKey).GetDocument(DocumentFilePath)!.Version;// _documentVersionCache.GetLatestDocumentVersion(DocumentFilePath); - Assert.Equal(43, latestVersion); + var latestVersion = _projectManager.GetLoadedProject(ownerProjectKey).GetDocument(DocumentFilePath)!.Version; + Assert.Equal(2, latestVersion); } [Fact] From 162c7d55ba4075b4f894d53d3bb8316e5a02c0d2 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 9 Aug 2024 15:00:59 +1000 Subject: [PATCH 086/271] Remove unused parameter --- .../DocumentDidChangeEndpoint.cs | 2 +- .../DocumentDidOpenEndpoint.cs | 2 +- .../ProjectSystem/IRazorProjectService.cs | 4 +-- .../ProjectSystem/RazorProjectService.cs | 4 +-- .../DocumentDidChangeEndpointTest.cs | 7 ++-- .../DocumentDidOpenEndpointTest.cs | 5 ++- .../RazorComponentSearchEngineTest.cs | 6 ++-- .../RazorProjectServiceTest.cs | 32 +++++++++---------- .../Refactoring/RenameEndpointTest.cs | 18 +++++------ 9 files changed, 39 insertions(+), 41 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs index afd1da50b3c..73c66dab4b9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidChangeEndpoint.cs @@ -60,7 +60,7 @@ public async Task HandleNotificationAsync(DidChangeTextDocumentParams request, R sourceText = ApplyContentChanges(request.ContentChanges, sourceText); await _projectService - .UpdateDocumentAsync(documentContext.FilePath, sourceText, request.TextDocument.Version, cancellationToken) + .UpdateDocumentAsync(documentContext.FilePath, sourceText, cancellationToken) .ConfigureAwait(false); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs index 8af40ddf029..cb07a86ef22 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentSynchronization/DocumentDidOpenEndpoint.cs @@ -23,6 +23,6 @@ public Task HandleNotificationAsync(DidOpenTextDocumentParams request, RazorRequ var sourceText = SourceText.From(request.TextDocument.Text); return _projectService.OpenDocumentAsync( - request.TextDocument.Uri.GetAbsoluteOrUNCPath(), sourceText, request.TextDocument.Version, cancellationToken); + request.TextDocument.Uri.GetAbsoluteOrUNCPath(), sourceText, cancellationToken); } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs index e83c8c327f1..942c95985bc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/IRazorProjectService.cs @@ -14,8 +14,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem; internal interface IRazorProjectService { Task AddDocumentToMiscProjectAsync(string filePath, CancellationToken cancellationToken); - Task OpenDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken); - Task UpdateDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken); + Task OpenDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken); + Task UpdateDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken); Task CloseDocumentAsync(string filePath, CancellationToken cancellationToken); Task RemoveDocumentAsync(string filePath, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs index 696129efb99..2704661674e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ProjectSystem/RazorProjectService.cs @@ -178,7 +178,7 @@ private void AddDocumentToMiscProjectCore(ProjectSnapshotManager.Updater updater updater.DocumentAdded(miscFilesProject.Key, hostDocument, textLoader); } - public async Task OpenDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken) + public async Task OpenDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken) { await WaitForInitializationAsync().ConfigureAwait(false); @@ -278,7 +278,7 @@ await _projectManager.UpdateAsync( .ConfigureAwait(false); } - public async Task UpdateDocumentAsync(string filePath, SourceText sourceText, int version, CancellationToken cancellationToken) + public async Task UpdateDocumentAsync(string filePath, SourceText sourceText, CancellationToken cancellationToken) { await WaitForInitializationAsync().ConfigureAwait(false); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs index baf947911fb..93e144b75a4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidChangeEndpointTest.cs @@ -33,7 +33,7 @@ public void ApplyContentChanges_SingleChange() }; // Act - var result = endpoint.ApplyContentChanges(new[] { change }, sourceText); + var result = endpoint.ApplyContentChanges([change], sourceText); // Assert Assert.Equal("Hello! World", result.ToString()); @@ -98,13 +98,12 @@ public async Task Handle_DidChangeTextDocument_UpdatesDocument() var documentContext = CreateDocumentContext(documentPath, codeDocument); var projectService = new StrictMock(); projectService - .Setup(service => service.UpdateDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(service => service.UpdateDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask) - .Callback((string path, SourceText text, int version, CancellationToken cancellationToken) => + .Callback((string path, SourceText text, CancellationToken cancellationToken) => { Assert.Equal("

", text.ToString()); Assert.Equal(documentPath.OriginalString, path); - Assert.Equal(1337, version); }); var endpoint = new DocumentDidChangeEndpoint(projectService.Object, LoggerFactory); var change = new TextDocumentContentChangeEvent() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs index 4867629a6f9..a2067331373 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSynchronization/DocumentDidOpenEndpointTest.cs @@ -25,13 +25,12 @@ public async Task Handle_DidOpenTextDocument_AddsDocument() var documentPath = "C:/path/to/document.cshtml"; var projectService = new StrictMock(); projectService - .Setup(service => service.OpenDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny())) + .Setup(service => service.OpenDocumentAsync(It.IsAny(), It.IsAny(), It.IsAny())) .Returns(Task.CompletedTask) - .Callback((string path, SourceText text, int version, CancellationToken cancellationToken) => + .Callback((string path, SourceText text, CancellationToken cancellationToken) => { Assert.Equal("hello", text.ToString()); Assert.Equal(documentPath, path); - Assert.Equal(1337, version); }); var endpoint = new DocumentDidOpenEndpoint(projectService.Object); var request = new DidOpenTextDocumentParams() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs index 3fd1cbf2fb6..3f372b9f668 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorComponentSearchEngineTest.cs @@ -75,10 +75,10 @@ await projectService.AddProjectAsync( DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath1, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(""), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(""), DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath2, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From("@namespace Test"), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From("@namespace Test"), DisposalToken); await projectService.AddProjectAsync( s_projectFilePath2, @@ -89,7 +89,7 @@ await projectService.AddProjectAsync( DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath3, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(""), version: 1, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(""), DisposalToken); } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs index 08ca59d78db..ba7e5d7563e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorProjectServiceTest.cs @@ -475,7 +475,7 @@ public async Task CloseDocument_ClosesDocumentInOwnerProject() var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); @@ -508,7 +508,7 @@ public async Task CloseDocument_ClosesDocumentInAllOwnerProjects() var ownerProjectKey2 = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath2, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject1 = _projectManager.GetLoadedProject(ownerProjectKey1); var ownerProject2 = _projectManager.GetLoadedProject(ownerProjectKey2); @@ -535,7 +535,7 @@ public async Task CloseDocument_ClosesDocumentInMiscellaneousProject() const string DocumentFilePath = "document.cshtml"; await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -573,7 +573,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInOwnerProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -606,7 +606,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInAllOwnerProjects() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -631,7 +631,7 @@ public async Task OpenDocument_OpensAlreadyAddedDocumentInMiscellaneousProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); // Assert listener.AssertNotifications( @@ -657,7 +657,7 @@ public async Task OpenDocument_OpensAndAddsDocumentToMiscellaneousProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, SourceText.From("Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -801,7 +801,7 @@ public async Task RemoveOpenDocument_RemovesDocumentFromOwnerProject_MovesToMisc var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -887,7 +887,7 @@ public async Task UpdateDocument_ChangesDocumentInOwnerProject() var ownerProjectKey = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject = _projectManager.GetLoadedProject(ownerProjectKey); @@ -896,7 +896,7 @@ public async Task UpdateDocument_ChangesDocumentInOwnerProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -920,7 +920,7 @@ public async Task UpdateDocument_ChangesDocumentInAllOwnerProjects() var ownerProjectKey2 = await _projectService.AddProjectAsync( ProjectFilePath, IntermediateOutputPath2, RazorConfiguration.Default, RootNamespace, displayName: null, DisposalToken); await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var ownerProject1 = _projectManager.GetLoadedProject(ownerProjectKey1); var ownerProject2 = _projectManager.GetLoadedProject(ownerProjectKey2); @@ -930,7 +930,7 @@ public async Task UpdateDocument_ChangesDocumentInAllOwnerProjects() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -947,7 +947,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() const string DocumentFilePath = "document.cshtml"; await _projectService.AddDocumentToPotentialProjectsAsync(DocumentFilePath, DisposalToken); - await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, version: 42, DisposalToken); + await _projectService.OpenDocumentAsync(DocumentFilePath, s_emptyText, DisposalToken); var miscProject = _projectManager.GetMiscellaneousProject(); @@ -956,7 +956,7 @@ public async Task UpdateDocument_ChangesDocumentInMiscProject() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -983,7 +983,7 @@ public async Task UpdateDocument_DocumentVersionUpdated() using var listener = _projectManager.ListenToNotifications(); // Act - await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + await _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); // Assert listener.AssertNotifications( @@ -1008,7 +1008,7 @@ await _projectService.AddProjectAsync( // Act await Assert.ThrowsAnyAsync(() => { - return _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), version: 43, DisposalToken); + return _projectService.UpdateDocumentAsync(DocumentFilePath, s_emptyText.Replace(0, 0, "Hello World"), DisposalToken); }); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs index 8792aeca17a..7f5a35cd276 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs @@ -660,12 +660,12 @@ await projectManager.UpdateAsync(updater => await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath1337, DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_indexFilePath1, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(ComponentText1), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From(ComponentText2), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_directoryFilePath1, SourceText.From(DirectoryText1), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_directoryFilePath2, SourceText.From(DirectoryText2), version: 4, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath1337, SourceText.From(ComponentText1337), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_indexFilePath1, SourceText.From(IndexText1), version: 42, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1, SourceText.From(ComponentText1), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath2, SourceText.From(ComponentText2), DisposalToken); + await projectService.UpdateDocumentAsync(s_directoryFilePath1, SourceText.From(DirectoryText1), DisposalToken); + await projectService.UpdateDocumentAsync(s_directoryFilePath2, SourceText.From(DirectoryText2), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath1337, SourceText.From(ComponentText1337), DisposalToken); + await projectService.UpdateDocumentAsync(s_indexFilePath1, SourceText.From(IndexText1), DisposalToken); var projectKey2 = await projectService.AddProjectAsync( s_projectFilePath2, s_intermediateOutputPath2, RazorConfiguration.Default, RootNamespace2, displayName: null, DisposalToken); @@ -679,9 +679,9 @@ await projectManager.UpdateAsync(updater => await projectService.AddDocumentToPotentialProjectsAsync(s_componentFilePath4, DisposalToken); await projectService.AddDocumentToPotentialProjectsAsync(s_componentWithParamFilePath, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(ComponentText3), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentFilePath4, SourceText.From(ComponentText4), version: 42, DisposalToken); - await projectService.UpdateDocumentAsync(s_componentWithParamFilePath, SourceText.From(ComponentWithParamText), version: 42, DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath3, SourceText.From(ComponentText3), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentFilePath4, SourceText.From(ComponentText4), DisposalToken); + await projectService.UpdateDocumentAsync(s_componentWithParamFilePath, SourceText.From(ComponentWithParamText), DisposalToken); var searchEngine = new RazorComponentSearchEngine(projectManager, LoggerFactory); options ??= StrictMock.Of(o => From 186a134a3bbe0668043e59b74ef2cfe7d03a9cb7 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 12 Aug 2024 10:35:32 +1000 Subject: [PATCH 087/271] Remove VersionedDocumentContext and the separate methods to create one --- .../RazorCSharpFormattingBenchmark.cs | 2 +- .../RazorCodeActionsBenchmark.cs | 2 +- .../RazorCompletionBenchmark.cs | 4 +- .../RazorDiagnosticsBenchmark.cs | 8 +-- .../RazorSemanticTokensBenchmark.cs | 7 +-- ...zorSemanticTokensRangeEndpointBenchmark.cs | 7 +-- .../RazorSemanticTokensScrollingBenchmark.cs | 4 +- .../CSharp/DefaultCSharpCodeActionResolver.cs | 6 +- ...mattedRemappingCSharpCodeActionResolver.cs | 6 +- .../CodeActions/CodeActionEndpoint.cs | 6 +- .../Html/DefaultHtmlCodeActionResolver.cs | 4 +- .../Razor/GenerateMethodCodeActionResolver.cs | 6 +- .../ColorPresentationEndpoint.cs | 2 +- .../Completion/CompletionListProvider.cs | 2 +- .../DelegatedCompletionItemResolver.cs | 2 +- .../DelegatedCompletionListProvider.cs | 6 +- .../Completion/RazorCompletionListProvider.cs | 2 +- .../DocumentPullDiagnosticsEndpoint.cs | 4 +- .../DocumentColor/DocumentColorEndpoint.cs | 2 +- .../DocumentContextFactory.cs | 48 +--------------- ...actTextDocumentPresentationEndpointBase.cs | 4 +- .../EndpointContracts/RazorRequestContext.cs | 4 +- .../Folding/FoldingRangeEndpoint.cs | 2 +- .../Formatting/IRazorFormattingService.cs | 2 +- .../Formatting/RazorFormattingService.cs | 4 +- .../Hover/HoverService.cs | 4 +- .../Hover/IHoverService.cs | 4 +- .../InlayHints/IInlayHintService.cs | 2 +- .../InlayHints/InlayHintService.cs | 2 +- .../LspEditMappingService.cs | 14 +---- .../MapCode/MapCodeEndpoint.cs | 8 +-- .../Mapping/RazorLanguageQueryEndpoint.cs | 2 +- .../RazorMapToDocumentRangesEndpoint.cs | 4 +- .../RazorRequestContextFactory.cs | 6 +- .../LSPCSharpSemanticTokensProvider.cs | 4 +- .../SpellCheck/DocumentSpellCheckEndpoint.cs | 4 +- .../WrapWithTag/WrapWithTagEndpoint.cs | 2 +- .../AbstractEditMappingService.cs | 14 ++--- .../ProjectSystem/DocumentContext.cs | 4 ++ .../ProjectSystem/IDocumentContextFactory.cs | 1 - .../IDocumentContextFactoryExtensions.cs | 57 +------------------ .../ProjectSystem/VersionedDocumentContext.cs | 17 ------ .../Rename/IRenameService.cs | 2 +- .../Rename/RenameService.cs | 2 +- .../AbstractRazorSemanticTokensInfoService.cs | 10 ++-- .../ICSharpSemanticTokensProvider.cs | 2 +- .../IRazorSemanticTokenInfoService.cs | 2 +- .../RemoteEditMappingService.cs | 10 +--- .../DocumentContextExtensions.cs | 2 +- .../ProjectSystem/RemoteDocumentContext.cs | 6 +- .../ProjectSystem/RemoteDocumentSnapshot.cs | 2 +- .../RemoteCSharpSemanticTokensProvider.cs | 2 +- .../Endpoints/RazorCustomMessageTarget.cs | 16 ------ ...RazorCustomMessageTarget_SemanticTokens.cs | 15 +++-- .../OnAutoInsertEndpointTest.NetFx.cs | 2 +- .../CodeActionEndToEndTest.NetFx.cs | 6 +- .../Completion/CompletionListProviderTest.cs | 8 +-- ...legatedCompletionItemResolverTest.NetFx.cs | 6 +- .../Delegation/ResponseRewriterTestBase.cs | 2 +- .../RazorCompletionListProviderTest.cs | 16 +++--- .../ValidateBreakpointRangeEndpointTest.cs | 4 +- .../DefinitionEndpointDelegationTest.cs | 2 +- .../DocumentContextFactoryTest.cs | 6 +- .../DocumentHighlightEndpointTest.cs | 2 +- ...extDocumentUriPresentationEndpointTests.cs | 8 +-- .../DocumentSymbolEndpointTest.cs | 2 +- .../FindAllReferencesEndpointTest.cs | 2 +- .../Folding/FoldingEndpointTest.cs | 2 +- .../DocumentOnTypeFormattingEndpointTest.cs | 2 +- .../FormattingLanguageServerTestBase.cs | 2 +- .../Formatting_NetFx/FormattingTestBase.cs | 6 +- .../Hover/HoverServiceTest.cs | 7 ++- .../ImplementationEndpointTest.cs | 2 +- .../InlayHints/InlayHintEndpointTest.cs | 2 +- .../MapCode/MapCodeTest.cs | 4 +- .../Mapping/RazorLanguageQueryEndpointTest.cs | 4 -- .../RazorMapToDocumentRangesEndpointTest.cs | 7 --- .../ProjectContextsEndpointTest.cs | 2 +- .../RenameEndpointDelegationTest.cs | 2 +- .../Refactoring/RenameEndpointTest.cs | 26 ++++----- .../Semantic/SemanticTokensTest.cs | 15 ++--- .../SignatureHelpEndpointTest.cs | 2 +- .../SingleServerDelegatingEndpointTestBase.cs | 2 +- .../LanguageServer/LanguageServerTestBase.cs | 12 ++-- .../LanguageServer/TestDocumentContext.cs | 8 +-- .../TestDocumentContextFactory.cs | 17 +----- .../ProjectSystem/TestDocumentSnapshot.cs | 12 ++-- 87 files changed, 195 insertions(+), 373 deletions(-) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/VersionedDocumentContext.cs diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 4cfa36773c0..4de35d8b605 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -116,7 +116,7 @@ public async Task RazorCSharpFormattingAsync() InsertSpaces = true }; - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); var edits = await RazorFormattingService.FormatAsync(documentContext, range: null, options, CancellationToken.None); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs index efeead6a96e..d1d21777c6f 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCodeActionsBenchmark.cs @@ -83,7 +83,7 @@ public async Task SetupAsync() CSharpCodeActionRange = DocumentText.GetZeroWidthRange(csharpCodeActionIndex); HtmlCodeActionRange = DocumentText.GetZeroWidthRange(htmlCodeActionIndex); - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); var codeDocument = await documentContext.GetCodeDocumentAsync(CancellationToken.None); // Need a root namespace for the Extract to Code Behind light bulb to be happy diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs index 0bf6c9fea83..d35a168a36e 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCompletionBenchmark.cs @@ -79,7 +79,7 @@ public async Task SetupAsync() RazorPosition = DocumentText.GetPosition(razorCodeActionIndex); - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, 1); + var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); RazorRequestContext = new RazorRequestContext(documentContext, RazorLanguageServerHost.GetRequiredService(), "lsp/method", uri: null); } @@ -146,7 +146,7 @@ public TestDelegatedCompletionListProvider(IEnumerable GetCompletionListAsync(int absoluteIndex, VSInternalCompletionContext completionContext, VersionedDocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) + public override Task GetCompletionListAsync(int absoluteIndex, VSInternalCompletionContext completionContext, DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) { return Task.FromResult( new VSInternalCompletionList diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 9e50156d7f5..77c5a38937a 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -36,7 +36,7 @@ public class RazorDiagnosticsBenchmark : RazorLanguageServerBenchmarkBase private ImmutableArray SourceMappings { get; set; } private string? GeneratedCode { get; set; } private object? Diagnostics { get; set; } - private VersionedDocumentContext? VersionedDocumentContext { get; set; } + private DocumentContext? DocumentContext { get; set; } private VSInternalDocumentDiagnosticsParams? Request { get; set; } private IEnumerable? Response { get; set; } @@ -74,17 +74,17 @@ public void Setup() RazorCodeDocument = mockRazorCodeDocument.Object; SourceText = RazorCodeDocument.Source.Text; - var documentContext = new Mock( + var documentContext = new Mock( MockBehavior.Strict, new object[] { It.IsAny(), It.IsAny(), It.IsAny(), It.IsAny() }); documentContext .Setup(r => r.GetCodeDocumentAsync(It.IsAny())) .ReturnsAsync(RazorCodeDocument); documentContext.Setup(r => r.Uri).Returns(It.IsAny()); - documentContext.Setup(r => r.Version).Returns(It.IsAny()); + documentContext.Setup(r => r.Snapshot.Version).Returns(It.IsAny()); documentContext.Setup(r => r.GetSourceTextAsync(It.IsAny())).ReturnsAsync(It.IsAny()); RazorRequestContext = new RazorRequestContext(documentContext.Object, null!, "lsp/method", uri: null); - VersionedDocumentContext = documentContext.Object; + DocumentContext = documentContext.Object; var loggerFactory = EmptyLoggerFactory.Instance; var languageServerFeatureOptions = BuildFeatureOptions(); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs index 8afb6f83298..dd76b418ad0 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensBenchmark.cs @@ -31,7 +31,7 @@ public class RazorSemanticTokensBenchmark : RazorLanguageServerBenchmarkBase private IDocumentSnapshot DocumentSnapshot => DocumentContext.Snapshot; - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Range Range { get; set; } @@ -59,8 +59,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - var version = 1; - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var text = await DocumentContext.GetSourceTextAsync(CancellationToken.None).ConfigureAwait(false); Range = VsLspFactory.CreateRange( @@ -108,7 +107,7 @@ public TestRazorSemanticTokensInfoService( // We can't get C# responses without significant amounts of extra work, so let's just shim it for now, any non-Null result is fine. protected override Task?> GetCSharpSemanticRangesAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, RazorCodeDocument codeDocument, LinePositionSpan razorRange, bool colorBackground, diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs index 041413a31b5..e4c3e5fffd0 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensRangeEndpointBenchmark.cs @@ -34,7 +34,7 @@ public class RazorSemanticTokensRangeEndpointBenchmark : RazorLanguageServerBenc private Uri DocumentUri => DocumentContext.Uri; - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Range Range { get; set; } @@ -66,8 +66,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - var version = 1; - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var razorOptionsMonitor = RazorLanguageServerHost.GetRequiredService(); var clientCapabilitiesService = new BenchmarkClientCapabilitiesService(new VSInternalClientCapabilities() { SupportsVisualStudioExtensions = true }); @@ -141,7 +140,7 @@ public TestCustomizableRazorSemanticTokensInfoService( // We can't get C# responses without significant amounts of extra work, so let's just shim it for now, any non-Null result is fine. protected override Task?> GetCSharpSemanticRangesAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, RazorCodeDocument codeDocument, LinePositionSpan razorSpan, bool colorBackground, diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs index 6f5107bb265..20bcd3f5505 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorSemanticTokensScrollingBenchmark.cs @@ -22,7 +22,7 @@ public class RazorSemanticTokensScrollingBenchmark : RazorLanguageServerBenchmar { private IRazorSemanticTokensInfoService RazorSemanticTokenService { get; set; } - private VersionedDocumentContext DocumentContext { get; set; } + private DocumentContext DocumentContext { get; set; } private Uri DocumentUri => DocumentContext.Uri; @@ -49,7 +49,7 @@ public async Task InitializeRazorSemanticAsync() var documentUri = new Uri(filePath); var documentSnapshot = await GetDocumentSnapshotAsync(ProjectFilePath, filePath, TargetPath); - DocumentContext = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext: null, version: 1); + DocumentContext = new DocumentContext(documentUri, documentSnapshot, projectContext: null); var text = await DocumentSnapshot.GetTextAsync().ConfigureAwait(false); Range = VsLspFactory.CreateRange( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 9e62f694a04..343f7e480cd 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -46,12 +46,12 @@ public async override Task ResolveAsync( CodeAction codeAction, CancellationToken cancellationToken) { - if (!_documentContextFactory.TryCreateForOpenDocument(csharpParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(csharpParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action @@ -88,7 +88,7 @@ public async override Task ResolveAsync( cancellationToken.ThrowIfCancellationRequested(); - var documentVersion = documentContext.Version; + var documentVersion = documentContext.Snapshot.Version; var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs index 964f576f653..7e0e29d5499 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs @@ -37,12 +37,12 @@ public async override Task ResolveAsync( { cancellationToken.ThrowIfCancellationRequested(); - if (!_documentContextFactory.TryCreateForOpenDocument(csharpParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(csharpParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(csharpParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.CSharp, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action @@ -87,7 +87,7 @@ public async override Task ResolveAsync( var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { Uri = csharpParams.RazorFileIdentifier.Uri, - Version = documentContext.Version, + Version = documentContext.Snapshot.Version, }; resolvedCodeAction.Edit = new WorkspaceEdit() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs index 4a72ea63208..a2d9c0a841c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CodeActionEndpoint.cs @@ -175,7 +175,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V return context; } - private async Task> GetDelegatedCodeActionsAsync(VersionedDocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) + private async Task> GetDelegatedCodeActionsAsync(DocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) { var languageKind = _documentMappingService.GetLanguageKind(context.CodeDocument, context.Location.AbsoluteIndex, rightAssociative: false); @@ -256,7 +256,7 @@ private static async Task> FilterCodeA } // Internal for testing - internal async Task GetCodeActionsFromLanguageServerAsync(RazorLanguageKind languageKind, VersionedDocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) + internal async Task GetCodeActionsFromLanguageServerAsync(RazorLanguageKind languageKind, DocumentContext documentContext, RazorCodeActionContext context, Guid correlationId, CancellationToken cancellationToken) { if (languageKind == RazorLanguageKind.CSharp) { @@ -282,7 +282,7 @@ internal async Task GetCodeActionsFromLanguageServe var delegatedParams = new DelegatedCodeActionParams() { - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, CodeActionParams = context.Request, LanguageKind = languageKind, CorrelationId = correlationId diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs index e95ca9d060c..4c8fa0a60f3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionResolver.cs @@ -28,12 +28,12 @@ public async override Task ResolveAsync( CodeAction codeAction, CancellationToken cancellationToken) { - if (!_documentContextFactory.TryCreateForOpenDocument(resolveParams.RazorFileIdentifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(resolveParams.RazorFileIdentifier, out var documentContext)) { return codeAction; } - var resolvedCodeAction = await ResolveCodeActionWithServerAsync(resolveParams.RazorFileIdentifier, documentContext.Version, RazorLanguageKind.Html, codeAction, cancellationToken).ConfigureAwait(false); + var resolvedCodeAction = await ResolveCodeActionWithServerAsync(resolveParams.RazorFileIdentifier, documentContext.Snapshot.Version, RazorLanguageKind.Html, codeAction, cancellationToken).ConfigureAwait(false); if (resolvedCodeAction?.Edit?.DocumentChanges is null) { // Unable to resolve code action with server, return original code action diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index 86af5075d71..b990b515e79 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -58,7 +58,7 @@ internal sealed class GenerateMethodCodeActionResolver( return null; } - if (!_documentContextFactory.TryCreateForOpenDocument(actionParams.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(actionParams.Uri, out var documentContext)) { return null; } @@ -139,7 +139,7 @@ razorClassName is null || private async Task GenerateMethodInCodeBlockAsync( RazorCodeDocument code, GenerateMethodCodeActionParams actionParams, - VersionedDocumentContext documentContext, + DocumentContext documentContext, string? razorNamespace, string? razorClassName, CancellationToken cancellationToken) @@ -228,7 +228,7 @@ private async Task GenerateMethodInCodeBlockAsync( return new WorkspaceEdit() { DocumentChanges = new[] { razorTextDocEdit } }; } - private static async Task PopulateMethodSignatureAsync(VersionedDocumentContext documentContext, GenerateMethodCodeActionParams actionParams, CancellationToken cancellationToken) + private static async Task PopulateMethodSignatureAsync(DocumentContext documentContext, GenerateMethodCodeActionParams actionParams, CancellationToken cancellationToken) { var templateWithMethodSignature = s_generateMethodTemplate.Replace(MethodName, actionParams.MethodName); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs index 6da931e401c..8cd27d497a3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/ColorPresentation/ColorPresentationEndpoint.cs @@ -33,7 +33,7 @@ public async Task HandleRequestAsync(ColorPresentationPa var delegatedRequest = new DelegatedColorPresentationParams { - RequiredHostDocumentVersion = documentContext.Version, + RequiredHostDocumentVersion = documentContext.Snapshot.Version, Color = request.Color, Range = request.Range, TextDocument = request.TextDocument diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs index f296da09b3d..9caeb7cc5de 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/CompletionListProvider.cs @@ -33,7 +33,7 @@ public CompletionListProvider(RazorCompletionListProvider razorCompletionListPro public async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index f977eb4b4ff..3e9464e62f7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -100,7 +100,7 @@ private async Task PostProcessCompletionItemAsync( } var identifier = context.OriginalRequestParams.Identifier.TextDocumentIdentifier; - if (!_documentContextFactory.TryCreateForOpenDocument(identifier, out var documentContext)) + if (!_documentContextFactory.TryCreate(identifier, out var documentContext)) { return resolvedCompletionItem; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs index 2c8e023b46d..fcdc554aa3f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionListProvider.cs @@ -51,7 +51,7 @@ public DelegatedCompletionListProvider( public virtual async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) @@ -119,7 +119,7 @@ public DelegatedCompletionListProvider( return rewrittenResponse; } - private async Task ShouldIncludeSnippetsAsync(VersionedDocumentContext documentContext, int absoluteIndex, CancellationToken cancellationToken) + private async Task ShouldIncludeSnippetsAsync(DocumentContext documentContext, int absoluteIndex, CancellationToken cancellationToken) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var tree = codeDocument.GetSyntaxTree(); @@ -182,7 +182,7 @@ private static VSInternalCompletionContext RewriteContext(VSInternalCompletionCo } private async Task TryGetProvisionalCompletionInfoAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalCompletionContext completionContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs index e73f38dcad8..ea0b2a76a02 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/RazorCompletionListProvider.cs @@ -39,7 +39,7 @@ internal class RazorCompletionListProvider( public virtual async Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, HashSet? existingCompletions, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs index 68d893f9b24..cc175aa49c0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs @@ -121,7 +121,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno return allDiagnostics.ToArray(); } - private static async Task GetRazorDiagnosticsAsync(VersionedDocumentContext documentContext, CancellationToken cancellationToken) + private static async Task GetRazorDiagnosticsAsync(DocumentContext documentContext, CancellationToken cancellationToken) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); @@ -145,7 +145,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno ]; } - private async Task<(VSInternalDiagnosticReport[]? CSharpDiagnostics, VSInternalDiagnosticReport[]? HtmlDiagnostics)> GetHtmlCSharpDiagnosticsAsync(VersionedDocumentContext documentContext, Guid correlationId, CancellationToken cancellationToken) + private async Task<(VSInternalDiagnosticReport[]? CSharpDiagnostics, VSInternalDiagnosticReport[]? HtmlDiagnostics)> GetHtmlCSharpDiagnosticsAsync(DocumentContext documentContext, Guid correlationId, CancellationToken cancellationToken) { var delegatedParams = new DelegatedDiagnosticParams(documentContext.GetTextDocumentIdentifierAndVersion(), correlationId); var delegatedResponse = await _clientConnection.SendRequestAsync( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs index f3f870e3470..1275669a97c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentColor/DocumentColorEndpoint.cs @@ -38,7 +38,7 @@ public async Task HandleRequestAsync(DocumentColorParams req var delegatedRequest = new DelegatedDocumentColorParams() { - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, TextDocument = request.TextDocument }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs index 7f46807c2a3..68755ea2ae8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentContextFactory.cs @@ -27,19 +27,17 @@ internal sealed class DocumentContextFactory( public bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { var filePath = documentUri.GetAbsoluteOrUNCPath(); - if (!TryGetDocumentAndVersion(filePath, projectContext, versioned, out var documentAndVersion)) + if (!TryResolveDocument(filePath, projectContext, out var documentSnapshot)) { // Stale request or misbehaving client, see above comment. context = null; return false; } - var (documentSnapshot, version) = documentAndVersion; if (documentSnapshot is null) { Debug.Fail($"Document snapshot should never be null here for '{filePath}'. This indicates that our acquisition of documents / versions did not behave as expected."); @@ -47,52 +45,10 @@ public bool TryCreate( return false; } - if (versioned) - { - // If we were asked for a versioned document, but have no version info, then we didn't find the document - if (version is null) - { - context = null; - return false; - } - - context = new VersionedDocumentContext(documentUri, documentSnapshot, projectContext, version.Value); - return true; - } - context = new DocumentContext(documentUri, documentSnapshot, projectContext); return true; } - private bool TryGetDocumentAndVersion( - string filePath, - VSProjectContext? projectContext, - bool versioned, - [NotNullWhen(true)] out DocumentSnapshotAndVersion? documentAndVersion) - { - if (TryResolveDocument(filePath, projectContext, out var documentSnapshot)) - { - if (!versioned) - { - documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, Version: null); - return true; - } - - documentAndVersion = new DocumentSnapshotAndVersion(documentSnapshot, documentSnapshot.Version); - return true; - } - - // This is super rare, if we get here it could mean many things. Some of which: - // 1. Stale request: - // - Got queued after a "document closed" / "document removed" type action - // - Took too long to run and by the time the request needed the document context the - // version cache has evicted the entry - // 2. Client is misbehaving and sending requests for a document that we've never seen before. - _logger.LogWarning($"Tried to create context for document {filePath} and project {projectContext?.Id} which was not found."); - documentAndVersion = null; - return false; - } - private bool TryResolveDocument( string filePath, VSProjectContext? projectContext, @@ -125,6 +81,4 @@ private bool TryResolveDocument( documentSnapshot = null; return false; } - - private record DocumentSnapshotAndVersion(IDocumentSnapshot Snapshot, int? Version); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs index f0059d00a19..330dd3201d3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs @@ -93,7 +93,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( var requestParams = CreateRazorRequestParameters(request); - requestParams.HostDocumentVersion = documentContext.Version; + requestParams.HostDocumentVersion = documentContext.Snapshot.Version; requestParams.Kind = languageKind; // For CSharp we need to map the range to the generated document @@ -115,7 +115,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( // The responses we get back will be for virtual documents, so we have to map them back to the real // document, and in the case of C#, map the returned ranges too - var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument, documentContext.Version); + var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument, documentContext.Snapshot.Version); return edit; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs index a81541b76d2..97819fcb3f0 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/EndpointContracts/RazorRequestContext.cs @@ -7,9 +7,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -internal readonly struct RazorRequestContext(VersionedDocumentContext? documentContext, ILspServices lspServices, string method, Uri? uri) +internal readonly struct RazorRequestContext(DocumentContext? documentContext, ILspServices lspServices, string method, Uri? uri) { - public readonly VersionedDocumentContext? DocumentContext = documentContext; + public readonly DocumentContext? DocumentContext = documentContext; public readonly ILspServices LspServices = lspServices; public readonly string Method = method; public readonly Uri? Uri = uri; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs index d94e078be6b..f2f71470096 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Folding/FoldingRangeEndpoint.cs @@ -55,7 +55,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(FoldingRangeParams reque var requestParams = new RazorFoldingRangeRequestParam { - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, TextDocument = @params.TextDocument, }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs index 9048b915931..55e87401e30 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IRazorFormattingService.cs @@ -12,7 +12,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal interface IRazorFormattingService { Task FormatAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs index 7989815323b..3994238012e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/RazorFormattingService.cs @@ -36,7 +36,7 @@ public RazorFormattingService( } public async Task FormatAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) @@ -68,7 +68,7 @@ public async Task FormatAsync( var uri = documentContext.Uri; var documentSnapshot = documentContext.Snapshot; - var hostDocumentVersion = documentContext.Version; + var hostDocumentVersion = documentContext.Snapshot.Version; using var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, _workspaceFactory); var originalText = context.SourceText; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs index 4fb546a09d6..de1dadb9643 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/HoverService.cs @@ -35,7 +35,7 @@ internal sealed partial class HoverService( private readonly IDocumentMappingService _documentMappingService = documentMappingService; private readonly IClientCapabilitiesService _clientCapabilitiesService = clientCapabilitiesService; - public async Task GetRazorHoverInfoAsync(VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken) + public async Task GetRazorHoverInfoAsync(DocumentContext documentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken) { // HTML can still sometimes be handled by razor. For example hovering over // a component tag like will still be in an html context @@ -57,7 +57,7 @@ internal sealed partial class HoverService( return await GetHoverInfoAsync(documentContext.FilePath, codeDocument, location, _clientCapabilitiesService.ClientCapabilities, cancellationToken).ConfigureAwait(false); } - public async Task TranslateDelegatedResponseAsync(VSInternalHover? response, VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) + public async Task TranslateDelegatedResponseAsync(VSInternalHover? response, DocumentContext documentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) { if (response?.Range is null) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs index 5408dd8f17d..b3ef864a76c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hover/IHoverService.cs @@ -11,6 +11,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Hover; internal interface IHoverService { - Task GetRazorHoverInfoAsync(VersionedDocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken); - Task TranslateDelegatedResponseAsync(VSInternalHover? response, VersionedDocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken); + Task GetRazorHoverInfoAsync(DocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, Position position, CancellationToken cancellationToken); + Task TranslateDelegatedResponseAsync(VSInternalHover? response, DocumentContext versionedDocumentContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs index 54865b68151..fce91249bf1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/IInlayHintService.cs @@ -11,7 +11,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.InlayHints; internal interface IInlayHintService { - Task GetInlayHintsAsync(IClientConnection clientConnection, VersionedDocumentContext documentContext, Range range, CancellationToken cancellationToken); + Task GetInlayHintsAsync(IClientConnection clientConnection, DocumentContext documentContext, Range range, CancellationToken cancellationToken); Task ResolveInlayHintAsync(IClientConnection clientConnection, InlayHint inlayHint, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs index 294a6adc827..60b405b5faa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlayHints/InlayHintService.cs @@ -22,7 +22,7 @@ internal sealed class InlayHintService(IDocumentMappingService documentMappingSe { private readonly IDocumentMappingService _documentMappingService = documentMappingService; - public async Task GetInlayHintsAsync(IClientConnection clientConnection, VersionedDocumentContext documentContext, Range range, CancellationToken cancellationToken) + public async Task GetInlayHintsAsync(IClientConnection clientConnection, DocumentContext documentContext, Range range, CancellationToken cancellationToken) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var csharpDocument = codeDocument.GetCSharpDocument(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs index e8d9f6c580e..bd88b799311 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/LspEditMappingService.cs @@ -22,19 +22,9 @@ internal class LspEditMappingService( { private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; - protected override bool TryGetVersionedDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out VersionedDocumentContext? documentContext) + protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out DocumentContext? documentContext) { - if (!_documentContextFactory.TryCreateForOpenDocument(razorDocumentUri, projectContext, out documentContext)) - { - return false; - } - - return true; - } - - protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, [NotNullWhen(true)] out DocumentContext? documentContext) - { - if (!_documentContextFactory.TryCreate(razorDocumentUri, out documentContext)) + if (!_documentContextFactory.TryCreate(razorDocumentUri, projectContext, out documentContext)) { return false; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs index e38ace89ca0..4d61c202e32 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/MapCode/MapCodeEndpoint.cs @@ -85,7 +85,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V continue; } - if (!_documentContextFactory.TryCreateForOpenDocument(mapping.TextDocument.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(mapping.TextDocument.Uri, out var documentContext)) { continue; } @@ -131,7 +131,7 @@ private async Task TryMapCodeAsync( Location[][] locations, List changes, Guid mapCodeCorrelationId, - VersionedDocumentContext documentContext, + DocumentContext documentContext, CancellationToken cancellationToken) { var syntaxTree = codeToMap.GetSyntaxTree(); @@ -162,7 +162,7 @@ private async Task TryMapCodeAsync( ImmutableArray nodesToMap, Guid mapCodeCorrelationId, List changes, - VersionedDocumentContext documentContext, + DocumentContext documentContext, CancellationToken cancellationToken) { var didCalculateCSharpFocusLocations = false; @@ -357,7 +357,7 @@ private async Task GetCSharpFocusLocationsAsync(Location[][] focus continue; } - if (!_documentContextFactory.TryCreateForOpenDocument(potentialLocation.Uri, out var documentContext)) + if (!_documentContextFactory.TryCreate(potentialLocation.Uri, out var documentContext)) { continue; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs index 62f55e00a19..7c7bc03cc47 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs @@ -39,7 +39,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(RazorLanguageQueryParams } var documentSnapshot = documentContext.Snapshot; - var documentVersion = documentContext.Version; + var documentVersion = documentContext.Snapshot.Version; var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); var sourceText = await documentSnapshot.GetTextAsync().ConfigureAwait(false); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs index a6e0c6f6a29..1223d0f5c39 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorMapToDocumentRangesEndpoint.cs @@ -53,7 +53,7 @@ public Uri GetTextDocumentIdentifier(RazorMapToDocumentRangesParams request) return new RazorMapToDocumentRangesResponse() { Ranges = request.ProjectedRanges, - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, }; } @@ -76,7 +76,7 @@ public Uri GetTextDocumentIdentifier(RazorMapToDocumentRangesParams request) return new RazorMapToDocumentRangesResponse() { Ranges = ranges, - HostDocumentVersion = documentContext.Version, + HostDocumentVersion = documentContext.Snapshot.Version, }; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs index 3383b82b7cb..f89b213204c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorRequestContextFactory.cs @@ -21,7 +21,7 @@ public override Task CreateRequestContextAsync().GetOrCreateLogger(); - VersionedDocumentContext? documentContext = null; + DocumentContext? documentContext = null; var textDocumentHandler = methodHandler as ITextDocumentIdentifierHandler; Uri? uri = null; @@ -35,7 +35,7 @@ public override Task CreateRequestContextAsync uriHandler) { @@ -43,7 +43,7 @@ public override Task CreateRequestContextAsync(); public async Task GetCSharpSemanticTokensResponseAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, ImmutableArray csharpSpans, Guid correlationId, CancellationToken cancellationToken) { - var documentVersion = documentContext.Version; + var documentVersion = documentContext.Snapshot.Version; using var _ = ListPool.GetPooledObject(out var csharpRangeList); foreach (var span in csharpSpans) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index 3d2b69e43a5..625c7a6086b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -79,7 +79,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellC }; } - private static async Task AddRazorSpellCheckRangesAsync(List ranges, VersionedDocumentContext documentContext, CancellationToken cancellationToken) + private static async Task AddRazorSpellCheckRangesAsync(List ranges, DocumentContext documentContext, CancellationToken cancellationToken) { var tree = await documentContext.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); @@ -127,7 +127,7 @@ MarkupMinimizedTagHelperDirectiveAttributeSyntax or } } - private async Task AddCSharpSpellCheckRangesAsync(List ranges, VersionedDocumentContext documentContext, CancellationToken cancellationToken) + private async Task AddCSharpSpellCheckRangesAsync(List ranges, DocumentContext documentContext, CancellationToken cancellationToken) { var delegatedParams = new DelegatedSpellCheckParams(documentContext.GetTextDocumentIdentifierAndVersion()); var delegatedResponse = await _clientConnection.SendRequestAsync( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index 990dbc07a6e..aa168ece625 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -104,7 +104,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(WrapWithTagParams reques var versioned = new VersionedTextDocumentIdentifier { Uri = request.TextDocument.Uri, - Version = documentContext.Version, + Version = documentContext.Snapshot.Version, }; var parameter = new DelegatedWrapWithTagParams(versioned, request); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs index f19d04c3500..a06a6ec3d52 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs @@ -26,7 +26,7 @@ public async Task RemapWorkspaceEditAsync(IDocumentSnapshot conte if (workspaceEdit.TryGetTextDocumentEdits(out var documentEdits)) { // The LSP spec says, we should prefer `DocumentChanges` property over `Changes` if available. - var remappedEdits = await RemapVersionedDocumentEditsAsync(contextDocumentSnapshot, documentEdits, cancellationToken).ConfigureAwait(false); + var remappedEdits = await RemapTextDocumentEditsAsync(contextDocumentSnapshot, documentEdits, cancellationToken).ConfigureAwait(false); return new WorkspaceEdit() { @@ -62,7 +62,7 @@ private async Task> RemapDocumentEditsAsync(IDocu continue; } - if (!TryGetDocumentContext(contextDocumentSnapshot, uri, out var documentContext)) + if (!TryGetDocumentContext(contextDocumentSnapshot, uri, projectContext: null, out var documentContext)) { continue; } @@ -107,7 +107,7 @@ private TextEdit[] RemapTextEditsCore(Uri generatedDocumentUri, RazorCodeDocumen return remappedEdits.ToArray(); } - private async Task RemapVersionedDocumentEditsAsync(IDocumentSnapshot contextDocumentSnapshot, TextDocumentEdit[] documentEdits, CancellationToken cancellationToken) + private async Task RemapTextDocumentEditsAsync(IDocumentSnapshot contextDocumentSnapshot, TextDocumentEdit[] documentEdits, CancellationToken cancellationToken) { using var remappedDocumentEdits = new PooledArrayBuilder(documentEdits.Length); @@ -125,7 +125,7 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen var razorDocumentUri = _filePathService.GetRazorDocumentUri(generatedDocumentUri); - if (!TryGetVersionedDocumentContext(contextDocumentSnapshot, razorDocumentUri, entry.TextDocument.GetProjectContext(), out var documentContext)) + if (!TryGetDocumentContext(contextDocumentSnapshot, razorDocumentUri, entry.TextDocument.GetProjectContext(), out var documentContext)) { continue; } @@ -144,7 +144,7 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen TextDocument = new OptionalVersionedTextDocumentIdentifier() { Uri = razorDocumentUri, - Version = documentContext.Version + Version = documentContext.Snapshot.Version }, Edits = remappedEdits }); @@ -153,7 +153,5 @@ private async Task RemapVersionedDocumentEditsAsync(IDocumen return remappedDocumentEdits.ToArray(); } - protected abstract bool TryGetVersionedDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out VersionedDocumentContext? documentContext); - - protected abstract bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, [NotNullWhen(true)] out DocumentContext? documentContext); + protected abstract bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out DocumentContext? documentContext); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentContext.cs index a99c792531f..207357dbbcc 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentContext.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; @@ -33,6 +34,9 @@ public TextDocumentIdentifier GetTextDocumentIdentifier() ProjectContext = _projectContext, }; + public TextDocumentIdentifierAndVersion GetTextDocumentIdentifierAndVersion() + => new(GetTextDocumentIdentifier(), Snapshot.Version); + private bool TryGetCodeDocument([NotNullWhen(true)] out RazorCodeDocument? codeDocument) { codeDocument = _codeDocument; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactory.cs index 6eb544326ec..a29c943da58 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactory.cs @@ -12,6 +12,5 @@ internal interface IDocumentContextFactory bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactoryExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactoryExtensions.cs index 519212b9df7..4843df493cf 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactoryExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentContextFactoryExtensions.cs @@ -13,64 +13,11 @@ public static bool TryCreate( this IDocumentContextFactory service, TextDocumentIdentifier documentIdentifier, [NotNullWhen(true)] out DocumentContext? context) - => service.TryCreate(documentIdentifier.Uri, documentIdentifier.GetProjectContext(), versioned: false, out context); + => service.TryCreate(documentIdentifier.Uri, documentIdentifier.GetProjectContext(), out context); public static bool TryCreate( this IDocumentContextFactory service, Uri documentUri, [NotNullWhen(true)] out DocumentContext? context) - => service.TryCreate(documentUri, projectContext: null, versioned: false, out context); - - public static bool TryCreate( - this IDocumentContextFactory service, - Uri documentUri, - VSProjectContext? projectContext, - [NotNullWhen(true)] out DocumentContext? context) - => service.TryCreate(documentUri, projectContext, versioned: false, out context); - - public static bool TryCreateForOpenDocument( - this IDocumentContextFactory service, - Uri documentUri, - [NotNullWhen(true)] out VersionedDocumentContext? context) - { - if (service.TryCreate(documentUri, projectContext: null, versioned: true, out var documentContext)) - { - context = (VersionedDocumentContext)documentContext; - return true; - } - - context = null; - return false; - } - - public static bool TryCreateForOpenDocument( - this IDocumentContextFactory service, - TextDocumentIdentifier documentIdentifier, - [NotNullWhen(true)] out VersionedDocumentContext? context) - { - if (service.TryCreate(documentIdentifier.Uri, documentIdentifier.GetProjectContext(), versioned: true, out var documentContext)) - { - context = (VersionedDocumentContext)documentContext; - return true; - } - - context = null; - return false; - } - - public static bool TryCreateForOpenDocument( - this IDocumentContextFactory service, - Uri documentUri, - VSProjectContext? projectContext, - [NotNullWhen(true)] out VersionedDocumentContext? context) - { - if (service.TryCreate(documentUri, projectContext, versioned: true, out var documentContext)) - { - context = (VersionedDocumentContext)documentContext; - return true; - } - - context = null; - return false; - } + => service.TryCreate(documentUri, projectContext: null, out context); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/VersionedDocumentContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/VersionedDocumentContext.cs deleted file mode 100644 index 6c4bbcf8ade..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/VersionedDocumentContext.cs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.CodeAnalysis.Razor.ProjectSystem; - -internal class VersionedDocumentContext(Uri uri, IDocumentSnapshot snapshot, VSProjectContext? projectContext, int version) - : DocumentContext(uri, snapshot, projectContext) -{ - public int Version { get; } = version; - - public TextDocumentIdentifierAndVersion GetTextDocumentIdentifierAndVersion() - => new(GetTextDocumentIdentifier(), Version); -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/IRenameService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/IRenameService.cs index 36c271f15d2..6567bf92ba2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/IRenameService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/IRenameService.cs @@ -11,5 +11,5 @@ namespace Microsoft.CodeAnalysis.Razor.Rename; internal interface IRenameService { - Task TryGetRazorRenameEditsAsync(VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, string newName, CancellationToken cancellationToken); + Task TryGetRazorRenameEditsAsync(DocumentContext documentContext, DocumentPositionInfo positionInfo, string newName, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/RenameService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/RenameService.cs index 6563e5bb059..4d74b88fd01 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/RenameService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Rename/RenameService.cs @@ -32,7 +32,7 @@ internal class RenameService( private readonly IProjectCollectionResolver _projectCollectionResolver = projectCollectionResolver; private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; - public async Task TryGetRazorRenameEditsAsync(VersionedDocumentContext documentContext, DocumentPositionInfo positionInfo, string newName, CancellationToken cancellationToken) + public async Task TryGetRazorRenameEditsAsync(DocumentContext documentContext, DocumentPositionInfo positionInfo, string newName, CancellationToken cancellationToken) { // We only support renaming of .razor components, not .cshtml tag helpers if (!FileKinds.IsComponent(documentContext.FileKind)) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs index 0acf4494658..fbd237c3710 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/AbstractRazorSemanticTokensInfoService.cs @@ -36,7 +36,7 @@ internal abstract class AbstractRazorSemanticTokensInfoService( private readonly ILogger _logger = logger; public async Task GetSemanticTokensAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, LinePositionSpan span, bool colorBackground, Guid correlationId, @@ -58,7 +58,7 @@ internal abstract class AbstractRazorSemanticTokensInfoService( } private async Task GetSemanticTokensAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, LinePositionSpan span, Guid correlationId, bool colorBackground, @@ -89,7 +89,7 @@ internal abstract class AbstractRazorSemanticTokensInfoService( // We return null (which to the LSP is a no-op) to prevent flashing of CSharp elements. if (csharpSemanticRangesResult is not { } csharpSemanticRanges) { - _logger.LogDebug($"Couldn't get C# tokens for version {documentContext.Version} of {documentContext.Uri}. Returning null"); + _logger.LogDebug($"Couldn't get C# tokens for version {documentContext.Snapshot.Version} of {documentContext.Uri}. Returning null"); return null; } @@ -134,7 +134,7 @@ private static ImmutableArray CombineSemanticRanges(ImmutableArra // Virtual for benchmarks protected virtual async Task?> GetCSharpSemanticRangesAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, RazorCodeDocument codeDocument, LinePositionSpan razorSpan, bool colorBackground, @@ -170,7 +170,7 @@ private static ImmutableArray CombineSemanticRanges(ImmutableArra csharpRanges = [csharpRange]; } - _logger.LogDebug($"Requesting C# semantic tokens for host version {documentContext.Version}, correlation ID {correlationId}, and the server thinks there are {codeDocument.GetCSharpSourceText().Lines.Count} lines of C#"); + _logger.LogDebug($"Requesting C# semantic tokens for host version {documentContext.Snapshot.Version}, correlation ID {correlationId}, and the server thinks there are {codeDocument.GetCSharpSourceText().Lines.Count} lines of C#"); var csharpResponse = await _csharpSemanticTokensProvider.GetCSharpSemanticTokensResponseAsync(documentContext, csharpRanges, correlationId, cancellationToken).ConfigureAwait(false); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/ICSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/ICSharpSemanticTokensProvider.cs index fede98e6331..216f320b74d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/ICSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/ICSharpSemanticTokensProvider.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Razor.SemanticTokens; internal interface ICSharpSemanticTokensProvider { Task GetCSharpSemanticTokensResponseAsync( - VersionedDocumentContext documentContext, + DocumentContext documentContext, ImmutableArray csharpSpans, Guid correlationId, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/IRazorSemanticTokenInfoService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/IRazorSemanticTokenInfoService.cs index 26de9805eca..b9240e16426 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/IRazorSemanticTokenInfoService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SemanticTokens/IRazorSemanticTokenInfoService.cs @@ -15,5 +15,5 @@ internal interface IRazorSemanticTokensInfoService /// Gets the int array representing the semantic tokens for the given range. /// /// See https://microsoft.github.io/language-server-protocol/specifications/lsp/3.17/specification/#textDocument_semanticTokens for details about the int array - Task GetSemanticTokensAsync(VersionedDocumentContext documentContext, LinePositionSpan range, bool colorBackground, Guid correlationId, CancellationToken cancellationToken); + Task GetSemanticTokensAsync(DocumentContext documentContext, LinePositionSpan range, bool colorBackground, Guid correlationId, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteEditMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteEditMappingService.cs index 359c4e90729..7110af27edd 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteEditMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteEditMappingService.cs @@ -21,7 +21,7 @@ internal sealed class RemoteEditMappingService( { private readonly DocumentSnapshotFactory _documentSnapshotFactory = documentSnapshotFactory; - protected override bool TryGetVersionedDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out VersionedDocumentContext? documentContext) + protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, VSProjectContext? projectContext, [NotNullWhen(true)] out DocumentContext? documentContext) { if (contextDocumentSnapshot is not RemoteDocumentSnapshot originSnapshot) { @@ -40,12 +40,4 @@ protected override bool TryGetVersionedDocumentContext(IDocumentSnapshot context documentContext = new RemoteDocumentContext(razorDocumentUri, razorDocumentSnapshot); return true; } - - protected override bool TryGetDocumentContext(IDocumentSnapshot contextDocumentSnapshot, Uri razorDocumentUri, [NotNullWhen(true)] out DocumentContext? documentContext) - { - // In OOP there is no difference between versioned and unversioned document contexts. - var result = TryGetVersionedDocumentContext(contextDocumentSnapshot, razorDocumentUri, projectContext: null, out var versionedDocumentContext); - documentContext = versionedDocumentContext; - return result; - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/DocumentContextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/DocumentContextExtensions.cs index bd29cf52ab3..b1213b419f0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/DocumentContextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/DocumentContextExtensions.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor; internal static class DocumentContextExtensions { public static async Task GetGeneratedDocumentAsync( - this VersionedDocumentContext documentContext, + this DocumentContext documentContext, IFilePathService filePathService, CancellationToken cancellationToken) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentContext.cs index bfd3a34bdff..d96a578fb2a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentContext.cs @@ -6,13 +6,13 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; -internal class RemoteDocumentContext : VersionedDocumentContext +internal class RemoteDocumentContext : DocumentContext { public TextDocument TextDocument => ((RemoteDocumentSnapshot)Snapshot).TextDocument; public RemoteDocumentContext(Uri uri, RemoteDocumentSnapshot snapshot) - // HACK: Need to revisit version and projectContext here I guess - : base(uri, snapshot, projectContext: null, version: 1) + // HACK: Need to revisit projectContext here I guess + : base(uri, snapshot, projectContext: null) { } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs index 0449adbc393..36efc36202e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs @@ -34,7 +34,7 @@ internal class RemoteDocumentSnapshot(TextDocument textDocument, RemoteProjectSn public bool SupportsOutput => true; - public int Version => throw new NotImplementedException("We don't expect to use this in cohosting because we do not control generated document creation."); + public int Version => -999; // We don't expect to use this in cohosting, but plenty of existing code logs it's value public Task GetTextAsync() => _textDocument.GetTextAsync(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RemoteCSharpSemanticTokensProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RemoteCSharpSemanticTokensProvider.cs index afd2f6463ab..2823c1a9175 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RemoteCSharpSemanticTokensProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SemanticTokens/RemoteCSharpSemanticTokensProvider.cs @@ -22,7 +22,7 @@ internal class RemoteCSharpSemanticTokensProvider(IFilePathService filePathServi private readonly IFilePathService _filePathService = filePathService; private readonly ITelemetryReporter _telemetryReporter = telemetryReporter; - public async Task GetCSharpSemanticTokensResponseAsync(VersionedDocumentContext documentContext, ImmutableArray csharpRanges, Guid correlationId, CancellationToken cancellationToken) + public async Task GetCSharpSemanticTokensResponseAsync(DocumentContext documentContext, ImmutableArray csharpRanges, Guid correlationId, CancellationToken cancellationToken) { using var _ = _telemetryReporter.TrackLspRequest(nameof(SemanticTokensRange.GetSemanticTokensAsync), Constants.ExternalAccessServerName, correlationId); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs index 1c52c7fd813..1ae779026f7 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs @@ -136,7 +136,6 @@ private async Task> TrySynchronizeV int requiredHostDocumentVersion, TextDocumentIdentifier hostDocument, CancellationToken cancellationToken, - LanguageServer.Protocol.Range? _ = null, bool rejectOnNewerParallelRequest = true, [CallerMemberName] string? caller = null) where TVirtualDocumentSnapshot : VirtualDocumentSnapshot @@ -201,21 +200,6 @@ private async Task> TrySynchronizeV _logger.LogDebug($"{(result.Synchronized ? "Did" : "Did NOT")} synchronize for {caller}: Version {requiredHostDocumentVersion} for {result.VirtualSnapshot?.Uri}"); } - //if (requiredHostDocumentVersion == 1 && - // result.Synchronized && - // result.VirtualSnapshot is not null && - // range is not null) - //{ - // // If we're at version 1, and we're synced, lets make sure the buffer has enough lines to handle the request - // if (range.Start.Line > result.VirtualSnapshot.Snapshot.LineCount || - // range.End.Line > result.VirtualSnapshot.Snapshot.LineCount) - // { - // Debug.Fail("It worked!"); - // _logger.LogWarning($"Requested line ({range.Start.Line} or {range.End.Line}) is out of bounds for {result.VirtualSnapshot.Uri}. Sync failed."); - // return new SynchronizedResult(false, null); - // } - //} - return result; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs index 15b5ae81682..654bb036108 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs @@ -62,8 +62,7 @@ internal partial class RazorCustomMessageTarget var (synchronized, csharpDoc) = await TrySynchronizeVirtualDocumentAsync( semanticTokensParams.RequiredHostDocumentVersion, semanticTokensParams.TextDocument, - cancellationToken, - semanticTokensParams.Ranges.FirstOrDefault()); + cancellationToken); if (csharpDoc is null) { @@ -90,12 +89,12 @@ internal partial class RazorCustomMessageTarget { try { - var result = await _requestInvoker.ReinvokeRequestOnServerAsync( - textBuffer, - lspMethodName, - languageServerName, - requestParams, - cancellationToken).ConfigureAwait(false); + var result = await _requestInvoker.ReinvokeRequestOnServerAsync( + textBuffer, + lspMethodName, + languageServerName, + requestParams, + cancellationToken).ConfigureAwait(false); response = result?.Response; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs index 7f7e31e9747..26b5acd8561 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs @@ -371,7 +371,7 @@ private async Task VerifyCSharpOnAutoInsertAsync(string input, string expected, InsertSpaces = true }, }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(@params.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(@params.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs index 3afd4bc01c2..0fa1e83882d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs @@ -1240,9 +1240,8 @@ private class GenerateMethodResolverDocumentContextFactory : TestDocumentContext public GenerateMethodResolverDocumentContextFactory (string filePath, RazorCodeDocument codeDocument, - TagHelperDescriptor[]? tagHelpers = null, - int? version = null) - : base(filePath, codeDocument, version) + TagHelperDescriptor[]? tagHelpers = null) + : base(filePath, codeDocument) { _tagHelperDescriptors = CreateTagHelperDescriptors(); if (tagHelpers is not null) @@ -1254,7 +1253,6 @@ public GenerateMethodResolverDocumentContextFactory public override bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { if (FilePath is null || CodeDocument is null) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs index e3f63cfb270..e793aa35659 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/CompletionListProviderTest.cs @@ -27,7 +27,7 @@ public class CompletionListProviderTest : LanguageServerTestBase private readonly RazorCompletionListProvider _razorCompletionProvider; private readonly DelegatedCompletionListProvider _delegatedCompletionProvider; private readonly VSInternalCompletionContext _completionContext; - private readonly VersionedDocumentContext _documentContext; + private readonly DocumentContext _documentContext; private readonly VSInternalClientCapabilities _clientCapabilities; public CompletionListProviderTest(ITestOutputHelper testOutput) @@ -38,7 +38,7 @@ public CompletionListProviderTest(ITestOutputHelper testOutput) _razorCompletionProvider = new TestRazorCompletionListProvider(_completionList1, new[] { SharedTriggerCharacter, }, LoggerFactory); _delegatedCompletionProvider = new TestDelegatedCompletionListProvider(_completionList2, new[] { SharedTriggerCharacter, CompletionList2OnlyTriggerCharacter }); _completionContext = new VSInternalCompletionContext(); - _documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", hostDocumentVersion: 0); + _documentContext = TestDocumentContext.From("C:/path/to/file.cshtml"); _clientCapabilities = new VSInternalClientCapabilities(); } @@ -89,7 +89,7 @@ public TestDelegatedCompletionListProvider(VSInternalCompletionList completionLi public override Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, Guid correlationId, CancellationToken cancellationToken) @@ -117,7 +117,7 @@ public TestRazorCompletionListProvider( public override Task GetCompletionListAsync( int absoluteIndex, VSInternalCompletionContext completionContext, - VersionedDocumentContext documentContext, + DocumentContext documentContext, VSInternalClientCapabilities clientCapabilities, HashSet existingCompletions, CancellationToken cancellationToken) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs index 90b3f93b7db..6df70d43a2c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs @@ -51,7 +51,7 @@ public DelegatedCompletionItemResolverTest(ITestOutputHelper testOutput) } }; - var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml"); _csharpCompletionParams = new DelegatedCompletionParams( documentContext.GetTextDocumentIdentifierAndVersion(), VsLspFactory.CreatePosition(10, 6), @@ -222,7 +222,7 @@ private async Task ResolveCompletionItemAsync(string c await using var csharpServer = await CreateCSharpServerAsync(codeDocument); var server = TestDelegatedCompletionItemResolverServer.Create(csharpServer, DisposalToken); - var documentContextFactory = new TestDocumentContextFactory("C:/path/to/file.razor", codeDocument, version: 123); + var documentContextFactory = new TestDocumentContextFactory("C:/path/to/file.razor", codeDocument); var resolver = new DelegatedCompletionItemResolver(documentContextFactory, _formattingService.GetValue(), server); var (containingCompletionList, csharpCompletionParams) = await GetCompletionListAndOriginalParamsAsync( cursorPosition, codeDocument, csharpServer); @@ -268,7 +268,7 @@ private async Task CreateCSharpServerAsync(RazorCodeDocumen CSharpTestLspServer csharpServer) { var completionContext = new VSInternalCompletionContext() { TriggerKind = CompletionTriggerKind.Invoked }; - var documentContext = TestDocumentContext.From("C:/path/to/file.razor", codeDocument, hostDocumentVersion: 1337); + var documentContext = TestDocumentContext.From("C:/path/to/file.razor", codeDocument); var provider = TestDelegatedCompletionListProvider.Create(csharpServer, LoggerFactory, DisposalToken); var completionList = await provider.GetCompletionListAsync( diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs index 66225461c0c..b338d8d03a1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/ResponseRewriterTestBase.cs @@ -27,7 +27,7 @@ private protected async Task GetRewrittenCompletionLis { var completionContext = new VSInternalCompletionContext(); var codeDocument = CreateCodeDocument(documentContent); - var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From("C:/path/to/file.cshtml", codeDocument); var provider = TestDelegatedCompletionListProvider.Create(initialCompletionList, LoggerFactory, rewriter ?? Rewriter); var clientCapabilities = new VSInternalClientCapabilities(); var completionList = await provider.GetCompletionListAsync(absoluteIndex, completionContext, documentContext, clientCapabilities, correlationId: Guid.Empty, cancellationToken: DisposalToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs index cd809b718d3..1f80264a23c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/RazorCompletionListProviderTest.cs @@ -364,7 +364,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletionItems(string var documentPath = "C:/path/to/document.cshtml"; TestFileMarkupParser.GetPosition(documentText, out documentText, out var cursorPosition); var codeDocument = CreateCodeDocument(documentText); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); // Act @@ -385,7 +385,7 @@ public async Task GetCompletionListAsync_ProvidesDirectiveCompletions_Incomplete // Arrange var documentPath = "C:/path/to/document.cshtml"; var codeDocument = CreateCodeDocument("@"); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var completionContext = new VSInternalCompletionContext() { TriggerKind = CompletionTriggerKind.TriggerForIncompleteCompletions, @@ -418,7 +418,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete_KeywordIn() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@in"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -447,7 +447,7 @@ public async Task GetCompletionListAsync_DoesNotProvideInjectOnInvoked() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@inje"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -475,7 +475,7 @@ public async Task GetCompletionListAsync_ProvidesInjectOnIncomplete() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("@inje"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); var completionContext = new VSInternalCompletionContext() { @@ -505,7 +505,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperElementCompletionItems var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("<"); codeDocument.SetTagHelperContext(tagHelperContext); - var documentContext = TestDocumentContext.From(documentPath, codeDocument, hostDocumentVersion: 0); + var documentContext = TestDocumentContext.From(documentPath, codeDocument); var provider = new RazorCompletionListProvider(_completionFactsService, _completionListCache, LoggerFactory); // Act @@ -535,7 +535,7 @@ public async Task GetCompletionListAsync_ProvidesTagHelperAttributeItems() var tagHelperContext = TagHelperDocumentContext.Create(prefix: string.Empty, [tagHelper]); var codeDocument = CreateCodeDocument("(MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs index 2711a8dc359..b844af4ff61 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Definition/DefinitionEndpointDelegationTest.cs @@ -240,7 +240,7 @@ await projectManager.UpdateAsync(updater => var searchEngine = new RazorComponentSearchEngine(projectManager, LoggerFactory); var razorUri = new Uri(razorFilePath); - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(razorUri, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(razorUri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); var endpoint = new DefinitionEndpoint(searchEngine, DocumentMappingService, LanguageServerFeatureOptions, languageServer, LoggerFactory); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs index 61e48cb7880..a202af3d35c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentContextFactoryTest.cs @@ -51,7 +51,7 @@ public void TryCreateForOpenDocumentAsync_CanNotResolveDocument_ReturnsNull() var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act - Assert.False(factory.TryCreateForOpenDocument(uri, out _)); + Assert.False(factory.TryCreate(uri, out _)); } [Fact] @@ -130,10 +130,10 @@ await _projectManager.UpdateAsync(updater => var factory = new DocumentContextFactory(_projectManager, LoggerFactory); // Act - Assert.True(factory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(factory.TryCreate(uri, out var documentContext)); // Assert - Assert.Equal(1, documentContext.Version); + Assert.Equal(1, documentContext.Snapshot.Version); Assert.Equal(uri, documentContext.Uri); Assert.Same(documentSnapshot, documentContext.Snapshot); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs index 060c282439d..655f2796130 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentHighlighting/DocumentHighlightEndpointTest.cs @@ -112,7 +112,7 @@ private async Task VerifyHighlightingRangesAsync(string input) await csharpServer.OpenDocumentAsync(csharpDocumentUri, csharpSourceText.ToString()); var razorFilePath = "C:/path/to/file.razor"; - var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); + var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); var languageServerFeatureOptions = Mock.Of(options => options.SupportsFileManipulation == true && options.SingleServerSupport == true && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs index 100667df822..52ee2ceb54a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs @@ -50,7 +50,7 @@ public async Task Handle_SimpleComponent_ReturnsResult() await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -106,7 +106,7 @@ public async Task Handle_SimpleComponentWithChildFile_ReturnsResult() await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -173,7 +173,7 @@ public async Task Handle_ComponentWithRequiredAttribute_ReturnsResult() await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); @@ -379,7 +379,7 @@ public async Task Handle_ComponentWithNestedFiles_ReturnsResult() await projectManager.UpdateAsync(updater => updater.DocumentOpened(project.Key, razorFilePath, SourceText.From("
"))); var documentSnapshot = projectManager.GetLoadedProject(project.Key).GetDocument(razorFilePath).AssumeNotNull(); var documentContextFactory = new DocumentContextFactory(projectManager, LoggerFactory); - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, null, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, null, out var documentContext)); var clientConnection = new Mock(MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs index f8cbf5683e3..92907ce1842 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs @@ -117,7 +117,7 @@ private async Task VerifyDocumentSymbolsAsync(string input, bool hierarchical = } } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); var result = await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs index ff0cc641c58..8436afc4d0e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/FindReferences/FindAllReferencesEndpointTest.cs @@ -64,7 +64,7 @@ private async Task VerifyCSharpFindAllReferencesAsyncAsync(string input) }, Position = sourceText.GetPosition(cursorPosition) }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs index 4bafb189d06..1cff2a0d10f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Folding/FoldingEndpointTest.cs @@ -222,7 +222,7 @@ private async Task VerifyRazorFoldsAsync(string input, string? filePath = null) } } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 17177a8e49c..bdcdea1996f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -207,7 +207,7 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull Position = VsLspFactory.CreatePosition(2, 11), Options = new FormattingOptions { InsertSpaces = true, TabSize = 4 } }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 25a4ba44e63..cf6fe184229 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -37,7 +37,7 @@ internal class DummyRazorFormattingService : IRazorFormattingService { public bool Called { get; private set; } - public Task FormatAsync(VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) + public Task FormatAsync(DocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) { Called = true; return SpecializedTasks.EmptyArray(); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index a6089dfe1d8..c8bab7fac2d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -77,7 +77,7 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab }; var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); // Act var edits = await formattingService.FormatAsync(documentContext, range, options, DisposalToken); @@ -126,7 +126,7 @@ private protected async Task RunOnTypeFormattingTestAsync( TabSize = tabSize, InsertSpaces = insertSpaces, }; - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); // Act var edits = await formattingService.FormatOnTypeAsync(documentContext, languageKind, Array.Empty(), options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); @@ -194,7 +194,7 @@ protected async Task RunCodeActionFormattingTestAsync( TabSize = tabSize, InsertSpaces = insertSpaces, }; - var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); // Act var edits = await formattingService.FormatCodeActionAsync(documentContext, languageKind, codeActionEdits, options, DisposalToken); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs index d7a1c2bc4a2..411d6405171 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs @@ -871,7 +871,7 @@ private async Task GetResultFromSingleServerEndpointAsync(strin await csharpServer.OpenDocumentAsync(csharpDocumentUri, csharpSourceText.ToString()); var razorFilePath = "C:/path/to/file.razor"; - var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); + var documentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); var languageServerFeatureOptions = Mock.Of(options => options.SupportsFileManipulation == true && options.SingleServerSupport == true && @@ -906,7 +906,7 @@ private async Task GetResultFromSingleServerEndpointAsync(strin return await endpoint.HandleRequestAsync(request, requestContext, DisposalToken); } - private VersionedDocumentContext CreateDefaultDocumentContext() + private DocumentContext CreateDefaultDocumentContext() { var txt = """ @addTagHelper *, TestAssembly @@ -927,9 +927,10 @@ public void Increment(){ d.FilePath == path && d.FileKind == FileKinds.Component && d.GetTextAsync() == Task.FromResult(sourceText) && + d.Version == 0 && d.Project == projectSnapshot, MockBehavior.Strict); - var documentContext = new VersionedDocumentContext(new Uri(path), snapshot, projectContext: null, 1337); + var documentContext = new DocumentContext(new Uri(path), snapshot, projectContext: null); return documentContext; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs index 0dedf24fcda..6ff8c8f61ac 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Implementation/ImplementationEndpointTest.cs @@ -105,7 +105,7 @@ private async Task VerifyCSharpGoToImplementationAsync(string input) }, Position = codeDocument.Source.Text.GetPosition(cursorPosition) }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs index 49e8758c700..9b964c0898a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/InlayHints/InlayHintEndpointTest.cs @@ -106,7 +106,7 @@ private async Task VerifyInlayHintsAsync(string input, Dictionary sourceMappings) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index 271ebda9975..b70530e5cb0 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -61,7 +61,6 @@ public async Task Handle_MapToDocumentRanges_CSharp() // Assert Assert.NotNull(response); Assert.Equal(expectedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -94,7 +93,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_Unmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -127,7 +125,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_LeadingOverlapsUnmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -160,7 +157,6 @@ public async Task Handle_MapToDocumentRanges_CSharp_TrailingOverlapsUnmapped() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -186,7 +182,6 @@ public async Task Handle_MapToDocumentRanges_Html() // Assert Assert.NotNull(response); Assert.Equal(request.ProjectedRanges[0], response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -212,7 +207,6 @@ public async Task Handle_MapToDocumentRanges_Razor() // Assert Assert.NotNull(response); Assert.Equal(request.ProjectedRanges[0], response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } [Fact] @@ -246,7 +240,6 @@ public async Task Handle_MapToDocumentRanges_Unsupported() // Assert Assert.NotNull(response); Assert.Equal(VsLspFactory.UndefinedRange, response!.Ranges[0]); - Assert.Equal(1337, response.HostDocumentVersion); } private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, IEnumerable sourceMappings) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs index 8a17f7af7d4..1ebfb541ed6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/ProjectContexts/ProjectContextsEndpointTest.cs @@ -39,7 +39,7 @@ public async Task GetProjectContexts_ReturnsExpected() } }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument.Uri, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument.Uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); var results = await endpoint.HandleRequestAsync(request, requestContext, default); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs index 620a6bba2fe..e96dbb8b141 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointDelegationTest.cs @@ -86,7 +86,7 @@ await projectManager.UpdateAsync(updater => Position = codeDocument.Source.Text.GetPosition(cursorPosition), NewName = newName }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs index 7f5a35cd276..c4c98a997d8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs @@ -122,7 +122,7 @@ public async Task Handle_Rename_FileManipulationNotSupported_ReturnsNull() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -145,7 +145,7 @@ public async Task Handle_Rename_WithNamespaceDirective() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -186,7 +186,7 @@ public async Task Handle_Rename_OnComponentParameter_ReturnsNull() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -209,7 +209,7 @@ public async Task Handle_Rename_OnOpeningBrace_ReturnsNull() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -232,7 +232,7 @@ public async Task Handle_Rename_OnComponentNameLeadingEdge_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -255,7 +255,7 @@ public async Task Handle_Rename_OnComponentName_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -278,7 +278,7 @@ public async Task Handle_Rename_OnComponentNameTrailingEdge_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -301,7 +301,7 @@ public async Task Handle_Rename_ComponentInSameFile() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -387,7 +387,7 @@ public async Task Handle_Rename_FullyQualifiedAndNot() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -433,7 +433,7 @@ public async Task Handle_Rename_MultipleFileUsages() NewName = "Component5" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -486,7 +486,7 @@ public async Task Handle_Rename_DifferentDirectories() NewName = "TestComponent" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -557,7 +557,7 @@ public async Task Handle_Rename_SingleServer_CallsDelegatedLanguageServer() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act @@ -597,7 +597,7 @@ public async Task Handle_Rename_SingleServer_DoesNotDelegateForRazor() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(request.TextDocument.Uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(request.TextDocument.Uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs index 0bcf1c28d4e..748262ec53a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs @@ -919,7 +919,7 @@ private async Task AssertSemanticTokensAsync( AssertSemanticTokensMatchesBaseline(sourceText, tokens, testName.AssumeNotNull()); } - private static VersionedDocumentContext CreateDocumentContext( + private static DocumentContext CreateDocumentContext( string documentText, bool isRazorFile, ImmutableArray tagHelpers, @@ -942,16 +942,18 @@ private static VersionedDocumentContext CreateDocumentContext( documentSnapshotMock .Setup(x => x.GetTextAsync()) .ReturnsAsync(document.Source.Text); + documentSnapshotMock + .SetupGet(x => x.Version) + .Returns(version); - return new VersionedDocumentContext( + return new DocumentContext( uri: new Uri($@"c:\${GetFileName(isRazorFile)}"), snapshot: documentSnapshotMock.Object, - projectContext: null, - version); + projectContext: null); } private async Task CreateServiceAsync( - VersionedDocumentContext documentSnapshot, + DocumentContext documentSnapshot, ProvideSemanticTokensResponse? csharpTokens, bool withCSharpBackground, bool serverSupportsPreciseRanges, @@ -1198,12 +1200,11 @@ private static string GetFileRepresentationOfTokens(SourceText sourceText, int[] return builder.ToString(); } - private class TestDocumentContextFactory(VersionedDocumentContext? documentContext = null) : IDocumentContextFactory + private class TestDocumentContextFactory(DocumentContext? documentContext = null) : IDocumentContextFactory { public bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { context = documentContext; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs index b794fc1ece3..646b2085413 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SignatureHelp/SignatureHelpEndpointTest.cs @@ -113,7 +113,7 @@ private async Task VerifySignatureHelpWithContextAndOptionsAsync(string input, R Context = signatureHelpContext }; - Assert.True(DocumentContextFactory.TryCreateForOpenDocument(request.TextDocument, out var documentContext)); + Assert.True(DocumentContextFactory.TryCreate(request.TextDocument, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs index 4b2e2f3e871..49c4fbb7423 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SingleServerDelegatingEndpointTestBase.cs @@ -56,7 +56,7 @@ private protected async Task CreateLanguageServerAsync( } } - DocumentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument, version: 1337); + DocumentContextFactory = new TestDocumentContextFactory(razorFilePath, codeDocument); LanguageServerFeatureOptions = Mock.Of(options => options.SupportsFileManipulation == true && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs index e7e0f6e87e2..95ab0722b98 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/LanguageServerTestBase.cs @@ -58,7 +58,7 @@ private protected TestProjectSnapshotManager CreateProjectSnapshotManager( initializer: static updater => updater.ProjectAdded(MiscFilesHostProject.Instance)); private protected static RazorRequestContext CreateRazorRequestContext( - VersionedDocumentContext? documentContext, + DocumentContext? documentContext, ILspServices? lspServices = null) => new(documentContext, lspServices ?? StrictMock.Of(), "lsp/method", uri: null); @@ -108,9 +108,9 @@ private protected static IDocumentContextFactory CreateDocumentContextFactory(Ur return CreateDocumentContextFactory(documentPath, codeDocument); } - private protected static VersionedDocumentContext CreateDocumentContext(Uri documentPath, RazorCodeDocument codeDocument) + private protected static DocumentContext CreateDocumentContext(Uri documentPath, RazorCodeDocument codeDocument) { - return TestDocumentContext.From(documentPath.GetAbsoluteOrUNCPath(), codeDocument, hostDocumentVersion: 1337); + return TestDocumentContext.From(documentPath.GetAbsoluteOrUNCPath(), codeDocument); } private protected static IDocumentContextFactory CreateDocumentContextFactory( @@ -119,15 +119,15 @@ private protected static IDocumentContextFactory CreateDocumentContextFactory( bool documentFound = true) { var documentContextFactory = documentFound - ? new TestDocumentContextFactory(documentPath.GetAbsoluteOrUNCPath(), codeDocument, version: 1337) + ? new TestDocumentContextFactory(documentPath.GetAbsoluteOrUNCPath(), codeDocument) : new TestDocumentContextFactory(); return documentContextFactory; } - private protected static VersionedDocumentContext CreateDocumentContext(Uri uri, IDocumentSnapshot snapshot) + private protected static DocumentContext CreateDocumentContext(Uri uri, IDocumentSnapshot snapshot) { - return new VersionedDocumentContext(uri, snapshot, projectContext: null, version: 0); + return new DocumentContext(uri, snapshot, projectContext: null); } private protected static RazorLSPOptionsMonitor GetOptionsMonitor(bool enableFormatting = true, bool autoShowCompletion = true, bool autoListParams = true, bool formatOnType = true, bool autoInsertAttributeQuotes = true, bool colorBackground = false, bool codeBlockBraceOnNextLine = false, bool commitElementsWithSpace = true) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs index 27d2273b814..e6e60acffe2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContext.cs @@ -19,13 +19,13 @@ public static DocumentContext Create(Uri uri, string text) return new DocumentContext(uri, snapshot, projectContext: null); } - public static VersionedDocumentContext From(string filePath, RazorCodeDocument codeDocument, int hostDocumentVersion) + public static DocumentContext From(string filePath, RazorCodeDocument codeDocument, int hostDocumentVersion) { var content = codeDocument.Source.Text.ToString(); - var documentSnapshot = TestDocumentSnapshot.Create(filePath, content); + var documentSnapshot = TestDocumentSnapshot.Create(filePath, content, hostDocumentVersion); documentSnapshot.With(codeDocument); var uri = new Uri(filePath); - return new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, hostDocumentVersion); + return new DocumentContext(uri, documentSnapshot, projectContext: null); } public static DocumentContext From(string filePath, RazorCodeDocument codeDocument) @@ -45,7 +45,7 @@ public static DocumentContext From(string filePath) return From(filePath, codeDocument); } - public static VersionedDocumentContext From(string filePath, int hostDocumentVersion) + public static DocumentContext From(string filePath, int hostDocumentVersion) { var properties = RazorSourceDocumentProperties.Create(filePath, filePath); var sourceDocument = RazorSourceDocument.Create(content: string.Empty, properties); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs index 591df7ed021..7a0aa4ba27d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/LanguageServer/TestDocumentContextFactory.cs @@ -13,23 +13,20 @@ internal class TestDocumentContextFactory : IDocumentContextFactory { private protected readonly string? FilePath; private protected readonly RazorCodeDocument? CodeDocument; - private readonly int? _version; public TestDocumentContextFactory() { } - public TestDocumentContextFactory(string filePath, RazorCodeDocument codeDocument, int? version = null) + public TestDocumentContextFactory(string filePath, RazorCodeDocument codeDocument) { FilePath = filePath; CodeDocument = codeDocument; - _version = version; } public virtual bool TryCreate( Uri documentUri, VSProjectContext? projectContext, - bool versioned, [NotNullWhen(true)] out DocumentContext? context) { if (FilePath is null || CodeDocument is null) @@ -38,18 +35,6 @@ public virtual bool TryCreate( return false; } - if (versioned) - { - if (_version is null) - { - context = null; - return false; - } - - context = TestDocumentContext.From(FilePath, CodeDocument, _version.Value); - return true; - } - context = TestDocumentContext.From(FilePath, CodeDocument); return true; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs index a419a5bff05..1f86e7fe5ce 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs @@ -23,13 +23,13 @@ public static TestDocumentSnapshot Create(string filePath) public static TestDocumentSnapshot Create(string filePath, VersionStamp version) => Create(filePath, string.Empty, version); - public static TestDocumentSnapshot Create(string filePath, string text) - => Create(filePath, text, VersionStamp.Default); + public static TestDocumentSnapshot Create(string filePath, string text, int version = 0) + => Create(filePath, text, VersionStamp.Default, numericVersion: version); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, ProjectWorkspaceState? projectWorkspaceState = null) - => Create(filePath, text, version, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState)); + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, ProjectWorkspaceState? projectWorkspaceState = null, int numericVersion = 0) + => Create(filePath, text, version, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState), numericVersion); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, TestProjectSnapshot projectSnapshot) + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, TestProjectSnapshot projectSnapshot, int numericVersion) { var targetPath = Path.GetDirectoryName(projectSnapshot.FilePath) is string projectDirectory && filePath.StartsWith(projectDirectory) ? filePath[projectDirectory.Length..] @@ -41,7 +41,7 @@ public static TestDocumentSnapshot Create(string filePath, string text, VersionS hostDocument, SourceText.From(text), version, - 1, + numericVersion, () => Task.FromResult(TextAndVersion.Create(sourceText, version))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); From 4fe2eff346d1e0a2b76f2b8dd5ffaf41f8785b7d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 12 Aug 2024 14:01:06 +1000 Subject: [PATCH 088/271] Expand testing slightly --- ...rTest.cs => ProjectSnapshotManagerTest.cs} | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) rename src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/{DefaultProjectSnapshotManagerTest.cs => ProjectSnapshotManagerTest.cs} (96%) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs similarity index 96% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs index 60c229fa704..62b66ef903e 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/DefaultProjectSnapshotManagerTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/ProjectSnapshotManagerTest.cs @@ -22,7 +22,7 @@ namespace Microsoft.VisualStudio.Razor.ProjectSystem; -public class DefaultProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase +public class ProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase { private static readonly HostDocument[] s_documents = [ @@ -52,7 +52,7 @@ public class DefaultProjectSnapshotManagerTest : VisualStudioWorkspaceTestBase private readonly TestProjectSnapshotManager _projectManager; private readonly SourceText _sourceText; - public DefaultProjectSnapshotManagerTest(ITestOutputHelper testOutput) + public ProjectSnapshotManagerTest(ITestOutputHelper testOutput) : base(testOutput) { var someTagHelpers = ImmutableArray.Create( @@ -191,6 +191,8 @@ await _projectManager.UpdateAsync(updater => filePath => filePath == s_documents[0].FilePath); listener.AssertNoNotifications(); + + Assert.Equal(1, project.GetDocument(s_documents[0].FilePath)!.Version); } [UIFact] @@ -469,6 +471,8 @@ await _projectManager.UpdateAsync(updater => Assert.Same(_sourceText, text); Assert.True(_projectManager.IsDocumentOpen(s_documents[0].FilePath)); + + Assert.Equal(2, document.Version); } [UIFact] @@ -505,6 +509,7 @@ await _projectManager.UpdateAsync(updater => var text = await document.GetTextAsync(); Assert.Same(expected, text); Assert.False(_projectManager.IsDocumentOpen(s_documents[0].FilePath)); + Assert.Equal(3, document.Version); } [UIFact] @@ -569,6 +574,7 @@ await _projectManager.UpdateAsync(updater => Assert.NotNull(document); var text = await document.GetTextAsync(); Assert.Same(expected, text); + Assert.Equal(3, document.Version); } [UIFact] @@ -602,6 +608,7 @@ await _projectManager.UpdateAsync(updater => Assert.NotNull(document); var text = await document.GetTextAsync(); Assert.Same(expected, text); + Assert.Equal(3, document.Version); } [UIFact] @@ -749,6 +756,29 @@ await _projectManager.UpdateAsync(updater => listener.AssertNoNotifications(); } + [UIFact] + public async Task ProjectWorkspaceStateChanged_UpdateDocuments() + { + // Arrange + await _projectManager.UpdateAsync(updater => + { + updater.ProjectAdded(s_hostProject); + updater.DocumentAdded(s_hostProject.Key, s_documents[0], null!); + }); + + // Act + await _projectManager.UpdateAsync(updater => + { + updater.ProjectWorkspaceStateChanged(s_hostProject.Key, _projectWorkspaceStateWithTagHelpers); + }); + + // Assert + var document = _projectManager.GetLoadedProject(s_hostProject.Key).GetDocument(s_documents[0].FilePath); + + Assert.NotNull(document); + Assert.Equal(2, document.Version); + } + [UIFact] public async Task ProjectWorkspaceStateChanged_WithHostProject_FirstTime_NotifiesListeners() { From 061347e1adc856f3dc6a6ee357d8546b57154309 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 12 Aug 2024 14:01:12 +1000 Subject: [PATCH 089/271] Minor logging cleanup --- .../Diagnostics/RazorDiagnosticsPublisher.cs | 6 +---- .../GeneratedDocumentPublisher.cs | 24 +++++-------------- 2 files changed, 7 insertions(+), 23 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs index e3f0eb8d901..1f3320294e5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/RazorDiagnosticsPublisher.cs @@ -155,11 +155,7 @@ .. csharpDiagnostics ?? [] PublishDiagnosticsForFilePath(document.FilePath, combinedDiagnostics); - if (_logger.IsEnabled(LogLevel.Trace)) - { - var diagnosticString = string.Join(", ", razorDiagnostics.Select(diagnostic => diagnostic.Id)); - _logger.LogTrace($"Publishing diagnostics for document '{document.FilePath}': {diagnosticString}"); - } + _logger.LogTrace($"Publishing diagnostics for document '{document.FilePath}': {string.Join(", ", razorDiagnostics.Select(diagnostic => diagnostic.Id))}"); async Task GetCSharpDiagnosticsAsync(IDocumentSnapshot document, CancellationToken token) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 4799f85575e..578706da84f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -79,16 +79,10 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou return; } - if (_logger.IsEnabled(LogLevel.Trace)) - { - var previousDocumentLength = previouslyPublishedData.SourceText.Length; - var currentDocumentLength = sourceText.Length; - var documentLengthDelta = sourceText.Length - previousDocumentLength; - _logger.LogTrace( - $"Updating C# buffer of {filePath} for project {documentKey.ProjectKey} to correspond with host document " + - $"version {hostDocumentVersion}. {previousDocumentLength} -> {currentDocumentLength} = Change delta of " + - $"{documentLengthDelta} via {textChanges.Count} text changes."); - } + _logger.LogTrace( + $"Updating C# buffer of {filePath} for project {documentKey.ProjectKey} to correspond with host document " + + $"version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of " + + $"{sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Count} text changes."); _publishedCSharpData[documentKey] = new PublishData(sourceText, hostDocumentVersion); } @@ -124,14 +118,8 @@ public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourc return; } - if (_logger.IsEnabled(LogLevel.Trace)) - { - var previousDocumentLength = previouslyPublishedData.SourceText.Length; - var currentDocumentLength = sourceText.Length; - var documentLengthDelta = sourceText.Length - previousDocumentLength; - _logger.LogTrace( - $"Updating HTML buffer of {filePath} to correspond with host document version {hostDocumentVersion}. {previousDocumentLength} -> {currentDocumentLength} = Change delta of {documentLengthDelta} via {textChanges.Count} text changes."); - } + _logger.LogTrace( + $"Updating HTML buffer of {filePath} to correspond with host document version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of {sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Count} text changes."); _publishedHtmlData[filePath] = new PublishData(sourceText, hostDocumentVersion); } From 6a166dedddbfa49ae81dd5e400ef9c96a2cfea7f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 13 Aug 2024 09:53:12 +1000 Subject: [PATCH 090/271] Remove unused using --- .../Endpoints/RazorCustomMessageTarget_SemanticTokens.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs index 654bb036108..1133cdb6164 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_SemanticTokens.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Diagnostics; using System.Linq; using System.Threading; From 374e85cb336aa71ad897507ade183d2d6c96e0cd Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 16 Aug 2024 11:56:48 +1000 Subject: [PATCH 091/271] Don't allow virtual documents to go back in time --- .../GeneratedDocumentPublisher.cs | 20 +++++++++++++++++-- .../Endpoints/RazorCustomMessageTarget.cs | 4 ++-- ...zorCustomMessageTarget_UpdateHtmlBuffer.cs | 4 ++++ 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 578706da84f..81a34f72030 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -72,6 +72,14 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou previouslyPublishedData = PublishData.Default; } + if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) + { + // We've already published a newer version of this document. No-op. + Debug.Fail("C# document being published that is older than one we've previously published!"); + _logger.LogWarning($"Skipping publish of C# for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); + return; + } + textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); if (textChanges.Count == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) { @@ -79,7 +87,7 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou return; } - _logger.LogTrace( + _logger.LogDebug( $"Updating C# buffer of {filePath} for project {documentKey.ProjectKey} to correspond with host document " + $"version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of " + $"{sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Count} text changes."); @@ -111,6 +119,14 @@ public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourc previouslyPublishedData = PublishData.Default; } + if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) + { + // We've already published a newer version of this document. No-op. + Debug.Fail("Html document being published that is older than one we've previously published!"); + _logger.LogWarning($"Skipping publish of Html for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); + return; + } + textChanges = SourceTextDiffer.GetMinimalTextChanges(previouslyPublishedData.SourceText, sourceText); if (textChanges.Count == 0 && hostDocumentVersion == previouslyPublishedData.HostDocumentVersion) { @@ -118,7 +134,7 @@ public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourc return; } - _logger.LogTrace( + _logger.LogDebug( $"Updating HTML buffer of {filePath} to correspond with host document version {hostDocumentVersion}. {previouslyPublishedData.SourceText.Length} -> {sourceText.Length} = Change delta of {sourceText.Length - previouslyPublishedData.SourceText.Length} via {textChanges.Count} text changes."); _publishedHtmlData[filePath] = new PublishData(sourceText, hostDocumentVersion); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs index 1ae779026f7..854c9fe04a6 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs @@ -146,6 +146,8 @@ private async Task> TrySynchronizeV return await TempForCohost_TrySynchronizeVirtualDocumentAsync(hostDocument, cancellationToken); } + _logger.LogDebug($"Trying to synchronize for {caller} to version {requiredHostDocumentVersion} of {hostDocument.Uri} for {hostDocument.GetProjectContext()?.Id ?? "(no project context)"}"); + // For Html documents we don't do anything fancy, just call the standard service // If we're not generating unique document file names, then we can treat C# documents the same way if (!_languageServerFeatureOptions.IncludeProjectKeyInGeneratedFilePath || @@ -154,8 +156,6 @@ private async Task> TrySynchronizeV return await _documentSynchronizer.TrySynchronizeVirtualDocumentAsync(requiredHostDocumentVersion, hostDocument.Uri, cancellationToken).ConfigureAwait(false); } - _logger.LogDebug($"Trying to synchronize for {caller} to version {requiredHostDocumentVersion} of {hostDocument.Uri} for {hostDocument.GetProjectContext()?.Id ?? "(no project context)"}"); - var virtualDocument = FindVirtualDocument(hostDocument.Uri, hostDocument.GetProjectContext()); if (virtualDocument is { ProjectKey.IsUnknown: true }) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateHtmlBuffer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateHtmlBuffer.cs index 0bf10cdcdb6..b2c366890ff 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateHtmlBuffer.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateHtmlBuffer.cs @@ -5,6 +5,7 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using StreamJsonRpc; @@ -35,6 +36,9 @@ internal void UpdateHtmlBuffer(UpdateBufferRequest request) } var hostDocumentUri = new Uri(request.HostDocumentFilePath); + + _logger.LogDebug($"UpdateHtmlBuffer for {request.HostDocumentVersion} of {hostDocumentUri} in {request.ProjectKeyId}"); + _documentManager.UpdateVirtualDocument( hostDocumentUri, request.Changes.Select(change => change.ToVisualStudioTextChange()).ToArray(), From b05dd12a2ae0c88af2b69799e6bbe2281340d442 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 16 Aug 2024 12:14:17 +0000 Subject: [PATCH 092/271] Failed to perform coherency update for one or more dependencies. From b81f3ebf438b2a3f7f112642bad415542dc6696d Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 17 Aug 2024 12:42:47 +0000 Subject: [PATCH 093/271] Update dependencies from https://github.com/dotnet/arcade build 20240816.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24414.3 -> To Version 9.0.0-beta.24416.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e888013264e..6bed5d53c03 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba
- + https://github.com/dotnet/arcade - 4d15f8d1f2d61f6513b70f0bcd4bd3c1828a3a68 + 8fe02bab989df1265eee225df2c28af6dbdccc83 - + https://github.com/dotnet/arcade - 4d15f8d1f2d61f6513b70f0bcd4bd3c1828a3a68 + 8fe02bab989df1265eee225df2c28af6dbdccc83 diff --git a/eng/Versions.props b/eng/Versions.props index 3b6f2e471ab..d9e34073baf 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24414.3 + 9.0.0-beta.24416.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index c545052a5aa..ad54b2f3d29 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24414.3", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24416.2", "Microsoft.Build.NoTargets": "3.7.0" } } From e5cff02313bcf417de2e4e379b7d5bee9eb79a08 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 18 Aug 2024 12:04:41 +0000 Subject: [PATCH 094/271] Failed to perform coherency update for one or more dependencies. From af13ebdf10eda2a9d7f7b4c0a5522da4bd1bf418 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 19 Aug 2024 15:19:18 +1000 Subject: [PATCH 095/271] PR feedback - sorta --- .../GeneratedDocumentSynchronizer.cs | 12 ++++- .../GeneratedDocumentSynchronizerTest.cs | 52 +++++++++++++++++-- .../TestLanguageServerFeatureOptions.cs | 5 +- 3 files changed, 62 insertions(+), 7 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs index b3a01451ce5..d057edfc632 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentSynchronizer.cs @@ -9,17 +9,25 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; internal class GeneratedDocumentSynchronizer( IGeneratedDocumentPublisher publisher, - LanguageServerFeatureOptions languageServerFeatureOptions) : IDocumentProcessedListener + LanguageServerFeatureOptions languageServerFeatureOptions, + IProjectSnapshotManager projectManager) : IDocumentProcessedListener { private readonly IGeneratedDocumentPublisher _publisher = publisher; private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; + private readonly IProjectSnapshotManager _projectManager = projectManager; public void DocumentProcessed(RazorCodeDocument codeDocument, IDocumentSnapshot document) { var hostDocumentVersion = document.Version; - var filePath = document.FilePath.AssumeNotNull(); + // If the document isn't open, and we're not updating buffers for closed documents, then we don't need to do anything. + if (!_projectManager.IsDocumentOpen(document.FilePath) && + !_languageServerFeatureOptions.UpdateBuffersForClosedDocuments) + { + return; + } + // If cohosting is on, then it is responsible for updating the Html buffer if (!_languageServerFeatureOptions.UseRazorCohostServer) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs index 7805abd04b1..bba790b36ae 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/GeneratedDocumentSynchronizerTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -15,8 +16,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; public class GeneratedDocumentSynchronizerTest : LanguageServerTestBase { + private static readonly HostProject s_hostProject = new("/path/to/project.csproj", "/path/to/obj", RazorConfiguration.Default, "TestRootNamespace"); + private static readonly HostDocument s_hostDocument = new("/path/to/file.razor", "file.razor"); + private readonly GeneratedDocumentSynchronizer _synchronizer; private readonly TestGeneratedDocumentPublisher _publisher; + private readonly TestProjectSnapshotManager _projectManager; private readonly IDocumentSnapshot _document; private readonly RazorCodeDocument _codeDocument; @@ -24,14 +29,30 @@ public GeneratedDocumentSynchronizerTest(ITestOutputHelper testOutput) : base(testOutput) { _publisher = new TestGeneratedDocumentPublisher(); - _synchronizer = new GeneratedDocumentSynchronizer(_publisher, TestLanguageServerFeatureOptions.Instance); - _document = TestDocumentSnapshot.Create("C:/path/to/file.razor"); + _projectManager = CreateProjectSnapshotManager(); + _synchronizer = new GeneratedDocumentSynchronizer(_publisher, TestLanguageServerFeatureOptions.Instance, _projectManager); + _document = TestDocumentSnapshot.Create(s_hostDocument.FilePath); _codeDocument = CreateCodeDocument("

Hello World

"); } + protected override async Task InitializeAsync() + { + await _projectManager.UpdateAsync(updater => + { + updater.ProjectAdded(s_hostProject); + updater.DocumentAdded(s_hostProject.Key, s_hostDocument, new EmptyTextLoader(s_hostDocument.FilePath)); + }); + } + [Fact] - public void DocumentProcessed_KnownVersion_Publishes() + public async Task DocumentProcessed_OpenDocument_Publishes() { + // Arrange + await _projectManager.UpdateAsync(updater => + { + updater.DocumentOpened(s_hostProject.Key, s_hostDocument.FilePath, SourceText.From("

Hello World

")); + }); + // Act _synchronizer.DocumentProcessed(_codeDocument, _document); @@ -40,6 +61,31 @@ public void DocumentProcessed_KnownVersion_Publishes() Assert.True(_publisher.PublishedHtml); } + [Fact] + public void DocumentProcessed_CloseDocument_WithOption_Publishes() + { + var options = new TestLanguageServerFeatureOptions(updateBuffersForClosedDocuments: true); + var synchronizer = new GeneratedDocumentSynchronizer(_publisher, options, _projectManager); + + // Act + synchronizer.DocumentProcessed(_codeDocument, _document); + + // Assert + Assert.True(_publisher.PublishedCSharp); + Assert.True(_publisher.PublishedHtml); + } + + [Fact] + public void DocumentProcessed_CloseDocument_DoesntPublish() + { + // Act + _synchronizer.DocumentProcessed(_codeDocument, _document); + + // Assert + Assert.False(_publisher.PublishedCSharp); + Assert.False(_publisher.PublishedHtml); + } + private class TestGeneratedDocumentPublisher : IGeneratedDocumentPublisher { public bool PublishedCSharp { get; private set; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs index 8d8c9786f81..6e4babb9bc2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Workspaces/TestLanguageServerFeatureOptions.cs @@ -7,7 +7,8 @@ namespace Microsoft.AspNetCore.Razor.Test.Common.Workspaces; internal class TestLanguageServerFeatureOptions( bool includeProjectKeyInGeneratedFilePath = false, - bool forceRuntimeCodeGeneration = false) : LanguageServerFeatureOptions + bool forceRuntimeCodeGeneration = false, + bool updateBuffersForClosedDocuments = false) : LanguageServerFeatureOptions { public static readonly LanguageServerFeatureOptions Instance = new TestLanguageServerFeatureOptions(); @@ -27,7 +28,7 @@ internal class TestLanguageServerFeatureOptions( public override bool UsePreciseSemanticTokenRanges => true; - public override bool UpdateBuffersForClosedDocuments => false; + public override bool UpdateBuffersForClosedDocuments => updateBuffersForClosedDocuments; public override bool IncludeProjectKeyInGeneratedFilePath => includeProjectKeyInGeneratedFilePath; From 3bffce365f0f796044755f6ce97278d3536f0c00 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 19 Aug 2024 12:52:10 +0000 Subject: [PATCH 096/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240815.3 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 9.0.0-alpha.1.24405.2 -> To Version 10.0.0-alpha.1.24415.3 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b9901fbfdc4..4d8fce7e46b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10
- + https://github.com/dotnet/source-build-reference-packages - 0d066e61a30c2599d0ced871ea45acf0e10571af + e9c7c7740133e6e4f92d22d0410a379a8f2d24e7 diff --git a/eng/Versions.props b/eng/Versions.props index ffa20a9acee..02cd78c401b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 9.0.0-alpha.1.24405.2 + 10.0.0-alpha.1.24415.3 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 80d1ed36ee190e56641500a6890874e427e5686a Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 11:30:02 -0700 Subject: [PATCH 097/271] Merge CodeRenderingContext and DefaultCodeRenderingContext --- .../DesignTimeNodeWriterTest.cs | 6 +- .../DefaultTagHelperTargetExtensionTest.cs | 2 +- ...reallocatedAttributeTargetExtensionTest.cs | 2 +- .../CodeGeneration/CodeRenderingContext.cs | 214 +++++++++++++++-- .../DefaultCodeRenderingContext.cs | 227 ------------------ .../CodeGeneration/DefaultDocumentWriter.cs | 8 +- .../TestCodeRenderingContext.cs | 4 +- 7 files changed, 207 insertions(+), 256 deletions(-) delete mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs index 1724a5ad318..cb41431080b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs @@ -58,7 +58,7 @@ public void WriteUsingDirective_WithSource_WritesContentWithLinePragmaAndMapping writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + var mapping = Assert.Single(context.SourceMappings); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -94,7 +94,7 @@ public void WriteUsingDirective_WithSourceAndLineDirectives_WritesContentWithLin writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + var mapping = Assert.Single(context.SourceMappings); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -587,7 +587,7 @@ public void LinePragma_Enhanced_Is_Adjusted_On_Windows(string fileName, string e csharp, ignoreLineEndingDifferences: true); - Assert.Single(((DefaultCodeRenderingContext)context).SourceMappings); + Assert.Single(context.SourceMappings); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs index b4db68fecc6..937e8ccbfbc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs @@ -1148,7 +1148,7 @@ public void GetDeterministicId_IsDeterministic() private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - ((DefaultCodeRenderingContext)context).AncestorsInternal.Push(node); + context.AncestorsInternal.Push(node); } private static TagHelperDescriptor CreateTagHelperDescriptor( diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs index 4dc46aa39d1..f0ca482b667 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs @@ -273,6 +273,6 @@ public void WriteSetPreallocatedTagHelperProperty_IndexerAttribute_MultipleValue private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - ((DefaultCodeRenderingContext)context).AncestorsInternal.Push(node); + context.AncestorsInternal.Push(node); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 4b005b08902..751c5cf9717 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -5,49 +5,227 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Intermediate; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; -public abstract class CodeRenderingContext : IDisposable +public sealed class CodeRenderingContext : IDisposable { internal static readonly object NewLineString = "NewLineString"; internal static readonly object SuppressUniqueIds = "SuppressUniqueIds"; - public abstract IEnumerable Ancestors { get; } + private readonly Stack _ancestors; + private readonly RazorCodeDocument _codeDocument; + private readonly DocumentIntermediateNode _documentNode; + private readonly List _scopes; - public abstract CodeWriter CodeWriter { get; } + private readonly PooledObject.Builder> _sourceMappingsBuilder; - public abstract RazorDiagnosticCollection Diagnostics { get; } + public CodeRenderingContext( + IntermediateNodeWriter nodeWriter, + RazorCodeDocument codeDocument, + DocumentIntermediateNode documentNode, + RazorCodeGenerationOptions options) + { + if (nodeWriter == null) + { + throw new ArgumentNullException(nameof(nodeWriter)); + } + + if (codeDocument == null) + { + throw new ArgumentNullException(nameof(codeDocument)); + } + + if (documentNode == null) + { + throw new ArgumentNullException(nameof(documentNode)); + } + + if (options == null) + { + throw new ArgumentNullException(nameof(options)); + } + + _codeDocument = codeDocument; + _documentNode = documentNode; + Options = options; + + _ancestors = new Stack(); + Diagnostics = new RazorDiagnosticCollection(); + Items = new ItemCollection(); + _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); + LinePragmas = new List(); + + var diagnostics = _documentNode.GetAllDiagnostics(); + for (var i = 0; i < diagnostics.Count; i++) + { + Diagnostics.Add(diagnostics[i]); + } + + // Set new line character to a specific string regardless of platform, for testing purposes. + var newLineString = codeDocument.Items[NewLineString] as string ?? Environment.NewLine; + CodeWriter = new CodeWriter(newLineString, options); + + Items[NewLineString] = codeDocument.Items[NewLineString]; + Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; + + _scopes = new List(); + _scopes.Add(new ScopeInternal(nodeWriter)); + } + + // This will be initialized by the document writer when the context is 'live'. + public IntermediateNodeVisitor Visitor { get; set; } - public abstract string DocumentKind { get; } + public IEnumerable Ancestors => _ancestors; - public abstract ItemCollection Items { get; } + internal Stack AncestorsInternal => _ancestors; - public abstract IntermediateNodeWriter NodeWriter { get; } + public CodeWriter CodeWriter { get; } - public abstract RazorCodeGenerationOptions Options { get; } + public RazorDiagnosticCollection Diagnostics { get; } - public abstract IntermediateNode Parent { get; } + public string DocumentKind => _documentNode.DocumentKind; - public abstract RazorSourceDocument SourceDocument { get; } + public ItemCollection Items { get; } - public abstract void AddSourceMappingFor(IntermediateNode node); + public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; - public abstract void AddSourceMappingFor(SourceSpan node, int offset = 0); + internal List LinePragmas { get; } - public abstract void RenderNode(IntermediateNode node); + public IntermediateNodeWriter NodeWriter => Current.Writer; - public abstract void RenderNode(IntermediateNode node, IntermediateNodeWriter writer); + public RazorCodeGenerationOptions Options { get; } - public abstract void RenderChildren(IntermediateNode node); + public IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); - public abstract void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer); + public RazorSourceDocument SourceDocument => _codeDocument.Source; + + private ScopeInternal Current => _scopes[_scopes.Count - 1]; + + public void AddSourceMappingFor(IntermediateNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + if (node.Source == null) + { + return; + } + + AddSourceMappingFor(node.Source.Value); + } + + public void AddSourceMappingFor(SourceSpan source, int offset = 0) + { + if (SourceDocument.FilePath != null && + !string.Equals(SourceDocument.FilePath, source.FilePath, StringComparison.OrdinalIgnoreCase)) + { + // We don't want to generate line mappings for imports. + return; + } + + var currentLocation = CodeWriter.Location with { AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, CharacterIndex = CodeWriter.Location.CharacterIndex + offset }; + + var generatedLocation = new SourceSpan(currentLocation, source.Length); + var sourceMapping = new SourceMapping(source, generatedLocation); + + SourceMappings.Add(sourceMapping); + } + + public void RenderChildren(IntermediateNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + _ancestors.Push(node); + + for (var i = 0; i < node.Children.Count; i++) + { + Visitor.Visit(node.Children[i]); + } + + _ancestors.Pop(); + } - public virtual void AddLinePragma(LinePragma linePragma) + public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + _scopes.Add(new ScopeInternal(writer)); + _ancestors.Push(node); + + for (var i = 0; i < node.Children.Count; i++) + { + Visitor.Visit(node.Children[i]); + } + + _ancestors.Pop(); + _scopes.RemoveAt(_scopes.Count - 1); } - public abstract void Dispose(); + public void RenderNode(IntermediateNode node) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + Visitor.Visit(node); + } + + public void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) + { + if (node == null) + { + throw new ArgumentNullException(nameof(node)); + } + + if (writer == null) + { + throw new ArgumentNullException(nameof(writer)); + } + + _scopes.Add(new ScopeInternal(writer)); + + Visitor.Visit(node); + + _scopes.RemoveAt(_scopes.Count - 1); + } + + public void AddLinePragma(LinePragma linePragma) + { + LinePragmas.Add(linePragma); + } + + public void Dispose() + { + _sourceMappingsBuilder.Dispose(); + CodeWriter.Dispose(); + } + + private struct ScopeInternal + { + public ScopeInternal(IntermediateNodeWriter writer) + { + Writer = writer; + } + + public IntermediateNodeWriter Writer { get; } + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs deleted file mode 100644 index 0769b7045eb..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultCodeRenderingContext.cs +++ /dev/null @@ -1,227 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.Language.Intermediate; -using Microsoft.AspNetCore.Razor.PooledObjects; - -namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -internal class DefaultCodeRenderingContext : CodeRenderingContext -{ - private readonly Stack _ancestors; - private readonly RazorCodeDocument _codeDocument; - private readonly DocumentIntermediateNode _documentNode; - private readonly List _scopes; - - private readonly PooledObject.Builder> _sourceMappingsBuilder; - - public DefaultCodeRenderingContext( - IntermediateNodeWriter nodeWriter, - RazorCodeDocument codeDocument, - DocumentIntermediateNode documentNode, - RazorCodeGenerationOptions options) - { - if (nodeWriter == null) - { - throw new ArgumentNullException(nameof(nodeWriter)); - } - - if (codeDocument == null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (documentNode == null) - { - throw new ArgumentNullException(nameof(documentNode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - _codeDocument = codeDocument; - _documentNode = documentNode; - Options = options; - - _ancestors = new Stack(); - Diagnostics = new RazorDiagnosticCollection(); - Items = new ItemCollection(); - _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); - LinePragmas = new List(); - - var diagnostics = _documentNode.GetAllDiagnostics(); - for (var i = 0; i < diagnostics.Count; i++) - { - Diagnostics.Add(diagnostics[i]); - } - - // Set new line character to a specific string regardless of platform, for testing purposes. - var newLineString = codeDocument.Items[NewLineString] as string ?? Environment.NewLine; - CodeWriter = new CodeWriter(newLineString, options); - - Items[NewLineString] = codeDocument.Items[NewLineString]; - Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; - - _scopes = new List(); - _scopes.Add(new ScopeInternal(nodeWriter)); - } - - // This will be initialized by the document writer when the context is 'live'. - public IntermediateNodeVisitor Visitor { get; set; } - - public override IEnumerable Ancestors => _ancestors; - - internal Stack AncestorsInternal => _ancestors; - - public override CodeWriter CodeWriter { get; } - - public override RazorDiagnosticCollection Diagnostics { get; } - - public override string DocumentKind => _documentNode.DocumentKind; - - public override ItemCollection Items { get; } - - public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; - - internal List LinePragmas { get; } - - public override IntermediateNodeWriter NodeWriter => Current.Writer; - - public override RazorCodeGenerationOptions Options { get; } - - public override IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); - - public override RazorSourceDocument SourceDocument => _codeDocument.Source; - - private ScopeInternal Current => _scopes[_scopes.Count - 1]; - - public override void AddSourceMappingFor(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (node.Source == null) - { - return; - } - - AddSourceMappingFor(node.Source.Value); - } - - public override void AddSourceMappingFor(SourceSpan source, int offset = 0) - { - if (SourceDocument.FilePath != null && - !string.Equals(SourceDocument.FilePath, source.FilePath, StringComparison.OrdinalIgnoreCase)) - { - // We don't want to generate line mappings for imports. - return; - } - - var currentLocation = CodeWriter.Location with { AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, CharacterIndex = CodeWriter.Location.CharacterIndex + offset }; - - var generatedLocation = new SourceSpan(currentLocation, source.Length); - var sourceMapping = new SourceMapping(source, generatedLocation); - - SourceMappings.Add(sourceMapping); - } - - public override void RenderChildren(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - _ancestors.Push(node); - - for (var i = 0; i < node.Children.Count; i++) - { - Visitor.Visit(node.Children[i]); - } - - _ancestors.Pop(); - } - - public override void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - _scopes.Add(new ScopeInternal(writer)); - _ancestors.Push(node); - - for (var i = 0; i < node.Children.Count; i++) - { - Visitor.Visit(node.Children[i]); - } - - _ancestors.Pop(); - _scopes.RemoveAt(_scopes.Count - 1); - } - - public override void RenderNode(IntermediateNode node) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - Visitor.Visit(node); - } - - public override void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) - { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } - - _scopes.Add(new ScopeInternal(writer)); - - Visitor.Visit(node); - - _scopes.RemoveAt(_scopes.Count - 1); - } - - public override void AddLinePragma(LinePragma linePragma) - { - LinePragmas.Add(linePragma); - } - - public override void Dispose() - { - _sourceMappingsBuilder.Dispose(); - CodeWriter.Dispose(); - } - - private struct ScopeInternal - { - public ScopeInternal(IntermediateNodeWriter writer) - { - Writer = writer; - } - - public IntermediateNodeWriter Writer { get; } - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 72c3b39d0f1..0e21d769dcf 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -33,7 +33,7 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument throw new ArgumentNullException(nameof(documentNode)); } - using var context = new DefaultCodeRenderingContext( + using var context = new CodeRenderingContext( _codeTarget.CreateNodeWriter(), codeDocument, documentNode, @@ -56,16 +56,16 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument private class Visitor : IntermediateNodeVisitor { - private readonly DefaultCodeRenderingContext _context; + private readonly CodeRenderingContext _context; private readonly CodeTarget _target; - public Visitor(CodeTarget target, DefaultCodeRenderingContext context) + public Visitor(CodeTarget target, CodeRenderingContext context) { _target = target; _context = context; } - private DefaultCodeRenderingContext Context => _context; + private CodeRenderingContext Context => _context; public override void VisitDocument(DocumentIntermediateNode node) { diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index e4f695cc133..f665107bcdd 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -39,7 +39,7 @@ public static CodeRenderingContext CreateDesignTime( nodeWriter = new DesignTimeNodeWriter(); } - var context = new DefaultCodeRenderingContext(nodeWriter, codeDocument, documentNode, options); + var context = new CodeRenderingContext(nodeWriter, codeDocument, documentNode, options); context.Visitor = new RenderChildrenVisitor(context); return context; @@ -75,7 +75,7 @@ public static CodeRenderingContext CreateRuntime( nodeWriter = new RuntimeNodeWriter(); } - var context = new DefaultCodeRenderingContext(nodeWriter, codeDocument, documentNode, options); + var context = new CodeRenderingContext(nodeWriter, codeDocument, documentNode, options); context.Visitor = new RenderChildrenVisitor(context); return context; From 0e1774a4ee13fe1e62a8b43000857467ef758c9a Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 11:37:13 -0700 Subject: [PATCH 098/271] Clean up CodeRenderingContext a bit --- .../CodeGeneration/CodeRenderingContext.cs | 99 +++++-------------- 1 file changed, 24 insertions(+), 75 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 751c5cf9717..a077c33699f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -13,10 +13,18 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; public sealed class CodeRenderingContext : IDisposable { + private readonly record struct ScopeInternal(IntermediateNodeWriter Writer); + internal static readonly object NewLineString = "NewLineString"; internal static readonly object SuppressUniqueIds = "SuppressUniqueIds"; + public RazorCodeGenerationOptions Options { get; } + public CodeWriter CodeWriter { get; } + public RazorDiagnosticCollection Diagnostics { get; } + internal List LinePragmas { get; } + public ItemCollection Items { get; } + private readonly Stack _ancestors; private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; @@ -30,35 +38,20 @@ public CodeRenderingContext( DocumentIntermediateNode documentNode, RazorCodeGenerationOptions options) { - if (nodeWriter == null) - { - throw new ArgumentNullException(nameof(nodeWriter)); - } - - if (codeDocument == null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (documentNode == null) - { - throw new ArgumentNullException(nameof(documentNode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + ArgHelper.ThrowIfNull(nodeWriter); + ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(documentNode); + ArgHelper.ThrowIfNull(options); _codeDocument = codeDocument; _documentNode = documentNode; Options = options; _ancestors = new Stack(); - Diagnostics = new RazorDiagnosticCollection(); - Items = new ItemCollection(); + Diagnostics = []; + Items = []; _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); - LinePragmas = new List(); + LinePragmas = []; var diagnostics = _documentNode.GetAllDiagnostics(); for (var i = 0; i < diagnostics.Count; i++) @@ -73,8 +66,7 @@ public CodeRenderingContext( Items[NewLineString] = codeDocument.Items[NewLineString]; Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; - _scopes = new List(); - _scopes.Add(new ScopeInternal(nodeWriter)); + _scopes = [new(nodeWriter)]; } // This will be initialized by the document writer when the context is 'live'. @@ -84,34 +76,21 @@ public CodeRenderingContext( internal Stack AncestorsInternal => _ancestors; - public CodeWriter CodeWriter { get; } - - public RazorDiagnosticCollection Diagnostics { get; } - public string DocumentKind => _documentNode.DocumentKind; - public ItemCollection Items { get; } - public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; - internal List LinePragmas { get; } - public IntermediateNodeWriter NodeWriter => Current.Writer; - public RazorCodeGenerationOptions Options { get; } - public IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); public RazorSourceDocument SourceDocument => _codeDocument.Source; - private ScopeInternal Current => _scopes[_scopes.Count - 1]; + private ScopeInternal Current => _scopes[^1]; public void AddSourceMappingFor(IntermediateNode node) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } + ArgHelper.ThrowIfNull(node); if (node.Source == null) { @@ -140,10 +119,7 @@ public void AddSourceMappingFor(SourceSpan source, int offset = 0) public void RenderChildren(IntermediateNode node) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } + ArgHelper.ThrowIfNull(node); _ancestors.Push(node); @@ -157,15 +133,8 @@ public void RenderChildren(IntermediateNode node) public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } + ArgHelper.ThrowIfNull(node); + ArgHelper.ThrowIfNull(writer); _scopes.Add(new ScopeInternal(writer)); _ancestors.Push(node); @@ -181,25 +150,15 @@ public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) public void RenderNode(IntermediateNode node) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } + ArgHelper.ThrowIfNull(node); Visitor.Visit(node); } public void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - if (writer == null) - { - throw new ArgumentNullException(nameof(writer)); - } + ArgHelper.ThrowIfNull(node); + ArgHelper.ThrowIfNull(writer); _scopes.Add(new ScopeInternal(writer)); @@ -218,14 +177,4 @@ public void Dispose() _sourceMappingsBuilder.Dispose(); CodeWriter.Dispose(); } - - private struct ScopeInternal - { - public ScopeInternal(IntermediateNodeWriter writer) - { - Writer = writer; - } - - public IntermediateNodeWriter Writer { get; } - } } From 86e05ee42caa7ac34ead0e07205e0f57a594c636 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 11:46:01 -0700 Subject: [PATCH 099/271] Pool scope stack in CodeRenderingContext --- .../CodeGeneration/CodeRenderingContext.cs | 25 +++++++++++-------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index a077c33699f..d76312144ec 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -28,9 +28,9 @@ public sealed class CodeRenderingContext : IDisposable private readonly Stack _ancestors; private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; - private readonly List _scopes; - private readonly PooledObject.Builder> _sourceMappingsBuilder; + private readonly PooledObject> _pooledScopeStack; + private readonly PooledObject.Builder> _pooledSourceMappings; public CodeRenderingContext( IntermediateNodeWriter nodeWriter, @@ -50,7 +50,7 @@ public CodeRenderingContext( _ancestors = new Stack(); Diagnostics = []; Items = []; - _sourceMappingsBuilder = ArrayBuilderPool.GetPooledObject(); + _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); LinePragmas = []; var diagnostics = _documentNode.GetAllDiagnostics(); @@ -66,7 +66,8 @@ public CodeRenderingContext( Items[NewLineString] = codeDocument.Items[NewLineString]; Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; - _scopes = [new(nodeWriter)]; + _pooledScopeStack = StackPool.GetPooledObject(out var scopeStack); + scopeStack.Push(new(nodeWriter)); } // This will be initialized by the document writer when the context is 'live'. @@ -78,7 +79,7 @@ public CodeRenderingContext( public string DocumentKind => _documentNode.DocumentKind; - public ImmutableArray.Builder SourceMappings => _sourceMappingsBuilder.Object; + public ImmutableArray.Builder SourceMappings => _pooledSourceMappings.Object; public IntermediateNodeWriter NodeWriter => Current.Writer; @@ -86,7 +87,8 @@ public CodeRenderingContext( public RazorSourceDocument SourceDocument => _codeDocument.Source; - private ScopeInternal Current => _scopes[^1]; + private Stack ScopeStack => _pooledScopeStack.Object; + private ScopeInternal Current => ScopeStack.Peek(); public void AddSourceMappingFor(IntermediateNode node) { @@ -136,7 +138,7 @@ public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) ArgHelper.ThrowIfNull(node); ArgHelper.ThrowIfNull(writer); - _scopes.Add(new ScopeInternal(writer)); + ScopeStack.Push(new ScopeInternal(writer)); _ancestors.Push(node); for (var i = 0; i < node.Children.Count; i++) @@ -145,7 +147,7 @@ public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) } _ancestors.Pop(); - _scopes.RemoveAt(_scopes.Count - 1); + ScopeStack.Pop(); } public void RenderNode(IntermediateNode node) @@ -160,11 +162,11 @@ public void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) ArgHelper.ThrowIfNull(node); ArgHelper.ThrowIfNull(writer); - _scopes.Add(new ScopeInternal(writer)); + ScopeStack.Push(new ScopeInternal(writer)); Visitor.Visit(node); - _scopes.RemoveAt(_scopes.Count - 1); + ScopeStack.Pop(); } public void AddLinePragma(LinePragma linePragma) @@ -174,7 +176,8 @@ public void AddLinePragma(LinePragma linePragma) public void Dispose() { - _sourceMappingsBuilder.Dispose(); + _pooledScopeStack.Dispose(); + _pooledSourceMappings.Dispose(); CodeWriter.Dispose(); } } From 635695fefb2d648af7bd41c8186ba188fafb4776 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 13:08:59 -0700 Subject: [PATCH 100/271] Pool line pragmas in CodeRenderingContext --- .../src/Language/CodeGeneration/CodeRenderingContext.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index d76312144ec..e8484c3e2ca 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -22,7 +22,6 @@ public sealed class CodeRenderingContext : IDisposable public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } public RazorDiagnosticCollection Diagnostics { get; } - internal List LinePragmas { get; } public ItemCollection Items { get; } private readonly Stack _ancestors; @@ -31,6 +30,7 @@ public sealed class CodeRenderingContext : IDisposable private readonly PooledObject> _pooledScopeStack; private readonly PooledObject.Builder> _pooledSourceMappings; + private readonly PooledObject> _pooledLinePragmas; public CodeRenderingContext( IntermediateNodeWriter nodeWriter, @@ -51,7 +51,7 @@ public CodeRenderingContext( Diagnostics = []; Items = []; _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); - LinePragmas = []; + _pooledLinePragmas = ListPool.GetPooledObject(); var diagnostics = _documentNode.GetAllDiagnostics(); for (var i = 0; i < diagnostics.Count; i++) @@ -81,6 +81,8 @@ public CodeRenderingContext( public ImmutableArray.Builder SourceMappings => _pooledSourceMappings.Object; + internal List LinePragmas => _pooledLinePragmas.Object; + public IntermediateNodeWriter NodeWriter => Current.Writer; public IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); @@ -176,6 +178,7 @@ public void AddLinePragma(LinePragma linePragma) public void Dispose() { + _pooledLinePragmas.Dispose(); _pooledScopeStack.Dispose(); _pooledSourceMappings.Dispose(); CodeWriter.Dispose(); From 7ba41799a581693ce7be2093efe4620e26d40244 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 13:13:50 -0700 Subject: [PATCH 101/271] Pool ancestor stack in CodeRenderingContext --- .../CodeGeneration/CodeRenderingContext.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index e8484c3e2ca..cff81d39bc2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -24,10 +24,10 @@ public sealed class CodeRenderingContext : IDisposable public RazorDiagnosticCollection Diagnostics { get; } public ItemCollection Items { get; } - private readonly Stack _ancestors; private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; + private readonly PooledObject> _pooledAncestors; private readonly PooledObject> _pooledScopeStack; private readonly PooledObject.Builder> _pooledSourceMappings; private readonly PooledObject> _pooledLinePragmas; @@ -47,7 +47,7 @@ public CodeRenderingContext( _documentNode = documentNode; Options = options; - _ancestors = new Stack(); + _pooledAncestors = StackPool.GetPooledObject(); Diagnostics = []; Items = []; _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); @@ -73,9 +73,9 @@ public CodeRenderingContext( // This will be initialized by the document writer when the context is 'live'. public IntermediateNodeVisitor Visitor { get; set; } - public IEnumerable Ancestors => _ancestors; + public IEnumerable Ancestors => _pooledAncestors.Object; - internal Stack AncestorsInternal => _ancestors; + internal Stack AncestorsInternal => _pooledAncestors.Object; public string DocumentKind => _documentNode.DocumentKind; @@ -85,7 +85,7 @@ public CodeRenderingContext( public IntermediateNodeWriter NodeWriter => Current.Writer; - public IntermediateNode Parent => _ancestors.Count == 0 ? null : _ancestors.Peek(); + public IntermediateNode Parent => AncestorsInternal.Count == 0 ? null : AncestorsInternal.Peek(); public RazorSourceDocument SourceDocument => _codeDocument.Source; @@ -125,14 +125,14 @@ public void RenderChildren(IntermediateNode node) { ArgHelper.ThrowIfNull(node); - _ancestors.Push(node); + AncestorsInternal.Push(node); for (var i = 0; i < node.Children.Count; i++) { Visitor.Visit(node.Children[i]); } - _ancestors.Pop(); + AncestorsInternal.Pop(); } public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) @@ -141,14 +141,14 @@ public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) ArgHelper.ThrowIfNull(writer); ScopeStack.Push(new ScopeInternal(writer)); - _ancestors.Push(node); + AncestorsInternal.Push(node); for (var i = 0; i < node.Children.Count; i++) { Visitor.Visit(node.Children[i]); } - _ancestors.Pop(); + AncestorsInternal.Pop(); ScopeStack.Pop(); } @@ -178,6 +178,7 @@ public void AddLinePragma(LinePragma linePragma) public void Dispose() { + _pooledAncestors.Dispose(); _pooledLinePragmas.Dispose(); _pooledScopeStack.Dispose(); _pooledSourceMappings.Dispose(); From 25acc07be27fa2086ebedb6859a71314989f872e Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 13:27:56 -0700 Subject: [PATCH 102/271] Merge RazorCSharpDocument and DefaultRazorCSharpDocument --- .../CodeGeneration/DefaultDocumentWriter.cs | 2 +- .../Language/DefaultRazorCSharpDocument.cs | 60 ------------- .../src/Language/RazorCSharpDocument.cs | 90 ++++++++----------- 3 files changed, 39 insertions(+), 113 deletions(-) delete mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 0e21d769dcf..3de9fb44296 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -45,7 +45,7 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument var cSharp = context.CodeWriter.GenerateCode(); var allOrderedDiagnostics = context.Diagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); - return new DefaultRazorCSharpDocument( + return new RazorCSharpDocument( codeDocument, cSharp, _options, diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs deleted file mode 100644 index 381a092eba7..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCSharpDocument.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; -using System.Collections.Generic; -using System.Collections.Immutable; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCSharpDocument : RazorCSharpDocument -{ - private readonly string _generatedCode; - private readonly RazorDiagnostic[] _diagnostics; - private readonly ImmutableArray _sourceMappings; - private readonly LinePragma[] _linePragmas; - private readonly RazorCodeGenerationOptions _options; - private readonly RazorCodeDocument _codeDocument; - - public DefaultRazorCSharpDocument( - RazorCodeDocument codeDocument, - string generatedCode, - RazorCodeGenerationOptions options, - RazorDiagnostic[] diagnostics, - ImmutableArray sourceMappings, - LinePragma[] linePragmas) - { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - _codeDocument = codeDocument; - _generatedCode = generatedCode; - _options = options; - - _diagnostics = diagnostics ?? Array.Empty(); - _sourceMappings = sourceMappings; - _linePragmas = linePragmas ?? Array.Empty(); - } - - public override IReadOnlyList Diagnostics => _diagnostics; - - public override string GeneratedCode => _generatedCode; - - public override ImmutableArray SourceMappings => _sourceMappings; - - internal override IReadOnlyList LinePragmas => _linePragmas; - - public override RazorCodeGenerationOptions Options => _options; - - public override RazorCodeDocument CodeDocument => _codeDocument; -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index fc16701d2f7..ade80932a0d 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -1,9 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - -using System; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -11,46 +8,46 @@ namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorCSharpDocument : IRazorGeneratedDocument +public sealed class RazorCSharpDocument : IRazorGeneratedDocument { - public abstract string GeneratedCode { get; } - - public abstract ImmutableArray SourceMappings { get; } - - public abstract IReadOnlyList Diagnostics { get; } - - public abstract RazorCodeGenerationOptions Options { get; } - - public abstract RazorCodeDocument CodeDocument { get; } - - internal virtual IReadOnlyList LinePragmas { get; } + public RazorCodeDocument CodeDocument { get; } + public string GeneratedCode { get; } + public RazorCodeGenerationOptions Options { get; } + public IReadOnlyList Diagnostics { get; } + public ImmutableArray SourceMappings { get; } + internal IReadOnlyList LinePragmas { get; } + + public RazorCSharpDocument( + RazorCodeDocument codeDocument, + string generatedCode, + RazorCodeGenerationOptions options, + RazorDiagnostic[] diagnostics, + ImmutableArray sourceMappings, + LinePragma[] linePragmas) + { + ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(generatedCode); - [Obsolete("For backwards compatibility only. Use the overload that takes a RazorCodeDocument")] - public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) - => Create(codeDocument: null, generatedCode, options, diagnostics); + CodeDocument = codeDocument; + GeneratedCode = generatedCode; + Options = options; - [Obsolete("For backwards compatibility only. Use the overload that takes a RazorCodeDocument")] - public static RazorCSharpDocument Create(string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics, ImmutableArray sourceMappings, IEnumerable linePragmas) - => Create(codeDocument: null, generatedCode, options, diagnostics, sourceMappings, linePragmas); + Diagnostics = diagnostics ?? []; + SourceMappings = sourceMappings; + LinePragmas = linePragmas ?? []; + } - public static RazorCSharpDocument Create(RazorCodeDocument codeDocument, string generatedCode, RazorCodeGenerationOptions options, IEnumerable diagnostics) + public static RazorCSharpDocument Create( + RazorCodeDocument codeDocument, + string generatedCode, + RazorCodeGenerationOptions options, + IEnumerable diagnostics) { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (diagnostics == null) - { - throw new ArgumentNullException(nameof(diagnostics)); - } + ArgHelper.ThrowIfNull(generatedCode); + ArgHelper.ThrowIfNull(options); + ArgHelper.ThrowIfNull(diagnostics); - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: ImmutableArray.Empty, linePragmas: null); + return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: [], linePragmas: []); } public static RazorCSharpDocument Create( @@ -61,21 +58,10 @@ public static RazorCSharpDocument Create( ImmutableArray sourceMappings, IEnumerable linePragmas) { - if (generatedCode == null) - { - throw new ArgumentNullException(nameof(generatedCode)); - } - - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (diagnostics == null) - { - throw new ArgumentNullException(nameof(diagnostics)); - } + ArgHelper.ThrowIfNull(generatedCode); + ArgHelper.ThrowIfNull(options); + ArgHelper.ThrowIfNull(diagnostics); - return new DefaultRazorCSharpDocument(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas.ToArray()); + return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas.ToArray()); } } From d00b1ffab8c4a5a348d2020f8394e8f921b45402 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 13:44:53 -0700 Subject: [PATCH 103/271] Switch CodeRenderingContext.LinePragmas to an ImmutableArray --- .../Language/CodeGeneration/CodeRenderingContext.cs | 6 +++--- .../Language/CodeGeneration/DefaultDocumentWriter.cs | 2 +- .../src/Language/RazorCSharpDocument.cs | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index cff81d39bc2..b3517e1055f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -30,7 +30,7 @@ public sealed class CodeRenderingContext : IDisposable private readonly PooledObject> _pooledAncestors; private readonly PooledObject> _pooledScopeStack; private readonly PooledObject.Builder> _pooledSourceMappings; - private readonly PooledObject> _pooledLinePragmas; + private readonly PooledObject.Builder> _pooledLinePragmas; public CodeRenderingContext( IntermediateNodeWriter nodeWriter, @@ -51,7 +51,7 @@ public CodeRenderingContext( Diagnostics = []; Items = []; _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); - _pooledLinePragmas = ListPool.GetPooledObject(); + _pooledLinePragmas = ArrayBuilderPool.GetPooledObject(); var diagnostics = _documentNode.GetAllDiagnostics(); for (var i = 0; i < diagnostics.Count; i++) @@ -81,7 +81,7 @@ public CodeRenderingContext( public ImmutableArray.Builder SourceMappings => _pooledSourceMappings.Object; - internal List LinePragmas => _pooledLinePragmas.Object; + internal ImmutableArray.Builder LinePragmas => _pooledLinePragmas.Object; public IntermediateNodeWriter NodeWriter => Current.Writer; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 3de9fb44296..92c8a3ca94d 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -51,7 +51,7 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument _options, allOrderedDiagnostics.ToArray(), context.SourceMappings.DrainToImmutable(), - context.LinePragmas.ToArray()); + context.LinePragmas.DrainToImmutable()); } private class Visitor : IntermediateNodeVisitor diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index ade80932a0d..20baddcb80b 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -15,7 +15,7 @@ public sealed class RazorCSharpDocument : IRazorGeneratedDocument public RazorCodeGenerationOptions Options { get; } public IReadOnlyList Diagnostics { get; } public ImmutableArray SourceMappings { get; } - internal IReadOnlyList LinePragmas { get; } + internal ImmutableArray LinePragmas { get; } public RazorCSharpDocument( RazorCodeDocument codeDocument, @@ -23,7 +23,7 @@ public RazorCSharpDocument( RazorCodeGenerationOptions options, RazorDiagnostic[] diagnostics, ImmutableArray sourceMappings, - LinePragma[] linePragmas) + ImmutableArray linePragmas) { ArgHelper.ThrowIfNull(codeDocument); ArgHelper.ThrowIfNull(generatedCode); @@ -33,8 +33,8 @@ public RazorCSharpDocument( Options = options; Diagnostics = diagnostics ?? []; - SourceMappings = sourceMappings; - LinePragmas = linePragmas ?? []; + SourceMappings = sourceMappings.NullToEmpty(); + LinePragmas = linePragmas.NullToEmpty(); } public static RazorCSharpDocument Create( @@ -56,12 +56,12 @@ public static RazorCSharpDocument Create( RazorCodeGenerationOptions options, IEnumerable diagnostics, ImmutableArray sourceMappings, - IEnumerable linePragmas) + ImmutableArray linePragmas) { ArgHelper.ThrowIfNull(generatedCode); ArgHelper.ThrowIfNull(options); ArgHelper.ThrowIfNull(diagnostics); - return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas.ToArray()); + return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas); } } From 89204d4acfe3c41d503c6a234916e8500f3e7c14 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 14:16:14 -0700 Subject: [PATCH 104/271] Clean up callers of RazorCSharpDocument.Create(...) --- .../test/RazorCodeDocumentExtensionsTest.cs | 4 +- .../RazorDiagnosticsBenchmark.cs | 6 +- .../UnsupportedCSharpLoweringPhase.cs | 3 +- .../DefaultCSharpCodeActionProviderTest.cs | 6 +- ...TypeAccessibilityCodeActionProviderTest.cs | 6 +- ...nentAccessibilityCodeActionProviderTest.cs | 6 +- .../RazorDiagnosticsPublisherTest.cs | 6 +- .../DocumentOnTypeFormattingEndpointTest.cs | 15 +- .../FormattingLanguageServerTestBase.cs | 5 +- .../Mapping/RazorLanguageQueryEndpointTest.cs | 25 +- .../RazorMapToDocumentRangesEndpointTest.cs | 54 +-- .../RazorDocumentMappingServiceTest.cs | 357 ++++++++---------- 12 files changed, 208 insertions(+), 285 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs index 8c73fda2e9e..51eb9b03956 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs @@ -113,7 +113,7 @@ public void GetCSharpDocument_ReturnsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), Array.Empty()); + var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); codeDocument.Items[typeof(RazorCSharpDocument)] = expected; // Act @@ -129,7 +129,7 @@ public void SetCSharpDocument_SetsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), Array.Empty()); + var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); // Act codeDocument.SetCSharpDocument(expected); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 9e50156d7f5..0c49b8c5865 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -10,7 +10,6 @@ using System.Threading.Tasks; using BenchmarkDotNet.Attributes; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.LanguageServer.Diagnostics; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; @@ -62,10 +61,9 @@ public void Setup() mockRazorCodeDocument.Object, GeneratedCode, RazorCodeGenerationOptions.CreateDesignTimeDefault(), - Array.Empty(), + diagnostics: [], SourceMappings, - new List() - ); + linePragmas: []); var itemCollection = new ItemCollection(); itemCollection[typeof(RazorCSharpDocument)] = mockRazorCSharpDocument; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs index 53905d716e8..c709d943666 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Linq; using Microsoft.AspNetCore.Razor.Language; namespace Microsoft.AspNetCore.Razor.ProjectEngineHost; @@ -19,7 +18,7 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) codeDocument, UnsupportedDisclaimer, documentNode.Options, - Enumerable.Empty()); + diagnostics: []); codeDocument.SetCSharpDocument(cSharpDocument); codeDocument.SetUnsupported(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs index 335e5df5f48..fb1bd67fc0b 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs @@ -326,11 +326,11 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var projectEngine = RazorProjectEngine.Create(builder => builder.AddTagHelpers(tagHelpers)); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, new[] { diagnostic }); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs index 7c3c0afff5d..5b48f7c4293 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs @@ -457,11 +457,11 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( }); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, [diagnostic]); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs index 7d4ca269ff6..e9e6fd617ac 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs @@ -457,11 +457,11 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP var projectEngine = RazorProjectEngine.Create(builder => builder.AddTagHelpers(tagHelpers)); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); - var cSharpDocument = codeDocument.GetCSharpDocument(); + var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var cSharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, cSharpDocument.GeneratedCode, cSharpDocument.Options, new[] { diagnostic }); - codeDocument.SetCSharpDocument(cSharpDocumentWithDiagnostic); + var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs index 4cdbc79137d..31587d73146 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs @@ -2,6 +2,8 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -523,10 +525,10 @@ public void ClearClosedDocuments_RestartsTimerIfDocumentsStillOpen() Assert.True(publisherAccessor.IsWaitingToClearClosedDocuments); } - private static RazorCodeDocument CreateCodeDocument(RazorDiagnostic[] diagnostics) + private static RazorCodeDocument CreateCodeDocument(IEnumerable diagnostics) { var codeDocument = TestRazorCodeDocument.Create("hello"); - var razorCSharpDocument = RazorCSharpDocument.Create(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics); + var razorCSharpDocument = RazorCSharpDocument.Create(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics.ToImmutableArray()); codeDocument.SetCSharpDocument(razorCSharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 17177a8e49c..086ac0c7c2a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -47,8 +47,7 @@ public async Task Handle_OnTypeFormatting_DocumentNotFound_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(new Uri("file://path/testDifferentFile.razor"), codeDocument); @@ -82,8 +81,7 @@ public async Task Handle_OnTypeFormatting_RemapFailed_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: []); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); @@ -117,8 +115,7 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); @@ -153,8 +150,7 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, sourceMappings: [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); @@ -189,8 +185,7 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull @{ if(true){} }"; - var sourceMappings = new List { new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0)) }; - var codeDocument = CreateCodeDocument(content, sourceMappings); + var codeDocument = CreateCodeDocument(content, [new SourceMapping(new SourceSpan(17, 0), new SourceSpan(17, 0))]); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 25a4ba44e63..7e924e88a2a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -7,7 +7,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -20,13 +19,13 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public abstract class FormattingLanguageServerTestBase(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - internal static RazorCodeDocument CreateCodeDocument(string content, IReadOnlyList sourceMappings) + internal static RazorCodeDocument CreateCodeDocument(string content, ImmutableArray sourceMappings) { var sourceDocument = TestRazorSourceDocument.Create(content); var codeDocument = RazorCodeDocument.Create(sourceDocument); var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, RazorParserOptions.CreateDefault()); var razorCSharpDocument = RazorCSharpDocument.Create( - codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), Array.Empty(), sourceMappings.ToImmutableArray(), Array.Empty()); + codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), diagnostics: [], sourceMappings, linePragmas: []); codeDocument.SetSyntaxTree(syntaxTree); codeDocument.SetCSharpDocument(razorCSharpDocument); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs index 4d52de66276..eb3985c14be 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs @@ -2,12 +2,9 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -90,9 +87,9 @@ public async Task Handle_ResolvesLanguageRequest_CSharp() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "@", - "/* CSharp */", - new[] { new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 12)) }); + razorSource: "@", + projectedCSharpSource: "/* CSharp */", + sourceMappings: [new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorLanguageQueryEndpoint(_documentMappingService, LoggerFactory); var request = new RazorLanguageQueryParams() @@ -120,9 +117,9 @@ public async Task Handle_Unsupported_ResolvesLanguageRequest_Html() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "@", - "/* CSharp */", - new[] { new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 12)) }); + razorSource: "@", + projectedCSharpSource: "/* CSharp */", + sourceMappings: [new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 12))]); codeDocument.SetUnsupported(); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorLanguageQueryEndpoint(_documentMappingService, LoggerFactory); @@ -145,16 +142,16 @@ public async Task Handle_Unsupported_ResolvesLanguageRequest_Html() Assert.Equal(1337, response.HostDocumentVersion); } - private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, IEnumerable sourceMappings) + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { - var codeDocument = CreateCodeDocument(razorSource, ImmutableArray.Empty); + var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); var csharpDocument = RazorCSharpDocument.Create( codeDocument, projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), - Enumerable.Empty(), - sourceMappings.ToImmutableArray(), - Enumerable.Empty()); + diagnostics: [], + sourceMappings, + linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index 271ebda9975..b9a3f275cc3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -36,13 +36,9 @@ public async Task Handle_MapToDocumentRanges_CSharp() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -70,13 +66,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_Unmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -103,13 +95,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_LeadingOverlapsUnmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -136,13 +124,9 @@ public async Task Handle_MapToDocumentRanges_CSharp_TrailingOverlapsUnmapped() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); var request = new RazorMapToDocumentRangesParams() @@ -221,13 +205,9 @@ public async Task Handle_MapToDocumentRanges_Unsupported() // Arrange var documentPath = new Uri("C:/path/to/document.cshtml"); var codeDocument = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "var __o = DateTime.Now", - [ - new SourceMapping( - new SourceSpan(4, 12), - new SourceSpan(10, 12)) - ]); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "var __o = DateTime.Now", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(10, 12))]); codeDocument.SetUnsupported(); var documentContext = CreateDocumentContext(documentPath, codeDocument); var languageEndpoint = new RazorMapToDocumentRangesEndpoint(_documentMappingService); @@ -249,7 +229,7 @@ public async Task Handle_MapToDocumentRanges_Unsupported() Assert.Equal(1337, response.HostDocumentVersion); } - private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, IEnumerable sourceMappings) + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); var csharpDocument = RazorCSharpDocument.Create( @@ -257,7 +237,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), diagnostics: [], - sourceMappings.ToImmutableArray(), + sourceMappings, linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index 8bd5c180295..533abcd0638 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -21,15 +19,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer; -public class RazorDocumentMappingServiceTest : ToolingTestBase +public class RazorDocumentMappingServiceTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) { - private readonly IFilePathService _filePathService; - - public RazorDocumentMappingServiceTest(ITestOutputHelper testOutput) - : base(testOutput) - { - _filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); - } + private readonly IFilePathService _filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); [Fact] public void TryMapToHostDocumentRange_Strict_StartOnlyMaps_ReturnsFalse() @@ -37,9 +29,9 @@ public void TryMapToHostDocumentRange_Strict_StartOnlyMaps_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 19)); // Act @@ -60,9 +52,9 @@ public void TryMapToHostDocumentRange_Strict_EndOnlyMaps_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 12)); // Act @@ -83,9 +75,9 @@ public void TryMapToHostDocumentRange_Strict_StartAndEndMap_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -107,9 +99,9 @@ public void TryMapToHostDocumentRange_Inclusive_DirectlyMaps_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -131,9 +123,9 @@ public void TryMapToHostDocumentRange_Inclusive_StartSinglyIntersects_ReturnsTru // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 10), new LinePosition(0, 19)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -155,9 +147,9 @@ public void TryMapToHostDocumentRange_Inclusive_EndSinglyIntersects_ReturnsTrue( // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 10)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -179,13 +171,12 @@ public void TryMapToHostDocumentRange_Inclusive_StartDoublyIntersects_ReturnsFal // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 14), new LinePosition(0, 19)); // Act @@ -206,13 +197,12 @@ public void TryMapToHostDocumentRange_Inclusive_EndDoublyIntersects_ReturnsFalse // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 14)); // Act @@ -233,9 +223,9 @@ public void TryMapToHostDocumentRange_Inclusive_OverlapsSingleMapping_ReturnsTru // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -257,13 +247,12 @@ public void TryMapToHostDocumentRange_Inclusive_OverlapsTwoMappings_ReturnsFalse // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] - { + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [ new SourceMapping(new SourceSpan(4, 8), new SourceSpan(6, 8)), // DateTime new SourceMapping(new SourceSpan(12, 4), new SourceSpan(14, 4)) // .Now - }); + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); // Act @@ -284,9 +273,9 @@ public void TryMapToHostDocumentRange_Inferred_DirectlyMaps_ReturnsTrue() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "

@DateTime.Now

", - "__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12)) }); + razorSource: "

@DateTime.Now

", + projectedCSharpSource: "__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(4, 12), new SourceSpan(6, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 6), new LinePosition(0, 18)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 4), new LinePosition(0, 16)); @@ -308,9 +297,9 @@ public void TryMapToHostDocumentRange_Inferred_BeginningOfDocAndProjection_Retur // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@

@DateTime.Now

", - "(__builder) => { };__o = DateTime.Now;", - new[] { new SourceMapping(new SourceSpan(26, 12), new SourceSpan(25, 12)) }); + razorSource: "@

@DateTime.Now

", + projectedCSharpSource: "(__builder) => { };__o = DateTime.Now;", + sourceMappings: [new SourceMapping(new SourceSpan(26, 12), new SourceSpan(25, 12))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 0), new LinePosition(0, 19)); // Act @@ -326,17 +315,17 @@ public void TryMapToHostDocumentRange_Inferred_BeginningOfDocAndProjection_Retur } [Fact] - public void TryMapToHostDocumentRange_Inferred_InbetweenProjections_ReturnsTrue() + public void TryMapToHostDocumentRange_Inferred_InBetweenProjections_ReturnsTrue() { // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @ }", - " var abc = (__builder) => { } ", - new[] { + razorSource: "@{ var abc = @ }", + projectedCSharpSource: " var abc = (__builder) => { } ", + sourceMappings: [ new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), - new SourceMapping(new SourceSpan(35, 1), new SourceSpan(30, 1)), - }); + new SourceMapping(new SourceSpan(35, 1), new SourceSpan(30, 1)) + ]); var projectedRange = new LinePositionSpan(new LinePosition(0, 12), new LinePosition(0, 29)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 13), new LinePosition(0, 35)); @@ -353,14 +342,14 @@ public void TryMapToHostDocumentRange_Inferred_InbetweenProjections_ReturnsTrue( } [Fact] - public void TryMapToHostDocumentRange_Inferred_InbetweenProjectionAndEndOfDoc_ReturnsTrue() + public void TryMapToHostDocumentRange_Inferred_InBetweenProjectionAndEndOfDoc_ReturnsTrue() { // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new[] { new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 12), new LinePosition(0, 29)); var expectedOriginalRange = new LinePositionSpan(new LinePosition(0, 13), new LinePosition(0, 35)); @@ -382,9 +371,9 @@ public void TryMapToHostDocumentRange_Inferred_OutsideDoc_ReturnsFalse() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new[] { new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new SourceMapping(new SourceSpan(2, 11), new SourceSpan(0, 11))]); var projectedRange = new LinePositionSpan(new LinePosition(2, 12), new LinePosition(2, 29)); // Act @@ -392,14 +381,14 @@ public void TryMapToHostDocumentRange_Inferred_OutsideDoc_ReturnsFalse() codeDoc.GetCSharpDocument(), projectedRange, MappingBehavior.Inferred, - out var originalRange); + out _); // Assert Assert.False(result); } [Fact] - public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() + public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesNotThrow() { // Real world repo is something like: // @@ -418,9 +407,9 @@ public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "@{ var abc = @", - " var abc = (__builder) => { }", - new SourceMapping[] { new(new(30, 1), new (2, 1)), new(new(28, 2), new(30, 2)), }); + razorSource: "@{ var abc = @", + projectedCSharpSource: " var abc = (__builder) => { }", + sourceMappings: [new(new(30, 1), new(2, 1)), new(new(28, 2), new(30, 2))]); var projectedRange = new LinePositionSpan(new LinePosition(0, 25), new LinePosition(0, 25)); // Act @@ -431,7 +420,7 @@ public void TryMapToHostDocumentRange_Inferred_OutOfOrderMappings_DoesntThrow() out var originalRange); // Assert - // We're really just happy this doesn't throw an exception. The behaviour is to map to the end of the file + // We're really just happy this doesn't throw an exception. The behavior is to map to the end of the file Assert.True(result); Assert.Equal(0, originalRange.Start.Line); Assert.Equal(31, originalRange.Start.Character); @@ -445,21 +434,19 @@ public void TryMapToGeneratedDocumentPosition_NotMatchingAnyMapping() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "test razor source", - "test C# source", - new[] { new SourceMapping(new SourceSpan(2, 100), new SourceSpan(0, 100)) }); + razorSource: "test razor source", + projectedCSharpSource: "test C# source", + sourceMappings: [new SourceMapping(new SourceSpan(2, 100), new SourceSpan(0, 100))]); // Act var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 1, - out var projectedPosition, - out var projectedPositionIndex); + hostDocumentIndex: 1, + out _, + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedPosition); - Assert.Equal(default, projectedPositionIndex); } [Fact] @@ -468,28 +455,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_OnLeadingEdge() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 16, + hostDocumentIndex: 16, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(2, projectedPosition.Line); - Assert.Equal(0, projectedPosition.Character); - Assert.Equal(11, projectedPositionIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToGeneratedDocumentPosition)} should have returned true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(2, projectedPosition.Line); + Assert.Equal(0, projectedPosition.Character); + Assert.Equal(11, projectedPositionIndex); } [Fact] @@ -498,28 +481,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_InMiddle() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 28, + hostDocumentIndex: 28, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(3, projectedPosition.Line); - Assert.Equal(2, projectedPosition.Character); - Assert.Equal(23, projectedPositionIndex); - } - else - { - Assert.Fail("TryMapToGeneratedDocumentPosition should have been true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(3, projectedPosition.Line); + Assert.Equal(2, projectedPosition.Character); + Assert.Equal(23, projectedPositionIndex); } [Fact] @@ -528,28 +507,24 @@ public void TryMapToGeneratedDocumentPosition_CSharp_OnTrailingEdge() // Arrange var service = new LspDocumentMappingService(_filePathService, new TestDocumentContextFactory(), LoggerFactory); var codeDoc = CreateCodeDocumentWithCSharpProjection( - "Line 1\nLine 2 @{ var abc;\nvar def; }", - "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", + projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToGeneratedDocumentPosition( + var result = service.TryMapToGeneratedDocumentPosition( codeDoc.GetCSharpDocument(), - 35, + hostDocumentIndex: 35, out var projectedPosition, - out var projectedPositionIndex)) - { - Assert.Equal(3, projectedPosition.Line); - Assert.Equal(9, projectedPosition.Character); - Assert.Equal(30, projectedPositionIndex); - } - else - { - Assert.Fail("TryMapToGeneratedDocumentPosition should have returned true"); - } + out var projectedPositionIndex); + + Assert.True(result); + Assert.Equal(3, projectedPosition.Line); + Assert.Equal(9, projectedPosition.Character); + Assert.Equal(30, projectedPositionIndex); } [Fact] @@ -560,19 +535,17 @@ public void TryMapToHostDocumentPosition_NotMatchingAnyMapping() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "test razor source", projectedCSharpSource: "projectedCSharpSource: test C# source", - new[] { new SourceMapping(new SourceSpan(2, 100), new SourceSpan(2, 100)) }); + sourceMappings: [new SourceMapping(new SourceSpan(2, 100), new SourceSpan(2, 100))]); // Act var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 1, - out var hostDocumentPosition, - out var hostDocumentIndex); + generatedDocumentIndex: 1, + out _, + out _); // Assert Assert.False(result); - Assert.Equal(default, hostDocumentPosition); - Assert.Equal(default, hostDocumentIndex); } [Fact] @@ -583,26 +556,22 @@ public void TryMapToHostDocumentPosition_CSharp_OnLeadingEdge() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 11, // @{| + generatedDocumentIndex: 11, // @{| out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(1, hostDocumentPosition.Line); - Assert.Equal(9, hostDocumentPosition.Character); - Assert.Equal(16, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(1, hostDocumentPosition.Line); + Assert.Equal(9, hostDocumentPosition.Character); + Assert.Equal(16, hostDocumentIndex); } [Fact] @@ -613,26 +582,22 @@ public void TryMapToHostDocumentPosition_CSharp_InMiddle() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 21, // |var def + generatedDocumentIndex: 21, // |var def out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(2, hostDocumentPosition.Line); - Assert.Equal(0, hostDocumentPosition.Character); - Assert.Equal(26, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(2, hostDocumentPosition.Line); + Assert.Equal(0, hostDocumentPosition.Character); + Assert.Equal(26, hostDocumentIndex); } [Fact] @@ -643,26 +608,22 @@ public void TryMapToHostDocumentPosition_CSharp_OnTrailingEdge() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); // Act & Assert - if (service.TryMapToHostDocumentPosition( + var result = service.TryMapToHostDocumentPosition( codeDoc.GetCSharpDocument(), - 30, // def; |} + generatedDocumentIndex: 30, // def; |} out var hostDocumentPosition, - out var hostDocumentIndex)) - { - Assert.Equal(2, hostDocumentPosition.Line); - Assert.Equal(9, hostDocumentPosition.Character); - Assert.Equal(35, hostDocumentIndex); - } - else - { - Assert.Fail($"{nameof(service.TryMapToHostDocumentPosition)} should have returned true"); - } + out var hostDocumentIndex); + + Assert.True(result); + Assert.Equal(2, hostDocumentPosition.Line); + Assert.Equal(9, hostDocumentPosition.Character); + Assert.Equal(35, hostDocumentIndex); } [Fact] @@ -673,27 +634,23 @@ public void TryMapToGeneratedDocumentRange_CSharp() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 19), new SourceSpan(11, 19)) - }); + ]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act & Assert - if (service.TryMapToGeneratedDocumentRange( + var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange)) - { - Assert.Equal(2, projectedRange.Start.Line); - Assert.Equal(1, projectedRange.Start.Character); - Assert.Equal(2, projectedRange.End.Line); - Assert.Equal(4, projectedRange.End.Character); - } - else - { - Assert.Fail($"{nameof(service.TryMapToGeneratedDocumentRange)} should have returned true"); - } + out var projectedRange); + + Assert.True(result); + Assert.Equal(2, projectedRange.Start.Line); + Assert.Equal(1, projectedRange.Start.Character); + Assert.Equal(2, projectedRange.End.Line); + Assert.Equal(4, projectedRange.End.Character); } [Fact] @@ -704,20 +661,17 @@ public void TryMapToGeneratedDocumentRange_CSharp_MissingSourceMappings() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { - new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), - }); + sourceMappings: [new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1))]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange); + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedRange); } [Fact] @@ -728,22 +682,21 @@ public void TryMapToGeneratedDocumentRange_CSharp_End_LessThan_Start() var codeDoc = CreateCodeDocumentWithCSharpProjection( razorSource: "Line 1\nLine 2 @{ var abc;\nvar def; }", projectedCSharpSource: "\n// Prefix\n var abc;\nvar def; \n// Suffix", - new[] { + sourceMappings: [ new SourceMapping(new SourceSpan(0, 1), new SourceSpan(0, 1)), new SourceMapping(new SourceSpan(16, 3), new SourceSpan(11, 3)), new SourceMapping(new SourceSpan(19, 10), new SourceSpan(5, 10)) - }); + ]); var range = new LinePositionSpan(new LinePosition(1, 10), new LinePosition(1, 13)); // Act var result = service.TryMapToGeneratedDocumentRange( codeDoc.GetCSharpDocument(), range, // |var| abc - out var projectedRange); + out _); // Assert Assert.False(result); - Assert.Equal(default, projectedRange); } [Fact] @@ -1076,16 +1029,16 @@ private static RazorCodeDocument CreateCodeDocument(string text, IReadOnlyList sourceMappings) + private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { - var codeDocument = CreateCodeDocument(razorSource, Array.Empty()); + var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); var csharpDocument = RazorCSharpDocument.Create( codeDocument, projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), - Enumerable.Empty(), + diagnostics: [], sourceMappings.ToImmutableArray(), - Enumerable.Empty()); + linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; } From c755804389e0d364d0a446dddd5ef3faa8b07d89 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 14:20:46 -0700 Subject: [PATCH 105/271] Swap RazorCSharpDocument.Create methods for constructors --- .../test/RazorCodeDocumentExtensionsTest.cs | 4 +-- .../src/Language/RazorCSharpDocument.cs | 34 ++----------------- .../RazorDiagnosticsBenchmark.cs | 2 +- .../UnsupportedCSharpLoweringPhase.cs | 8 ++--- .../DefaultCSharpCodeActionProviderTest.cs | 2 +- ...TypeAccessibilityCodeActionProviderTest.cs | 2 +- ...nentAccessibilityCodeActionProviderTest.cs | 2 +- .../RazorDiagnosticsPublisherTest.cs | 2 +- .../FormattingLanguageServerTestBase.cs | 4 +-- .../Mapping/RazorLanguageQueryEndpointTest.cs | 2 +- .../RazorMapToDocumentRangesEndpointTest.cs | 3 +- .../RazorDocumentMappingServiceTest.cs | 4 +-- 12 files changed, 17 insertions(+), 52 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs index 51eb9b03956..c1fafa832a2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/RazorCodeDocumentExtensionsTest.cs @@ -113,7 +113,7 @@ public void GetCSharpDocument_ReturnsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); + var expected = new RazorCSharpDocument(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); codeDocument.Items[typeof(RazorCSharpDocument)] = expected; // Act @@ -129,7 +129,7 @@ public void SetCSharpDocument_SetsCSharpDocument() // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var expected = RazorCSharpDocument.Create(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); + var expected = new RazorCSharpDocument(codeDocument, "", RazorCodeGenerationOptions.CreateDefault(), diagnostics: []); // Act codeDocument.SetCSharpDocument(expected); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index 20baddcb80b..f31792488e2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Collections.Immutable; -using System.Linq; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; namespace Microsoft.AspNetCore.Razor.Language; @@ -22,11 +21,12 @@ public RazorCSharpDocument( string generatedCode, RazorCodeGenerationOptions options, RazorDiagnostic[] diagnostics, - ImmutableArray sourceMappings, - ImmutableArray linePragmas) + ImmutableArray sourceMappings = default, + ImmutableArray linePragmas = default) { ArgHelper.ThrowIfNull(codeDocument); ArgHelper.ThrowIfNull(generatedCode); + ArgHelper.ThrowIfNull(options); CodeDocument = codeDocument; GeneratedCode = generatedCode; @@ -36,32 +36,4 @@ public RazorCSharpDocument( SourceMappings = sourceMappings.NullToEmpty(); LinePragmas = linePragmas.NullToEmpty(); } - - public static RazorCSharpDocument Create( - RazorCodeDocument codeDocument, - string generatedCode, - RazorCodeGenerationOptions options, - IEnumerable diagnostics) - { - ArgHelper.ThrowIfNull(generatedCode); - ArgHelper.ThrowIfNull(options); - ArgHelper.ThrowIfNull(diagnostics); - - return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings: [], linePragmas: []); - } - - public static RazorCSharpDocument Create( - RazorCodeDocument codeDocument, - string generatedCode, - RazorCodeGenerationOptions options, - IEnumerable diagnostics, - ImmutableArray sourceMappings, - ImmutableArray linePragmas) - { - ArgHelper.ThrowIfNull(generatedCode); - ArgHelper.ThrowIfNull(options); - ArgHelper.ThrowIfNull(diagnostics); - - return new(codeDocument, generatedCode, options, diagnostics.ToArray(), sourceMappings, linePragmas); - } } diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index 0c49b8c5865..b07988f16c3 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -57,7 +57,7 @@ public void Setup() var stringSourceDocument = RazorSourceDocument.Create(GetFileContents(), UTF8Encoding.UTF8, RazorSourceDocumentProperties.Default); var mockRazorCodeDocument = new Mock(MockBehavior.Strict); - var mockRazorCSharpDocument = RazorCSharpDocument.Create( + var mockRazorCSharpDocument = new RazorCSharpDocument( mockRazorCodeDocument.Object, GeneratedCode, RazorCodeGenerationOptions.CreateDesignTimeDefault(), diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs index c709d943666..606a35ef44b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectEngineHost/UnsupportedCSharpLoweringPhase.cs @@ -14,12 +14,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument) var documentNode = codeDocument.GetDocumentIntermediateNode(); ThrowForMissingDocumentDependency(documentNode); - var cSharpDocument = RazorCSharpDocument.Create( - codeDocument, - UnsupportedDisclaimer, - documentNode.Options, - diagnostics: []); - codeDocument.SetCSharpDocument(cSharpDocument); + var csharpDocument = new RazorCSharpDocument(codeDocument, UnsupportedDisclaimer, documentNode.Options, diagnostics: []); + codeDocument.SetCSharpDocument(csharpDocument); codeDocument.SetUnsupported(); } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs index fb1bd67fc0b..bd93514e88f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs @@ -329,7 +329,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs index 5b48f7c4293..610e0462269 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs @@ -460,7 +460,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs index e9e6fd617ac..56874c402da 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs @@ -460,7 +460,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP var csharpDocument = codeDocument.GetCSharpDocument(); var diagnosticDescriptor = new RazorDiagnosticDescriptor("RZ10012", "diagnostic", RazorDiagnosticSeverity.Error); var diagnostic = RazorDiagnostic.Create(diagnosticDescriptor, componentSourceSpan); - var csharpDocumentWithDiagnostic = RazorCSharpDocument.Create(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); + var csharpDocumentWithDiagnostic = new RazorCSharpDocument(codeDocument, csharpDocument.GeneratedCode, csharpDocument.Options, [diagnostic]); codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs index 31587d73146..58e03d3d2bc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs @@ -528,7 +528,7 @@ public void ClearClosedDocuments_RestartsTimerIfDocumentsStillOpen() private static RazorCodeDocument CreateCodeDocument(IEnumerable diagnostics) { var codeDocument = TestRazorCodeDocument.Create("hello"); - var razorCSharpDocument = RazorCSharpDocument.Create(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics.ToImmutableArray()); + var razorCSharpDocument = new RazorCSharpDocument(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics.ToImmutableArray()); codeDocument.SetCSharpDocument(razorCSharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 7e924e88a2a..70ad34fc7a9 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; @@ -24,7 +22,7 @@ internal static RazorCodeDocument CreateCodeDocument(string content, ImmutableAr var sourceDocument = TestRazorSourceDocument.Create(content); var codeDocument = RazorCodeDocument.Create(sourceDocument); var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, RazorParserOptions.CreateDefault()); - var razorCSharpDocument = RazorCSharpDocument.Create( + var razorCSharpDocument = new RazorCSharpDocument( codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), diagnostics: [], sourceMappings, linePragmas: []); codeDocument.SetSyntaxTree(syntaxTree); codeDocument.SetCSharpDocument(razorCSharpDocument); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs index eb3985c14be..406250585c4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs @@ -145,7 +145,7 @@ public async Task Handle_Unsupported_ResolvesLanguageRequest_Html() private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); - var csharpDocument = RazorCSharpDocument.Create( + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index b9a3f275cc3..bda6189e8e6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -2,7 +2,6 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -232,7 +231,7 @@ public async Task Handle_MapToDocumentRanges_Unsupported() private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string razorSource, string projectedCSharpSource, ImmutableArray sourceMappings) { var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); - var csharpDocument = RazorCSharpDocument.Create( + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index 533abcd0638..ec594997150 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -1032,12 +1032,12 @@ private static RazorCodeDocument CreateCodeDocument(string text, IReadOnlyList sourceMappings) { var codeDocument = CreateCodeDocument(razorSource, tagHelpers: []); - var csharpDocument = RazorCSharpDocument.Create( + var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, RazorCodeGenerationOptions.CreateDefault(), diagnostics: [], - sourceMappings.ToImmutableArray(), + sourceMappings, linePragmas: []); codeDocument.SetCSharpDocument(csharpDocument); return codeDocument; From ff63a4e603f8692cda7d3a6174d72d24da15f8a6 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 15:31:44 -0700 Subject: [PATCH 106/271] Use pooled ImmutableArray builder for CodeRenderingContext diagnostics --- .../CodeGeneration/CodeRenderingContext.cs | 30 ++++++++++--------- .../CodeGeneration/DefaultDocumentWriter.cs | 8 ++--- .../src/Language/RazorCSharpDocument.cs | 4 +-- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index b3517e1055f..4741616f544 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -21,13 +21,13 @@ public sealed class CodeRenderingContext : IDisposable public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } - public RazorDiagnosticCollection Diagnostics { get; } public ItemCollection Items { get; } private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; private readonly PooledObject> _pooledAncestors; + private readonly PooledObject.Builder> _pooledDiagnostics; private readonly PooledObject> _pooledScopeStack; private readonly PooledObject.Builder> _pooledSourceMappings; private readonly PooledObject.Builder> _pooledLinePragmas; @@ -48,15 +48,14 @@ public CodeRenderingContext( Options = options; _pooledAncestors = StackPool.GetPooledObject(); - Diagnostics = []; + _pooledDiagnostics = ArrayBuilderPool.GetPooledObject(); Items = []; _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); _pooledLinePragmas = ArrayBuilderPool.GetPooledObject(); - var diagnostics = _documentNode.GetAllDiagnostics(); - for (var i = 0; i < diagnostics.Count; i++) + foreach (var diagnostic in _documentNode.GetAllDiagnostics().AsEnumerable()) { - Diagnostics.Add(diagnostics[i]); + Diagnostics.Add(diagnostic); } // Set new line character to a specific string regardless of platform, for testing purposes. @@ -70,6 +69,16 @@ public CodeRenderingContext( scopeStack.Push(new(nodeWriter)); } + public void Dispose() + { + _pooledAncestors.Dispose(); + _pooledDiagnostics.Dispose(); + _pooledLinePragmas.Dispose(); + _pooledScopeStack.Dispose(); + _pooledSourceMappings.Dispose(); + CodeWriter.Dispose(); + } + // This will be initialized by the document writer when the context is 'live'. public IntermediateNodeVisitor Visitor { get; set; } @@ -77,6 +86,8 @@ public CodeRenderingContext( internal Stack AncestorsInternal => _pooledAncestors.Object; + public ImmutableArray.Builder Diagnostics => _pooledDiagnostics.Object; + public string DocumentKind => _documentNode.DocumentKind; public ImmutableArray.Builder SourceMappings => _pooledSourceMappings.Object; @@ -175,13 +186,4 @@ public void AddLinePragma(LinePragma linePragma) { LinePragmas.Add(linePragma); } - - public void Dispose() - { - _pooledAncestors.Dispose(); - _pooledLinePragmas.Dispose(); - _pooledScopeStack.Dispose(); - _pooledSourceMappings.Dispose(); - CodeWriter.Dispose(); - } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 92c8a3ca94d..e85abc5cdec 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -4,6 +4,7 @@ #nullable disable using System; +using System.Collections.Immutable; using System.Linq; using System.Security.Cryptography; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -42,14 +43,13 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument context.Visitor.VisitDocument(documentNode); - var cSharp = context.CodeWriter.GenerateCode(); + var csharp = context.CodeWriter.GenerateCode(); - var allOrderedDiagnostics = context.Diagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); return new RazorCSharpDocument( codeDocument, - cSharp, + csharp, _options, - allOrderedDiagnostics.ToArray(), + context.Diagnostics.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex), context.SourceMappings.DrainToImmutable(), context.LinePragmas.DrainToImmutable()); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index f31792488e2..c80197d42fc 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -20,7 +20,7 @@ public RazorCSharpDocument( RazorCodeDocument codeDocument, string generatedCode, RazorCodeGenerationOptions options, - RazorDiagnostic[] diagnostics, + ImmutableArray diagnostics, ImmutableArray sourceMappings = default, ImmutableArray linePragmas = default) { @@ -32,7 +32,7 @@ public RazorCSharpDocument( GeneratedCode = generatedCode; Options = options; - Diagnostics = diagnostics ?? []; + Diagnostics = diagnostics.NullToEmpty(); SourceMappings = sourceMappings.NullToEmpty(); LinePragmas = linePragmas.NullToEmpty(); } From 90f90ef875f705837c23484de64f372a717ce537 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 15:38:38 -0700 Subject: [PATCH 107/271] Switch RazorCSharpDocument.Diagnostics to an ImmutableArray --- .../CodeGenerationIntegrationTest.cs | 2 +- .../CodeGenerationIntegrationTest.cs | 4 ++-- .../CodeGenerationIntegrationTest.cs | 4 ++-- .../src/Language/RazorCSharpDocument.cs | 5 ++--- .../SourceGenerators/RazorSourceGenerator.cs | 5 ++--- .../CodeGenerationBenchmark.cs | 4 ++-- .../RazorWrapperFactory.cs | 20 ------------------- .../DocumentPullDiagnosticsEndpoint.cs | 2 +- 8 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 045fc2ee3af..0e1e4627bb0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -66,7 +66,7 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs index bc3aa19c9c1..4f0c1e71fab 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -85,7 +85,7 @@ public class MyService AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] @@ -536,7 +536,7 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs index de4dd521d8e..36a5ecf0f63 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -92,7 +92,7 @@ public class MyService AssertLinePragmas(compiled.CodeDocument, designTime: false); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] @@ -949,7 +949,7 @@ public class MyService AssertSourceMappingsMatchBaseline(compiled.CodeDocument); // We expect this test to generate a bunch of errors. - Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Count > 0); + Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } [Fact] diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs index c80197d42fc..2a00090ac94 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCSharpDocument.cs @@ -1,7 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -using System.Collections.Generic; using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; @@ -12,9 +11,9 @@ public sealed class RazorCSharpDocument : IRazorGeneratedDocument public RazorCodeDocument CodeDocument { get; } public string GeneratedCode { get; } public RazorCodeGenerationOptions Options { get; } - public IReadOnlyList Diagnostics { get; } + public ImmutableArray Diagnostics { get; } public ImmutableArray SourceMappings { get; } - internal ImmutableArray LinePragmas { get; } + public ImmutableArray LinePragmas { get; } public RazorCSharpDocument( RazorCodeDocument codeDocument, diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs index f7bdfb0310e..0fe65e3eb60 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/SourceGenerators/RazorSourceGenerator.cs @@ -313,7 +313,7 @@ public void Initialize(IncrementalGeneratorInitializationContext context) }) .WithLambdaComparer(static (a, b) => { - if (a.csharpDocument.Diagnostics.Count > 0 || b.csharpDocument.Diagnostics.Count > 0) + if (a.csharpDocument.Diagnostics.Length > 0 || b.csharpDocument.Diagnostics.Length > 0) { // if there are any diagnostics, treat the documents as unequal and force RegisterSourceOutput to be called uncached. return false; @@ -339,9 +339,8 @@ public void Initialize(IncrementalGeneratorInitializationContext context) var hintName = GetIdentifierFromPath(filePath) + ".g.cs"; RazorSourceGeneratorEventSource.Log.AddSyntaxTrees(hintName); - for (var i = 0; i < csharpDocument.Diagnostics.Count; i++) + foreach (var razorDiagnostic in csharpDocument.Diagnostics) { - var razorDiagnostic = csharpDocument.Diagnostics[i]; var csharpDiagnostic = razorDiagnostic.AsDiagnostic(); context.ReportDiagnostic(csharpDiagnostic); } diff --git a/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs b/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs index 42bf5b84580..90a85e481e8 100644 --- a/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs +++ b/src/Compiler/perf/Microbenchmarks/CodeGenerationBenchmark.cs @@ -39,7 +39,7 @@ public void CodeGeneration_DesignTime_LargeStaticFile() var codeDocument = ProjectEngine.ProcessDesignTime(MSN); var generated = codeDocument.GetCSharpDocument(); - if (generated.Diagnostics.Count != 0) + if (generated.Diagnostics.Length > 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); } @@ -51,7 +51,7 @@ public void CodeGeneration_Runtime_LargeStaticFile() var codeDocument = ProjectEngine.Process(MSN); var generated = codeDocument.GetCSharpDocument(); - if (generated.Diagnostics.Count != 0) + if (generated.Diagnostics.Length > 0) { throw new Exception("Error!" + Environment.NewLine + string.Join(Environment.NewLine, generated.Diagnostics)); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs index 216ffd6c9ca..e2014f4b761 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.ExternalAccess.LegacyEditor/RazorWrapperFactory.cs @@ -58,26 +58,6 @@ private static ImmutableArray WrapAll(ImmutableArray WrapAll(IReadOnlyList list, Func createWrapper) - where TInner : class - where TResult : class - { - var count = list.Count; - if (count == 0) - { - return ImmutableArray.Empty; - } - - using var builder = new PooledArrayBuilder(capacity: count); - - for (var i = 0; i < count; i++) - { - builder.Add(createWrapper(list[i])); - } - - return builder.DrainToImmutable(); - } - private static ImmutableArray WrapAll(IEnumerable items, Func createWrapper) where TInner : class where TResult : class diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs index 68d893f9b24..5550bd39c40 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Diagnostics/DocumentPullDiagnosticsEndpoint.cs @@ -128,7 +128,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentDiagno var csharpDocument = codeDocument.GetCSharpDocument(); var diagnostics = csharpDocument.Diagnostics; - if (diagnostics.Count == 0) + if (diagnostics.Length == 0) { return null; } From 5072db43b563009c0192ed3eddce2aed11d6a955 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 16:00:20 -0700 Subject: [PATCH 108/271] Clean up pooled objects in CodeRenderingContext --- .../DesignTimeNodeWriterTest.cs | 6 +- .../DefaultTagHelperTargetExtensionTest.cs | 8 +- ...reallocatedAttributeTargetExtensionTest.cs | 2 +- .../CodeGeneration/CodeRenderingContext.cs | 108 ++++++++++-------- .../CodeGeneration/DefaultDocumentWriter.cs | 6 +- .../Components/ComponentNodeWriter.cs | 2 +- .../DefaultTagHelperTargetExtension.cs | 4 +- .../Intermediate/ExtensionIntermediateNode.cs | 2 +- 8 files changed, 76 insertions(+), 62 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs index cb41431080b..d34c08ea4b9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DesignTimeNodeWriterTest.cs @@ -58,7 +58,7 @@ public void WriteUsingDirective_WithSource_WritesContentWithLinePragmaAndMapping writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(context.SourceMappings); + var mapping = Assert.Single(context.GetSourceMappings()); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -94,7 +94,7 @@ public void WriteUsingDirective_WithSourceAndLineDirectives_WritesContentWithLin writer.WriteUsingDirective(context, node); // Assert - var mapping = Assert.Single(context.SourceMappings); + var mapping = Assert.Single(context.GetSourceMappings()); Assert.Equal(expectedSourceMapping, mapping); var csharp = context.CodeWriter.GenerateCode(); Assert.Equal( @@ -587,7 +587,7 @@ public void LinePragma_Enhanced_Is_Adjusted_On_Windows(string fileName, string e csharp, ignoreLineEndingDifferences: true); - Assert.Single(context.SourceMappings); + Assert.Single(context.GetSourceMappings()); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs index 937e8ccbfbc..b7095e5c7dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/DefaultTagHelperTargetExtensionTest.cs @@ -370,7 +370,7 @@ public void RenderTagHelperAttributeInline_NonString_StatementInAttribute_Errors extension.RenderTagHelperAttributeInline(context, node, new CSharpCodeIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -392,7 +392,7 @@ public void RenderTagHelperAttributeInline_NonStringIndexerMatch_TemplateInAttri extension.RenderTagHelperAttributeInline(context, node, new TemplateIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -416,7 +416,7 @@ public void RenderTagHelperAttributeInline_NonString_TemplateInAttribute_Errors( extension.RenderTagHelperAttributeInline(context, node, new TemplateIntermediateNode(), expectedLocation); // Assert - var diagnostic = Assert.Single(context.Diagnostics); + var diagnostic = Assert.Single(context.GetDiagnostics()); Assert.Equal(expectedDiagnostic, diagnostic); } @@ -1148,7 +1148,7 @@ public void GetDeterministicId_IsDeterministic() private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - context.AncestorsInternal.Push(node); + context.PushAncestor(node); } private static TagHelperDescriptor CreateTagHelperDescriptor( diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs index f0ca482b667..6981ece7703 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Extensions/PreallocatedAttributeTargetExtensionTest.cs @@ -273,6 +273,6 @@ public void WriteSetPreallocatedTagHelperProperty_IndexerAttribute_MultipleValue private static void Push(CodeRenderingContext context, TagHelperIntermediateNode node) { - context.AncestorsInternal.Push(node); + context.PushAncestor(node); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 4741616f544..36e78e38a95 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -26,11 +26,15 @@ public sealed class CodeRenderingContext : IDisposable private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; - private readonly PooledObject> _pooledAncestors; - private readonly PooledObject.Builder> _pooledDiagnostics; - private readonly PooledObject> _pooledScopeStack; - private readonly PooledObject.Builder> _pooledSourceMappings; - private readonly PooledObject.Builder> _pooledLinePragmas; + private readonly Stack _ancestorStack; + private readonly Stack _scopeStack; + + private readonly ImmutableArray.Builder _diagnostics; + private readonly ImmutableArray.Builder _sourceMappings; + private readonly ImmutableArray.Builder _linePragmas; + + public string DocumentKind => _documentNode.DocumentKind; + public RazorSourceDocument SourceDocument => _codeDocument.Source; public CodeRenderingContext( IntermediateNodeWriter nodeWriter, @@ -47,61 +51,56 @@ public CodeRenderingContext( _documentNode = documentNode; Options = options; - _pooledAncestors = StackPool.GetPooledObject(); - _pooledDiagnostics = ArrayBuilderPool.GetPooledObject(); - Items = []; - _pooledSourceMappings = ArrayBuilderPool.GetPooledObject(); - _pooledLinePragmas = ArrayBuilderPool.GetPooledObject(); + _ancestorStack = StackPool.Default.Get(); + _scopeStack = StackPool.Default.Get(); + _scopeStack.Push(new(nodeWriter)); + + _diagnostics = ArrayBuilderPool.Default.Get(); foreach (var diagnostic in _documentNode.GetAllDiagnostics().AsEnumerable()) { - Diagnostics.Add(diagnostic); + _diagnostics.Add(diagnostic); } + _linePragmas = ArrayBuilderPool.Default.Get(); + _sourceMappings = ArrayBuilderPool.Default.Get(); + + Items = []; + // Set new line character to a specific string regardless of platform, for testing purposes. var newLineString = codeDocument.Items[NewLineString] as string ?? Environment.NewLine; CodeWriter = new CodeWriter(newLineString, options); Items[NewLineString] = codeDocument.Items[NewLineString]; Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; - - _pooledScopeStack = StackPool.GetPooledObject(out var scopeStack); - scopeStack.Push(new(nodeWriter)); } public void Dispose() { - _pooledAncestors.Dispose(); - _pooledDiagnostics.Dispose(); - _pooledLinePragmas.Dispose(); - _pooledScopeStack.Dispose(); - _pooledSourceMappings.Dispose(); + StackPool.Default.Return(_ancestorStack); + StackPool.Default.Return(_scopeStack); + + ArrayBuilderPool.Default.Return(_diagnostics); + ArrayBuilderPool.Default.Return(_linePragmas); + ArrayBuilderPool.Default.Return(_sourceMappings); + CodeWriter.Dispose(); } // This will be initialized by the document writer when the context is 'live'. public IntermediateNodeVisitor Visitor { get; set; } - public IEnumerable Ancestors => _pooledAncestors.Object; - - internal Stack AncestorsInternal => _pooledAncestors.Object; - - public ImmutableArray.Builder Diagnostics => _pooledDiagnostics.Object; + public IntermediateNodeWriter NodeWriter => _scopeStack.Peek().Writer; - public string DocumentKind => _documentNode.DocumentKind; - - public ImmutableArray.Builder SourceMappings => _pooledSourceMappings.Object; - - internal ImmutableArray.Builder LinePragmas => _pooledLinePragmas.Object; - - public IntermediateNodeWriter NodeWriter => Current.Writer; + public IntermediateNode Parent => _ancestorStack.Count == 0 ? null : _ancestorStack.Peek(); - public IntermediateNode Parent => AncestorsInternal.Count == 0 ? null : AncestorsInternal.Peek(); - - public RazorSourceDocument SourceDocument => _codeDocument.Source; + public void AddDiagnostic(RazorDiagnostic diagnostic) + { + _diagnostics.Add(diagnostic); + } - private Stack ScopeStack => _pooledScopeStack.Object; - private ScopeInternal Current => ScopeStack.Peek(); + public ImmutableArray GetDiagnostics() + => _diagnostics.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex); public void AddSourceMappingFor(IntermediateNode node) { @@ -124,26 +123,33 @@ public void AddSourceMappingFor(SourceSpan source, int offset = 0) return; } - var currentLocation = CodeWriter.Location with { AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, CharacterIndex = CodeWriter.Location.CharacterIndex + offset }; + var currentLocation = CodeWriter.Location with + { + AbsoluteIndex = CodeWriter.Location.AbsoluteIndex + offset, + CharacterIndex = CodeWriter.Location.CharacterIndex + offset + }; var generatedLocation = new SourceSpan(currentLocation, source.Length); var sourceMapping = new SourceMapping(source, generatedLocation); - SourceMappings.Add(sourceMapping); + _sourceMappings.Add(sourceMapping); } + public ImmutableArray GetSourceMappings() + => _sourceMappings.DrainToImmutable(); + public void RenderChildren(IntermediateNode node) { ArgHelper.ThrowIfNull(node); - AncestorsInternal.Push(node); + _ancestorStack.Push(node); for (var i = 0; i < node.Children.Count; i++) { Visitor.Visit(node.Children[i]); } - AncestorsInternal.Pop(); + _ancestorStack.Pop(); } public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) @@ -151,16 +157,16 @@ public void RenderChildren(IntermediateNode node, IntermediateNodeWriter writer) ArgHelper.ThrowIfNull(node); ArgHelper.ThrowIfNull(writer); - ScopeStack.Push(new ScopeInternal(writer)); - AncestorsInternal.Push(node); + _scopeStack.Push(new ScopeInternal(writer)); + _ancestorStack.Push(node); for (var i = 0; i < node.Children.Count; i++) { Visitor.Visit(node.Children[i]); } - AncestorsInternal.Pop(); - ScopeStack.Pop(); + _ancestorStack.Pop(); + _scopeStack.Pop(); } public void RenderNode(IntermediateNode node) @@ -175,15 +181,23 @@ public void RenderNode(IntermediateNode node, IntermediateNodeWriter writer) ArgHelper.ThrowIfNull(node); ArgHelper.ThrowIfNull(writer); - ScopeStack.Push(new ScopeInternal(writer)); + _scopeStack.Push(new ScopeInternal(writer)); Visitor.Visit(node); - ScopeStack.Pop(); + _scopeStack.Pop(); } public void AddLinePragma(LinePragma linePragma) { - LinePragmas.Add(linePragma); + _linePragmas.Add(linePragma); + } + + public ImmutableArray GetLinePragmas() + => _linePragmas.DrainToImmutable(); + + public void PushAncestor(IntermediateNode node) + { + _ancestorStack.Push(node); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index e85abc5cdec..cd9a8ab0833 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -49,9 +49,9 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument codeDocument, csharp, _options, - context.Diagnostics.ToImmutableOrderedBy(static d => d.Span.AbsoluteIndex), - context.SourceMappings.DrainToImmutable(), - context.LinePragmas.DrainToImmutable()); + context.GetDiagnostics(), + context.GetSourceMappings(), + context.GetLinePragmas()); } private class Visitor : IntermediateNodeVisitor diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs index 01fc235d3ed..9e924a6b382 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs @@ -58,7 +58,7 @@ public sealed override void WriteCSharpCodeAttributeValue(CodeRenderingContext c // // We provide an error for this case just to be friendly. var content = string.Join("", node.Children.OfType().Select(t => t.Content)); - context.Diagnostics.Add(ComponentDiagnosticFactory.Create_CodeBlockInAttribute(node.Source, content)); + context.AddDiagnostic(ComponentDiagnosticFactory.Create_CodeBlockInAttribute(node.Source, content)); return; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs index 59c1dcc7619..6cac602ba7b 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs @@ -584,13 +584,13 @@ internal void RenderTagHelperAttributeInline( else if (node is CSharpCodeIntermediateNode) { var diagnostic = RazorDiagnosticFactory.CreateTagHelper_CodeBlocksNotSupportedInAttributes(span); - context.Diagnostics.Add(diagnostic); + context.AddDiagnostic(diagnostic); } else if (node is TemplateIntermediateNode) { var expectedTypeName = property.IsIndexerNameMatch ? property.BoundAttribute.IndexerTypeName : property.BoundAttribute.TypeName; var diagnostic = RazorDiagnosticFactory.CreateTagHelper_InlineMarkupBlocksNotSupportedInAttributes(span, expectedTypeName); - context.Diagnostics.Add(diagnostic); + context.AddDiagnostic(diagnostic); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs index df5d210c550..7495f8e2995 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/ExtensionIntermediateNode.cs @@ -34,7 +34,7 @@ protected void ReportMissingCodeTargetExtension(CodeRenderingContex } var documentKind = context.DocumentKind ?? string.Empty; - context.Diagnostics.Add( + context.AddDiagnostic( RazorDiagnosticFactory.CreateCodeTarget_UnsupportedExtension( documentKind, typeof(TDependency))); From 34507da4436794ac3a0f359252c5bb576a92abb8 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Fri, 9 Aug 2024 17:24:16 -0700 Subject: [PATCH 109/271] Avoid extra allocations in IntermediateNodeExtensions.GetAllDiagnostics --- ...entDuplicateAttributeDiagnosticPassTest.cs | 2 +- .../CodeGeneration/CodeRenderingContext.cs | 2 +- .../IntermediateNodeExtensions.cs | 44 ++++++++----------- .../PooledObjects/PooledHashSet`1.cs | 7 ++- 4 files changed, 26 insertions(+), 29 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs index 34743b31272..c542ab950b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Components/ComponentDuplicateAttributeDiagnosticPassTest.cs @@ -141,7 +141,7 @@ public void Execute_FindDuplicate_Multiple() var diagnostics = documentNode.GetAllDiagnostics(); var nodes = documentNode.FindDescendantNodes().Where(n => n.HasDiagnostics).ToArray(); - Assert.Equal(2, diagnostics.Count); + Assert.Equal(2, diagnostics.Length); Assert.Equal(2, nodes.Length); for (var i = 0; i < 2; i++) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 36e78e38a95..1016f7d2d05 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -57,7 +57,7 @@ public CodeRenderingContext( _diagnostics = ArrayBuilderPool.Default.Get(); - foreach (var diagnostic in _documentNode.GetAllDiagnostics().AsEnumerable()) + foreach (var diagnostic in _documentNode.GetAllDiagnostics()) { _diagnostics.Add(diagnostic); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs index 72516dd6dcb..8cc6a373a85 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Intermediate/IntermediateNodeExtensions.cs @@ -3,17 +3,15 @@ #nullable disable -using System; using System.Collections.Generic; -using System.Linq; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.Language.Components; +using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language.Intermediate; public static class IntermediateNodeExtensions { - private static readonly IReadOnlyList EmptyDiagnostics = Array.Empty(); - public static bool IsImported(this IntermediateNode node) { return ReferenceEquals(node.Annotations[CommonAnnotations.Imported], CommonAnnotations.Imported); @@ -26,36 +24,32 @@ public static bool IsDesignTimePropertyAccessHelper(this IntermediateNode tagHel result; } - public static IReadOnlyList GetAllDiagnostics(this IntermediateNode node) + public static ImmutableArray GetAllDiagnostics(this IntermediateNode node) { - if (node == null) - { - throw new ArgumentNullException(nameof(node)); - } - - HashSet diagnostics = null; - - AddAllDiagnostics(node); + ArgHelper.ThrowIfNull(node); - var allOrderedDiagnostics = diagnostics?.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); + var diagnostics = new PooledHashSet(); + try + { + CollectDiagnostics(node, ref diagnostics); - return allOrderedDiagnostics?.ToList() ?? EmptyDiagnostics; + return diagnostics.OrderByAsArray(static d => d.Span.AbsoluteIndex); + } + finally + { + diagnostics.ClearAndFree(); + } - void AddAllDiagnostics(IntermediateNode n) + static void CollectDiagnostics(IntermediateNode node, ref PooledHashSet diagnostics) { - if (n.HasDiagnostics) + if (node.HasDiagnostics) { - if (diagnostics == null) - { - diagnostics = new HashSet(); - } - - diagnostics.UnionWith(n.Diagnostics); + diagnostics.UnionWith(node.Diagnostics); } - for (var i = 0; i < n.Children.Count; i++) + foreach (var childNode in node.Children) { - AddAllDiagnostics(n.Children[i]); + CollectDiagnostics(childNode, ref diagnostics); } } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs index c5ac61e1248..ff006967ea4 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledHashSet`1.cs @@ -67,10 +67,13 @@ public readonly bool Contains(T item) => _set?.Contains(item) ?? false; public readonly T[] ToArray() - => _set?.ToArray() ?? Array.Empty(); + => _set?.ToArray() ?? []; public readonly ImmutableArray ToImmutableArray() - => _set?.ToImmutableArray() ?? ImmutableArray.Empty; + => _set?.ToImmutableArray() ?? []; + + public readonly ImmutableArray OrderByAsArray(Func keySelector) + => _set?.OrderByAsArray(keySelector) ?? []; public void UnionWith(IList? other) { From 7ac711be8cdbd155c8db0d4dd4a2f483684247d9 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 12 Aug 2024 15:52:51 -0700 Subject: [PATCH 110/271] Remove ItemCollection from CodeRenderingContext --- .../Language/CodeGeneration/CodeRenderingContext.cs | 13 +++++-------- .../Extensions/DefaultTagHelperTargetExtension.cs | 2 +- .../RazorToolingIntegrationTestBase.cs | 4 +--- .../CodeGeneration/TestCodeRenderingContext.cs | 8 ++++---- .../IntegrationTests/IntegrationTestBase.cs | 4 ++-- .../IntegrationTests/RazorIntegrationTestBase.cs | 5 +---- 6 files changed, 14 insertions(+), 22 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 1016f7d2d05..045be588210 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -15,13 +15,13 @@ public sealed class CodeRenderingContext : IDisposable { private readonly record struct ScopeInternal(IntermediateNodeWriter Writer); - internal static readonly object NewLineString = "NewLineString"; + internal static readonly object NewLineStringKey = "NewLineString"; - internal static readonly object SuppressUniqueIds = "SuppressUniqueIds"; + internal static readonly object SuppressUniqueIdsKey = "SuppressUniqueIds"; public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } - public ItemCollection Items { get; } + public string SuppressUniqueIds { get; } private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; @@ -65,14 +65,11 @@ public CodeRenderingContext( _linePragmas = ArrayBuilderPool.Default.Get(); _sourceMappings = ArrayBuilderPool.Default.Get(); - Items = []; - // Set new line character to a specific string regardless of platform, for testing purposes. - var newLineString = codeDocument.Items[NewLineString] as string ?? Environment.NewLine; + var newLineString = codeDocument.Items[NewLineStringKey] as string ?? Environment.NewLine; CodeWriter = new CodeWriter(newLineString, options); - Items[NewLineString] = codeDocument.Items[NewLineString]; - Items[SuppressUniqueIds] = codeDocument.Items[SuppressUniqueIds] ?? options.SuppressUniqueIds; + SuppressUniqueIds = codeDocument.Items[SuppressUniqueIdsKey] as string ?? options.SuppressUniqueIds; } public void Dispose() diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs index 6cac602ba7b..9509bb6cd61 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs @@ -101,7 +101,7 @@ public void WriteTagHelperBody(CodeRenderingContext context, DefaultTagHelperBod // Assign a unique ID for this instance of the source HTML tag. This must be unique // per call site, e.g. if the tag is on the view twice, there should be two IDs. - var uniqueId = (string)context.Items[CodeRenderingContext.SuppressUniqueIds]; + var uniqueId = context.SuppressUniqueIds; if (uniqueId == null) { uniqueId = GetDeterministicId(context); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs index d473acb5ccc..f51221d8a55 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs @@ -441,9 +441,7 @@ public ForceLineEndingPhase(string lineEnding) protected override void ExecuteCore(RazorCodeDocument codeDocument) { - var field = typeof(CodeRenderingContext).GetField("NewLineString", BindingFlags.Static | BindingFlags.NonPublic); - var key = field.GetValue(null); - codeDocument.Items[key] = LineEnding; + codeDocument.Items[CodeRenderingContext.NewLineStringKey] = LineEnding; } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index f665107bcdd..9a524babdc5 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -26,12 +26,12 @@ public static CodeRenderingContext CreateDesignTime( var codeDocument = RazorCodeDocument.Create(source); if (newLineString != null) { - codeDocument.Items[CodeRenderingContext.NewLineString] = newLineString; + codeDocument.Items[CodeRenderingContext.NewLineStringKey] = newLineString; } if (suppressUniqueIds != null) { - codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = suppressUniqueIds; + codeDocument.Items[CodeRenderingContext.SuppressUniqueIdsKey] = suppressUniqueIds; } if (nodeWriter == null) @@ -62,12 +62,12 @@ public static CodeRenderingContext CreateRuntime( var codeDocument = RazorCodeDocument.Create(source); if (newLineString != null) { - codeDocument.Items[CodeRenderingContext.NewLineString] = newLineString; + codeDocument.Items[CodeRenderingContext.NewLineStringKey] = newLineString; } if (suppressUniqueIds != null) { - codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = suppressUniqueIds; + codeDocument.Items[CodeRenderingContext.SuppressUniqueIdsKey] = suppressUniqueIds; } if (nodeWriter == null) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs index ae9ba577a3b..0a1312c9404 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs @@ -793,8 +793,8 @@ public ConfigureCodeRenderingPhase(string lineEnding) protected override void ExecuteCore(RazorCodeDocument codeDocument) { - codeDocument.Items[CodeRenderingContext.SuppressUniqueIds] = "test"; - codeDocument.Items[CodeRenderingContext.NewLineString] = LineEnding; + codeDocument.Items[CodeRenderingContext.SuppressUniqueIdsKey] = "test"; + codeDocument.Items[CodeRenderingContext.NewLineStringKey] = LineEnding; } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs index 2335670b3b5..8927dd3a578 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs @@ -8,7 +8,6 @@ using System.Collections.Immutable; using System.IO; using System.Linq; -using System.Reflection; using System.Runtime.InteropServices; using System.Text; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; @@ -500,9 +499,7 @@ public ForceLineEndingPhase(string lineEnding) protected override void ExecuteCore(RazorCodeDocument codeDocument) { - var field = typeof(CodeRenderingContext).GetField("NewLineString", BindingFlags.Static | BindingFlags.NonPublic); - var key = field.GetValue(null); - codeDocument.Items[key] = LineEnding; + codeDocument.Items[CodeRenderingContext.NewLineStringKey] = LineEnding; } } From 03e2d074c0f2406f663133837b9c309302c8e648 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 08:45:19 -0700 Subject: [PATCH 111/271] Merge RazorCodeGenerationOptionsBuilder and DefaultRazorCodeGenerationOptionsBuilder --- .../DefaultDocumentWriterTest.cs | 2 +- ...efaultRazorCodeGenerationOptionsBuilder.cs | 76 ------------------- ...eGenerationOptionsFactoryProjectFeature.cs | 2 +- .../Language/RazorCodeGenerationOptions.cs | 4 +- .../RazorCodeGenerationOptionsBuilder.cs | 72 +++++++++++++----- 5 files changed, 57 insertions(+), 99 deletions(-) delete mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs index 1351dc789ff..ed4f43234c1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs @@ -110,7 +110,7 @@ public void WriteDocument_Empty_SuppressChecksumTrue_DoesnotWriteChecksum() var document = new DocumentIntermediateNode(); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var optionsBuilder = new DefaultRazorCodeGenerationOptionsBuilder(designTime: false) + var optionsBuilder = new RazorCodeGenerationOptionsBuilder(designTime: false) { SuppressChecksum = true }; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs deleted file mode 100644 index 12816f28a9a..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsBuilder.cs +++ /dev/null @@ -1,76 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCodeGenerationOptionsBuilder : RazorCodeGenerationOptionsBuilder -{ - private bool _designTime; - - public DefaultRazorCodeGenerationOptionsBuilder(RazorConfiguration configuration, string fileKind) - { - if (configuration == null) - { - throw new ArgumentNullException(nameof(configuration)); - } - - Configuration = configuration; - FileKind = fileKind; - } - - public DefaultRazorCodeGenerationOptionsBuilder(bool designTime) - { - _designTime = designTime; - } - - public override RazorConfiguration Configuration { get; } - - public override bool DesignTime => _designTime; - - public override string FileKind { get; } - - public override int IndentSize { get; set; } = 4; - - public override bool IndentWithTabs { get; set; } - - public override bool SuppressChecksum { get; set; } - - public override bool SuppressNullabilityEnforcement { get; set; } - - public override bool OmitMinimizedComponentAttributeValues { get; set; } - - public override bool SupportLocalizedComponentNames { get; set; } - - public override bool UseEnhancedLinePragma { get; set; } - - public override RazorCodeGenerationOptions Build() - { - return new DefaultRazorCodeGenerationOptions( - IndentWithTabs, - IndentSize, - DesignTime, - RootNamespace, - SuppressChecksum, - SuppressMetadataAttributes, - SuppressPrimaryMethodBody, - SuppressNullabilityEnforcement, - OmitMinimizedComponentAttributeValues, - SupportLocalizedComponentNames, - UseEnhancedLinePragma, - SuppressUniqueIds, - SuppressAddComponentParameter, - RemapLinePragmaPathsOnWindows) - { - SuppressMetadataSourceChecksumAttributes = SuppressMetadataSourceChecksumAttributes, - }; - } - - public override void SetDesignTime(bool designTime) - { - _designTime = designTime; - } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs index feeb5b3a12b..759821593db 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptionsFactoryProjectFeature.cs @@ -19,7 +19,7 @@ protected override void OnInitialized() public RazorCodeGenerationOptions Create(string fileKind, Action configure) { - var builder = new DefaultRazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration, fileKind); + var builder = new RazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration, fileKind); configure?.Invoke(builder); for (var i = 0; i < _configureOptions.Length; i++) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index a055dddf6e8..889ad9697c5 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -54,7 +54,7 @@ public static RazorCodeGenerationOptions Create(Action null; + private bool _designTime; + + public RazorConfiguration? Configuration { get; } - public abstract bool DesignTime { get; } + public bool DesignTime => _designTime; - public virtual string FileKind => null; + public string? FileKind { get; } - public abstract int IndentSize { get; set; } + public int IndentSize { get; set; } = 4; - public abstract bool IndentWithTabs { get; set; } + public bool IndentWithTabs { get; set; } /// /// Gets or sets the root namespace of the generated code. /// - public virtual string RootNamespace { get; set; } + public string? RootNamespace { get; set; } /// /// Gets or sets a value that indicates whether to suppress the default #pragma checksum directive in the @@ -31,7 +31,7 @@ public abstract class RazorCodeGenerationOptionsBuilder /// The #pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public abstract bool SuppressChecksum { get; set; } + public bool SuppressChecksum { get; set; } /// /// Gets or sets a value that indicates whether to suppress the default metadata attributes in the generated @@ -49,7 +49,7 @@ public abstract class RazorCodeGenerationOptionsBuilder /// a reference to Microsoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public virtual bool SuppressMetadataAttributes { get; set; } + public bool SuppressMetadataAttributes { get; set; } /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -63,32 +63,32 @@ public abstract class RazorCodeGenerationOptionsBuilder /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public virtual bool SuppressPrimaryMethodBody { get; set; } + public bool SuppressPrimaryMethodBody { get; set; } /// /// Gets or sets a value that determines if nullability type enforcement should be suppressed for user code. /// - public virtual bool SuppressNullabilityEnforcement { get; set; } + public bool SuppressNullabilityEnforcement { get; set; } /// /// Gets or sets a value that determines if the components code writer may omit values for minimized attributes. /// - public virtual bool OmitMinimizedComponentAttributeValues { get; set; } + public bool OmitMinimizedComponentAttributeValues { get; set; } /// /// Gets or sets a value that determines if localized component names are to be supported. /// - public virtual bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames { get; set; } /// /// Gets or sets a value that determines if enhanced line pragmas are to be utilized. /// - public virtual bool UseEnhancedLinePragma { get; set; } + public bool UseEnhancedLinePragma { get; set; } /// /// Gets or sets a value that determines if unique ids are suppressed for testing. /// - internal string SuppressUniqueIds { get; set; } + internal string? SuppressUniqueIds { get; set; } /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. @@ -100,9 +100,43 @@ public abstract class RazorCodeGenerationOptionsBuilder /// internal bool RemapLinePragmaPathsOnWindows { get; set; } - public abstract RazorCodeGenerationOptions Build(); + public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration, string fileKind) + { + ArgHelper.ThrowIfNull(configuration); + + Configuration = configuration; + FileKind = fileKind; + } + + public RazorCodeGenerationOptionsBuilder(bool designTime) + { + _designTime = designTime; + } + + public RazorCodeGenerationOptions Build() + { + return new DefaultRazorCodeGenerationOptions( + IndentWithTabs, + IndentSize, + DesignTime, + RootNamespace, + SuppressChecksum, + SuppressMetadataAttributes, + SuppressPrimaryMethodBody, + SuppressNullabilityEnforcement, + OmitMinimizedComponentAttributeValues, + SupportLocalizedComponentNames, + UseEnhancedLinePragma, + SuppressUniqueIds, + SuppressAddComponentParameter, + RemapLinePragmaPathsOnWindows) + { + SuppressMetadataSourceChecksumAttributes = SuppressMetadataSourceChecksumAttributes, + }; + } - public virtual void SetDesignTime(bool designTime) + public void SetDesignTime(bool designTime) { + _designTime = designTime; } } From 972691bc1ea2a9b559299288f6b75d3da3d5b7d1 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 08:55:05 -0700 Subject: [PATCH 112/271] Merge RazorCodeGenerationOptions and DefaultRazorCodeGenerationOptions --- .../DefaultRazorCodeGenerationOptions.cs | 57 ----- .../Language/RazorCodeGenerationOptions.cs | 198 ++++++++++-------- .../RazorCodeGenerationOptionsBuilder.cs | 2 +- 3 files changed, 112 insertions(+), 145 deletions(-) delete mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs deleted file mode 100644 index 76fe6018dd7..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorCodeGenerationOptions.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorCodeGenerationOptions : RazorCodeGenerationOptions -{ - public DefaultRazorCodeGenerationOptions( - bool indentWithTabs, - int indentSize, - bool designTime, - string rootNamespace, - bool suppressChecksum, - bool suppressMetadataAttributes, - bool suppressPrimaryMethodBody, - bool suppressNullabilityEnforcement, - bool omitMinimizedComponentAttributeValues, - bool supportLocalizedComponentNames, - bool useEnhancedLinePragma, - string suppressUniqueIds, - bool suppressAddComponentParameter, - bool remapLinePragmaPathsOnWindows) - { - IndentWithTabs = indentWithTabs; - IndentSize = indentSize; - DesignTime = designTime; - RootNamespace = rootNamespace; - SuppressChecksum = suppressChecksum; - SuppressMetadataAttributes = suppressMetadataAttributes; - SuppressPrimaryMethodBody = suppressPrimaryMethodBody; - SuppressNullabilityEnforcement = suppressNullabilityEnforcement; - OmitMinimizedComponentAttributeValues = omitMinimizedComponentAttributeValues; - SupportLocalizedComponentNames = supportLocalizedComponentNames; - UseEnhancedLinePragma = useEnhancedLinePragma; - SuppressUniqueIds = suppressUniqueIds; - SuppressAddComponentParameter = suppressAddComponentParameter; - RemapLinePragmaPathsOnWindows = remapLinePragmaPathsOnWindows; - } - - public override bool DesignTime { get; } - - public override bool IndentWithTabs { get; } - - public override int IndentSize { get; } - - public override string RootNamespace { get; } - - public override bool SuppressChecksum { get; } - - public override bool SuppressNullabilityEnforcement { get; } - - public override bool OmitMinimizedComponentAttributeValues { get; } - - public override bool UseEnhancedLinePragma { get; } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index 889ad9697c5..ceda7b6499a 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -1,94 +1,22 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorCodeGenerationOptions +public sealed class RazorCodeGenerationOptions { - public static RazorCodeGenerationOptions CreateDefault() - { - return new DefaultRazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: false, - suppressChecksum: false, - rootNamespace: null, - suppressMetadataAttributes: false, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: false); - } - - public static RazorCodeGenerationOptions CreateDesignTimeDefault() - { - return new DefaultRazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: true, - rootNamespace: null, - suppressChecksum: false, - suppressMetadataAttributes: true, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: true); - } - - public static RazorCodeGenerationOptions Create(Action configure) - { - if (configure == null) - { - throw new ArgumentNullException(nameof(configure)); - } - - var builder = new RazorCodeGenerationOptionsBuilder(designTime: false); - configure(builder); - var options = builder.Build(); - - return options; - } - - public static RazorCodeGenerationOptions CreateDesignTime(Action configure) - { - if (configure == null) - { - throw new ArgumentNullException(nameof(configure)); - } - - var builder = new RazorCodeGenerationOptionsBuilder(designTime: true) - { - SuppressMetadataAttributes = true, - }; - - configure(builder); - var options = builder.Build(); - - return options; - } - - public abstract bool DesignTime { get; } + public bool DesignTime { get; } - public abstract bool IndentWithTabs { get; } + public bool IndentWithTabs { get; } - public abstract int IndentSize { get; } + public int IndentSize { get; } /// /// Gets the root namespace for the generated code. /// - public virtual string RootNamespace { get; } + public string? RootNamespace { get; } /// /// Gets a value that indicates whether to suppress the default #pragma checksum directive in the @@ -99,7 +27,7 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action#pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public abstract bool SuppressChecksum { get; } + public bool SuppressChecksum { get; } /// /// Gets a value that indicates whether to suppress the default metadata attributes in the generated @@ -117,7 +45,7 @@ public static RazorCodeGenerationOptions CreateDesignTime(ActionMicrosoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public virtual bool SuppressMetadataAttributes { get; protected set; } + public bool SuppressMetadataAttributes { get; } /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -131,40 +59,136 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public virtual bool SuppressPrimaryMethodBody { get; protected set; } + public bool SuppressPrimaryMethodBody { get; } /// /// Gets a value that determines if nullability type enforcement should be suppressed for user code. /// - public virtual bool SuppressNullabilityEnforcement { get; } + public bool SuppressNullabilityEnforcement { get; } /// /// Gets a value that determines if the components code writer may omit values for minimized attributes. /// - public virtual bool OmitMinimizedComponentAttributeValues { get; } + public bool OmitMinimizedComponentAttributeValues { get; } /// /// Gets a value that determines if localized component names are to be supported. /// - public virtual bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames { get; set; } /// /// Gets a value that determines if enhanced line pragmas are to be utilized. /// - public virtual bool UseEnhancedLinePragma { get; } + public bool UseEnhancedLinePragma { get; } /// /// Gets a value used for unique ids for testing purposes. Null for unique ids. /// - internal string SuppressUniqueIds { get; private protected init; } + internal string? SuppressUniqueIds { get; } /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - internal bool SuppressAddComponentParameter { get; private protected init; } + internal bool SuppressAddComponentParameter { get; } /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - public bool RemapLinePragmaPathsOnWindows { get; private protected init; } + public bool RemapLinePragmaPathsOnWindows { get; } + + public RazorCodeGenerationOptions( + bool indentWithTabs, + int indentSize, + bool designTime, + string? rootNamespace, + bool suppressChecksum, + bool suppressMetadataAttributes, + bool suppressPrimaryMethodBody, + bool suppressNullabilityEnforcement, + bool omitMinimizedComponentAttributeValues, + bool supportLocalizedComponentNames, + bool useEnhancedLinePragma, + string? suppressUniqueIds, + bool suppressAddComponentParameter, + bool remapLinePragmaPathsOnWindows) + { + IndentWithTabs = indentWithTabs; + IndentSize = indentSize; + DesignTime = designTime; + RootNamespace = rootNamespace; + SuppressChecksum = suppressChecksum; + SuppressMetadataAttributes = suppressMetadataAttributes; + SuppressPrimaryMethodBody = suppressPrimaryMethodBody; + SuppressNullabilityEnforcement = suppressNullabilityEnforcement; + OmitMinimizedComponentAttributeValues = omitMinimizedComponentAttributeValues; + SupportLocalizedComponentNames = supportLocalizedComponentNames; + UseEnhancedLinePragma = useEnhancedLinePragma; + SuppressUniqueIds = suppressUniqueIds; + SuppressAddComponentParameter = suppressAddComponentParameter; + RemapLinePragmaPathsOnWindows = remapLinePragmaPathsOnWindows; + } + + public static RazorCodeGenerationOptions CreateDefault() + { + return new RazorCodeGenerationOptions( + indentWithTabs: false, + indentSize: 4, + designTime: false, + suppressChecksum: false, + rootNamespace: null, + suppressMetadataAttributes: false, + suppressPrimaryMethodBody: false, + suppressNullabilityEnforcement: false, + omitMinimizedComponentAttributeValues: false, + supportLocalizedComponentNames: false, + useEnhancedLinePragma: true, + suppressUniqueIds: null, + suppressAddComponentParameter: false, + remapLinePragmaPathsOnWindows: false); + } + + public static RazorCodeGenerationOptions CreateDesignTimeDefault() + { + return new RazorCodeGenerationOptions( + indentWithTabs: false, + indentSize: 4, + designTime: true, + rootNamespace: null, + suppressChecksum: false, + suppressMetadataAttributes: true, + suppressPrimaryMethodBody: false, + suppressNullabilityEnforcement: false, + omitMinimizedComponentAttributeValues: false, + supportLocalizedComponentNames: false, + useEnhancedLinePragma: true, + suppressUniqueIds: null, + suppressAddComponentParameter: false, + remapLinePragmaPathsOnWindows: true); + } + + public static RazorCodeGenerationOptions Create(Action configure) + { + ArgHelper.ThrowIfNull(configure); + + var builder = new RazorCodeGenerationOptionsBuilder(designTime: false); + configure(builder); + var options = builder.Build(); + + return options; + } + + public static RazorCodeGenerationOptions CreateDesignTime(Action configure) + { + ArgHelper.ThrowIfNull(configure); + + var builder = new RazorCodeGenerationOptionsBuilder(designTime: true) + { + SuppressMetadataAttributes = true, + }; + + configure(builder); + var options = builder.Build(); + + return options; + } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs index 1849298b08a..ebaacf58b8f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs @@ -115,7 +115,7 @@ public RazorCodeGenerationOptionsBuilder(bool designTime) public RazorCodeGenerationOptions Build() { - return new DefaultRazorCodeGenerationOptions( + return new RazorCodeGenerationOptions( IndentWithTabs, IndentSize, DesignTime, From dd11c5e0dbd01e910c512fb97d94d80b838ccbcb Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 09:39:47 -0700 Subject: [PATCH 113/271] Clean up RazorCodeGenerationOptions a bit --- .../AssemblyAttributeInjectionPassTest.cs | 20 +-- .../test/InstrumentationPassTest.cs | 18 +-- .../test/CodeGeneration/CodeTargetTest.cs | 8 +- .../DefaultCodeTargetBuilderTest.cs | 2 +- .../CodeGeneration/DefaultCodeTargetTest.cs | 16 +- .../DefaultDocumentWriterTest.cs | 20 +-- .../test/DefaultDocumentClassifierPassTest.cs | 4 +- .../DefaultRazorCSharpLoweringPhaseTest.cs | 2 +- ...tRazorIntermediateNodeLoweringPhaseTest.cs | 2 +- .../test/DocumentClassifierPassBaseTest.cs | 16 +- .../test/RazorCodeDocumentExtensionsTest.cs | 8 +- .../src/Language/CodeGeneration/CodeWriter.cs | 2 +- ...eGenerationOptionsFactoryProjectFeature.cs | 4 +- ...eGenerationOptionsFactoryProjectFeature.cs | 2 +- .../Language/RazorCodeGenerationOptions.cs | 153 ++++++++---------- .../RazorCodeGenerationOptionsBuilder.cs | 15 +- .../src/Language/RazorProjectEngine.cs | 4 +- .../RazorDiagnosticsBenchmark.cs | 2 +- .../RazorDiagnosticsPublisherTest.cs | 2 +- .../FormattingLanguageServerTestBase.cs | 2 +- .../Mapping/RazorLanguageQueryEndpointTest.cs | 2 +- .../RazorMapToDocumentRangesEndpointTest.cs | 2 +- .../RazorDocumentMappingServiceTest.cs | 2 +- .../TestCodeRenderingContext.cs | 4 +- 24 files changed, 141 insertions(+), 171 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs index 7ea5db9a39c..431c1ffef9a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/AssemblyAttributeInjectionPassTest.cs @@ -19,7 +19,7 @@ public void Execute_NoOps_IfNamespaceNodeIsMissing() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new AssemblyAttributeInjectionPass @@ -40,7 +40,7 @@ public void Execute_NoOps_IfNamespaceNodeHasEmptyContent() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode() { Content = string.Empty }; @@ -66,7 +66,7 @@ public void Execute_NoOps_IfClassNameNodeIsMissing() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); @@ -93,7 +93,7 @@ public void Execute_NoOps_IfClassNameIsEmpty() // Arrange var irDocument = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -134,7 +134,7 @@ public void Execute_NoOps_IfDocumentIsNotViewOrPage() var irDocument = new DocumentIntermediateNode { DocumentKind = "Default", - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode() { Content = "SomeNamespace" }; @@ -170,7 +170,7 @@ public void Execute_NoOps_ForDesignTime() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDesignTimeDefault(), + Options = RazorCodeGenerationOptions.DesignTimeDefault, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -217,7 +217,7 @@ public void Execute_AddsRazorViewAttribute_ToViews() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -270,7 +270,7 @@ public void Execute_EscapesViewPathWhenAddingAttributeToViews() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode @@ -323,7 +323,7 @@ public void Execute_AddsRazorPagettribute_ToPage() var irDocument = new DocumentIntermediateNode { DocumentKind = RazorPageDocumentClassifierPass.RazorPageDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var pageDirective = new DirectiveIntermediateNode @@ -383,7 +383,7 @@ public void Execute_EscapesViewPathAndRouteWhenAddingAttributeToPage() var irDocument = new DocumentIntermediateNode { DocumentKind = MvcViewDocumentClassifierPass.MvcViewDocumentKind, - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(irDocument); var @namespace = new NamespaceDeclarationIntermediateNode diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs index d5ac8364cc5..40723f0f28f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/InstrumentationPassTest.cs @@ -18,7 +18,7 @@ public void InstrumentationPass_NoOps_ForDesignTime() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDesignTimeDefault(), + Options = RazorCodeGenerationOptions.DesignTimeDefault, }; var builder = IntermediateNodeBuilder.Create(document); @@ -50,7 +50,7 @@ public void InstrumentationPass_InstrumentsHtml() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -89,7 +89,7 @@ public void InstrumentationPass_SkipsHtml_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -121,7 +121,7 @@ public void InstrumentationPass_InstrumentsCSharpExpression() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -157,7 +157,7 @@ public void InstrumentationPass_SkipsCSharpExpression_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -188,7 +188,7 @@ public void InstrumentationPass_SkipsCSharpExpression_InsideTagHelperAttribute() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -239,7 +239,7 @@ public void InstrumentationPass_SkipsCSharpExpression_InsideTagHelperProperty() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -290,7 +290,7 @@ public void InstrumentationPass_InstrumentsTagHelper() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); @@ -321,7 +321,7 @@ public void InstrumentationPass_SkipsTagHelper_WithoutLocation() // Arrange var document = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var builder = IntermediateNodeBuilder.Create(document); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs index 8d6f8d7f170..29ffd24e1f8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CodeTargetTest.cs @@ -15,7 +15,7 @@ public void CreateDefault_CreatesDefaultCodeTarget() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act var target = CodeTarget.CreateDefault(codeDocument, options); @@ -32,7 +32,7 @@ public void CreateDefault_CallsDelegate() Action @delegate = (b) => { wasCalled = true; }; var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, @delegate); @@ -46,7 +46,7 @@ public void CreateDefault_AllowsNullDelegate() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, configure: null); @@ -59,7 +59,7 @@ public void CreateEmpty_AllowsNullDelegate() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; // Act CodeTarget.CreateDefault(codeDocument, options, configure: null); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs index c2fc301395f..654d44608a0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetBuilderTest.cs @@ -14,7 +14,7 @@ public void Build_CreatesDefaultCodeTarget() { // Arrange var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var builder = new DefaultCodeTargetBuilder(codeDocument, options); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs index 50624d004e4..a8dbc432063 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultCodeTargetTest.cs @@ -14,7 +14,7 @@ public class DefaultCodeTargetTest public void Constructor_CreatesDefensiveCopy() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -33,7 +33,7 @@ public void Constructor_CreatesDefensiveCopy() public void CreateWriter_DesignTime_CreatesDesignTimeNodeWriter() { // Arrange - var options = RazorCodeGenerationOptions.CreateDesignTimeDefault(); + var options = RazorCodeGenerationOptions.DesignTimeDefault; var target = new DefaultCodeTarget(options, Enumerable.Empty()); // Act @@ -47,7 +47,7 @@ public void CreateWriter_DesignTime_CreatesDesignTimeNodeWriter() public void CreateWriter_Runtime_CreatesRuntimeNodeWriter() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = new DefaultCodeTarget(options, Enumerable.Empty()); // Act @@ -61,7 +61,7 @@ public void CreateWriter_Runtime_CreatesRuntimeNodeWriter() public void HasExtension_ReturnsTrue_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -82,7 +82,7 @@ public void HasExtension_ReturnsTrue_WhenExtensionFound() public void HasExtension_ReturnsFalse_WhenExtensionNotFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -103,7 +103,7 @@ public void HasExtension_ReturnsFalse_WhenExtensionNotFound() public void GetExtension_ReturnsExtension_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -124,7 +124,7 @@ public void GetExtension_ReturnsExtension_WhenExtensionFound() public void GetExtension_ReturnsFirstMatch_WhenExtensionFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { @@ -148,7 +148,7 @@ public void GetExtension_ReturnsFirstMatch_WhenExtensionFound() public void GetExtension_ReturnsNull_WhenExtensionNotFound() { // Arrange - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var extensions = new ICodeTargetExtension[] { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs index ed4f43234c1..9a9ad5d22b3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/DefaultDocumentWriterTest.cs @@ -20,7 +20,7 @@ public void WriteDocument_EndToEnd_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -51,7 +51,7 @@ public void WriteDocument_SHA1_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = RazorCodeDocument.Create(sourceDocument); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -82,7 +82,7 @@ public void WriteDocument_SHA256_WritesChecksumAndMarksAutoGenerated() var document = new DocumentIntermediateNode(); var codeDocument = RazorCodeDocument.Create(sourceDocument); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -144,7 +144,7 @@ public void WriteDocument_WritesNamespace() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -192,7 +192,7 @@ public void WriteDocument_WritesClass() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -243,7 +243,7 @@ public void WriteDocument_WithNullableContext_WritesClass() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -292,7 +292,7 @@ public void WriteDocument_WritesClass_ConstrainedGenericTypeParameters() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -355,7 +355,7 @@ public void WriteDocument_WritesMethod() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -399,7 +399,7 @@ public void WriteDocument_WritesField() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); @@ -439,7 +439,7 @@ public void WriteDocument_WritesProperty() }); var codeDocument = TestRazorCodeDocument.CreateEmpty(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; var target = CodeTarget.CreateDefault(codeDocument, options); var writer = new DefaultDocumentWriter(target, options); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs index 6936b9451e1..2b1a4822e1d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultDocumentClassifierPassTest.cs @@ -23,7 +23,7 @@ public void Execute_IgnoresDocumentsWithDocumentKind() var documentNode = new DocumentIntermediateNode() { DocumentKind = "ignore", - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new DefaultDocumentClassifierPass(); @@ -43,7 +43,7 @@ public void Execute_CreatesClassStructure() // Arrange var documentNode = new DocumentIntermediateNode() { - Options = RazorCodeGenerationOptions.CreateDefault(), + Options = RazorCodeGenerationOptions.Default, }; var pass = new DefaultDocumentClassifierPass(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs index 4a535879206..b8efdb27514 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorCSharpLoweringPhaseTest.cs @@ -66,7 +66,7 @@ public void Execute_CollatesIRDocumentDiagnosticsFromSourceDocument() var phase = new DefaultRazorCSharpLoweringPhase(); var engine = RazorProjectEngine.CreateEmpty(b => b.Phases.Add(phase)); var codeDocument = TestRazorCodeDocument.Create("

().ToArray(); } - public RazorCodeGenerationOptions Create(string fileKind, Action configure) + public RazorCodeGenerationOptions Create(Action configure) { - var builder = new RazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration, fileKind); + var builder = new RazorCodeGenerationOptionsBuilder(ProjectEngine.Configuration); configure?.Invoke(builder); for (var i = 0; i < _configureOptions.Length; i++) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs index 9865f4d792c..3c42ef62a00 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/IRazorCodeGenerationOptionsFactoryProjectFeature.cs @@ -9,5 +9,5 @@ namespace Microsoft.AspNetCore.Razor.Language; internal interface IRazorCodeGenerationOptionsFactoryProjectFeature : IRazorProjectEngineFeature { - RazorCodeGenerationOptions Create(string fileKind, Action configure); + RazorCodeGenerationOptions Create(Action configure); } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index ceda7b6499a..af2aa5e8a8c 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -5,18 +5,31 @@ namespace Microsoft.AspNetCore.Razor.Language; -public sealed class RazorCodeGenerationOptions +public sealed class RazorCodeGenerationOptions( + bool indentWithTabs, + int indentSize, + bool designTime, + string? rootNamespace, + bool suppressChecksum, + bool suppressMetadataAttributes, + bool suppressMetadataSourceChecksumAttributes, + bool suppressPrimaryMethodBody, + bool suppressNullabilityEnforcement, + bool omitMinimizedComponentAttributeValues, + bool supportLocalizedComponentNames, + bool useEnhancedLinePragma, + string? suppressUniqueIds, + bool suppressAddComponentParameter, + bool remapLinePragmaPathsOnWindows) { - public bool DesignTime { get; } - - public bool IndentWithTabs { get; } - - public int IndentSize { get; } + public bool DesignTime { get; } = designTime; + public bool IndentWithTabs { get; } = indentWithTabs; + public int IndentSize { get; } = indentSize; ///

/// Gets the root namespace for the generated code. /// - public string? RootNamespace { get; } + public string? RootNamespace { get; } = rootNamespace; /// /// Gets a value that indicates whether to suppress the default #pragma checksum directive in the @@ -27,7 +40,7 @@ public sealed class RazorCodeGenerationOptions /// The #pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public bool SuppressChecksum { get; } + public bool SuppressChecksum { get; } = suppressChecksum; /// /// Gets a value that indicates whether to suppress the default metadata attributes in the generated @@ -45,7 +58,7 @@ public sealed class RazorCodeGenerationOptions /// a reference to Microsoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public bool SuppressMetadataAttributes { get; } + public bool SuppressMetadataAttributes { get; } = suppressMetadataAttributes; /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -54,117 +67,81 @@ public sealed class RazorCodeGenerationOptions /// edit are treated as rude edits by hot reload. /// /// - internal bool SuppressMetadataSourceChecksumAttributes { get; set; } + public bool SuppressMetadataSourceChecksumAttributes { get; } = suppressMetadataSourceChecksumAttributes; /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public bool SuppressPrimaryMethodBody { get; } + public bool SuppressPrimaryMethodBody { get; } = suppressPrimaryMethodBody; /// /// Gets a value that determines if nullability type enforcement should be suppressed for user code. /// - public bool SuppressNullabilityEnforcement { get; } + public bool SuppressNullabilityEnforcement { get; } = suppressNullabilityEnforcement; /// /// Gets a value that determines if the components code writer may omit values for minimized attributes. /// - public bool OmitMinimizedComponentAttributeValues { get; } + public bool OmitMinimizedComponentAttributeValues { get; } = omitMinimizedComponentAttributeValues; /// /// Gets a value that determines if localized component names are to be supported. /// - public bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames { get; set; } = supportLocalizedComponentNames; /// /// Gets a value that determines if enhanced line pragmas are to be utilized. /// - public bool UseEnhancedLinePragma { get; } + public bool UseEnhancedLinePragma { get; } = useEnhancedLinePragma; /// /// Gets a value used for unique ids for testing purposes. Null for unique ids. /// - internal string? SuppressUniqueIds { get; } + public string? SuppressUniqueIds { get; } = suppressUniqueIds; /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - internal bool SuppressAddComponentParameter { get; } + public bool SuppressAddComponentParameter { get; } = suppressAddComponentParameter; /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - public bool RemapLinePragmaPathsOnWindows { get; } - - public RazorCodeGenerationOptions( - bool indentWithTabs, - int indentSize, - bool designTime, - string? rootNamespace, - bool suppressChecksum, - bool suppressMetadataAttributes, - bool suppressPrimaryMethodBody, - bool suppressNullabilityEnforcement, - bool omitMinimizedComponentAttributeValues, - bool supportLocalizedComponentNames, - bool useEnhancedLinePragma, - string? suppressUniqueIds, - bool suppressAddComponentParameter, - bool remapLinePragmaPathsOnWindows) - { - IndentWithTabs = indentWithTabs; - IndentSize = indentSize; - DesignTime = designTime; - RootNamespace = rootNamespace; - SuppressChecksum = suppressChecksum; - SuppressMetadataAttributes = suppressMetadataAttributes; - SuppressPrimaryMethodBody = suppressPrimaryMethodBody; - SuppressNullabilityEnforcement = suppressNullabilityEnforcement; - OmitMinimizedComponentAttributeValues = omitMinimizedComponentAttributeValues; - SupportLocalizedComponentNames = supportLocalizedComponentNames; - UseEnhancedLinePragma = useEnhancedLinePragma; - SuppressUniqueIds = suppressUniqueIds; - SuppressAddComponentParameter = suppressAddComponentParameter; - RemapLinePragmaPathsOnWindows = remapLinePragmaPathsOnWindows; - } - - public static RazorCodeGenerationOptions CreateDefault() - { - return new RazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: false, - suppressChecksum: false, - rootNamespace: null, - suppressMetadataAttributes: false, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: false); - } - - public static RazorCodeGenerationOptions CreateDesignTimeDefault() - { - return new RazorCodeGenerationOptions( - indentWithTabs: false, - indentSize: 4, - designTime: true, - rootNamespace: null, - suppressChecksum: false, - suppressMetadataAttributes: true, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: true); - } + public bool RemapLinePragmaPathsOnWindows { get; } = remapLinePragmaPathsOnWindows; + + public static RazorCodeGenerationOptions Default { get; } = new RazorCodeGenerationOptions( + indentWithTabs: false, + indentSize: 4, + designTime: false, + suppressChecksum: false, + rootNamespace: null, + suppressMetadataAttributes: false, + suppressMetadataSourceChecksumAttributes: false, + suppressPrimaryMethodBody: false, + suppressNullabilityEnforcement: false, + omitMinimizedComponentAttributeValues: false, + supportLocalizedComponentNames: false, + useEnhancedLinePragma: true, + suppressUniqueIds: null, + suppressAddComponentParameter: false, + remapLinePragmaPathsOnWindows: false); + + public static RazorCodeGenerationOptions DesignTimeDefault { get; } = new RazorCodeGenerationOptions( + indentWithTabs: false, + indentSize: 4, + designTime: true, + rootNamespace: null, + suppressChecksum: false, + suppressMetadataAttributes: true, + suppressMetadataSourceChecksumAttributes: false, + suppressPrimaryMethodBody: false, + suppressNullabilityEnforcement: false, + omitMinimizedComponentAttributeValues: false, + supportLocalizedComponentNames: false, + useEnhancedLinePragma: true, + suppressUniqueIds: null, + suppressAddComponentParameter: false, + remapLinePragmaPathsOnWindows: true); public static RazorCodeGenerationOptions Create(Action configure) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs index ebaacf58b8f..242e5e0b7ac 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs @@ -11,8 +11,6 @@ public sealed class RazorCodeGenerationOptionsBuilder public bool DesignTime => _designTime; - public string? FileKind { get; } - public int IndentSize { get; set; } = 4; public bool IndentWithTabs { get; set; } @@ -100,12 +98,11 @@ public sealed class RazorCodeGenerationOptionsBuilder /// internal bool RemapLinePragmaPathsOnWindows { get; set; } - public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration, string fileKind) + public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration) { ArgHelper.ThrowIfNull(configuration); Configuration = configuration; - FileKind = fileKind; } public RazorCodeGenerationOptionsBuilder(bool designTime) @@ -114,14 +111,14 @@ public RazorCodeGenerationOptionsBuilder(bool designTime) } public RazorCodeGenerationOptions Build() - { - return new RazorCodeGenerationOptions( + => new( IndentWithTabs, IndentSize, DesignTime, RootNamespace, SuppressChecksum, SuppressMetadataAttributes, + SuppressMetadataSourceChecksumAttributes, SuppressPrimaryMethodBody, SuppressNullabilityEnforcement, OmitMinimizedComponentAttributeValues, @@ -129,11 +126,7 @@ public RazorCodeGenerationOptions Build() UseEnhancedLinePragma, SuppressUniqueIds, SuppressAddComponentParameter, - RemapLinePragmaPathsOnWindows) - { - SuppressMetadataSourceChecksumAttributes = SuppressMetadataSourceChecksumAttributes, - }; - } + RemapLinePragmaPathsOnWindows); public void SetDesignTime(bool designTime) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs index 81afcdf946c..3675b59bf42 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorProjectEngine.cs @@ -185,7 +185,7 @@ internal RazorCodeDocument CreateCodeDocumentCore( ConfigureParserOptions(builder); configureParser?.Invoke(builder); }); - var codeGenerationOptions = GetRequiredFeature().Create(fileKind, builder => + var codeGenerationOptions = GetRequiredFeature().Create(builder => { ConfigureCodeGenerationOptions(builder); configureCodeGeneration?.Invoke(builder); @@ -261,7 +261,7 @@ private RazorCodeDocument CreateCodeDocumentDesignTimeCore( ConfigureDesignTimeParserOptions(builder); configureParser?.Invoke(builder); }); - var codeGenerationOptions = GetRequiredFeature().Create(fileKind, builder => + var codeGenerationOptions = GetRequiredFeature().Create(builder => { ConfigureDesignTimeCodeGenerationOptions(builder); configureCodeGeneration?.Invoke(builder); diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs index b07988f16c3..d6408537f53 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorDiagnosticsBenchmark.cs @@ -60,7 +60,7 @@ public void Setup() var mockRazorCSharpDocument = new RazorCSharpDocument( mockRazorCodeDocument.Object, GeneratedCode, - RazorCodeGenerationOptions.CreateDesignTimeDefault(), + RazorCodeGenerationOptions.DesignTimeDefault, diagnostics: [], SourceMappings, linePragmas: []); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs index 58e03d3d2bc..869786c9280 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Diagnostics/RazorDiagnosticsPublisherTest.cs @@ -528,7 +528,7 @@ public void ClearClosedDocuments_RestartsTimerIfDocumentsStillOpen() private static RazorCodeDocument CreateCodeDocument(IEnumerable diagnostics) { var codeDocument = TestRazorCodeDocument.Create("hello"); - var razorCSharpDocument = new RazorCSharpDocument(codeDocument, "hello", RazorCodeGenerationOptions.CreateDefault(), diagnostics.ToImmutableArray()); + var razorCSharpDocument = new RazorCSharpDocument(codeDocument, "hello", RazorCodeGenerationOptions.Default, diagnostics.ToImmutableArray()); codeDocument.SetCSharpDocument(razorCSharpDocument); return codeDocument; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 70ad34fc7a9..4403c977fbb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -23,7 +23,7 @@ internal static RazorCodeDocument CreateCodeDocument(string content, ImmutableAr var codeDocument = RazorCodeDocument.Create(sourceDocument); var syntaxTree = RazorSyntaxTree.Parse(sourceDocument, RazorParserOptions.CreateDefault()); var razorCSharpDocument = new RazorCSharpDocument( - codeDocument, content, RazorCodeGenerationOptions.CreateDefault(), diagnostics: [], sourceMappings, linePragmas: []); + codeDocument, content, RazorCodeGenerationOptions.Default, diagnostics: [], sourceMappings, linePragmas: []); codeDocument.SetSyntaxTree(syntaxTree); codeDocument.SetCSharpDocument(razorCSharpDocument); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs index 406250585c4..0a68fcf4892 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorLanguageQueryEndpointTest.cs @@ -148,7 +148,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), + RazorCodeGenerationOptions.Default, diagnostics: [], sourceMappings, linePragmas: []); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs index bda6189e8e6..ef39684a793 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Mapping/RazorMapToDocumentRangesEndpointTest.cs @@ -234,7 +234,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), + RazorCodeGenerationOptions.Default, diagnostics: [], sourceMappings, linePragmas: []); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index ec594997150..0895c0cbd82 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -1035,7 +1035,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions.CreateDefault(), + RazorCodeGenerationOptions. Default, diagnostics: [], sourceMappings, linePragmas: []); diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index 9a524babdc5..f597323bc77 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -16,7 +16,7 @@ public static CodeRenderingContext CreateDesignTime( IntermediateNodeWriter nodeWriter = null) { var documentNode = new DocumentIntermediateNode(); - var options = RazorCodeGenerationOptions.CreateDesignTimeDefault(); + var options = RazorCodeGenerationOptions.DesignTimeDefault; if (source == null) { @@ -52,7 +52,7 @@ public static CodeRenderingContext CreateRuntime( IntermediateNodeWriter nodeWriter = null) { var documentNode = new DocumentIntermediateNode(); - var options = RazorCodeGenerationOptions.CreateDefault(); + var options = RazorCodeGenerationOptions.Default; if (source == null) { From 96adc428f7cddf1364156132d84ff2413221b7b8 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 11:56:41 -0700 Subject: [PATCH 114/271] Collapse RazorCodeGenerationOptions boolean fields to a flags enum --- .../Language/RazorCodeGenerationOptions.cs | 79 +-- .../RazorCodeGenerationOptionsBuilder.cs | 98 ++-- .../RazorCodeGenerationOptionsFlags.cs | 26 + .../EnumExtensionsTests.cs | 525 ++++++++++++++++++ .../EnumExtensions.cs | 143 +++++ 5 files changed, 789 insertions(+), 82 deletions(-) create mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs create mode 100644 src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs create mode 100644 src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index af2aa5e8a8c..c06233cf657 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -6,24 +6,13 @@ namespace Microsoft.AspNetCore.Razor.Language; public sealed class RazorCodeGenerationOptions( - bool indentWithTabs, + RazorCodeGenerationOptionsFlags flags, int indentSize, - bool designTime, string? rootNamespace, - bool suppressChecksum, - bool suppressMetadataAttributes, - bool suppressMetadataSourceChecksumAttributes, - bool suppressPrimaryMethodBody, - bool suppressNullabilityEnforcement, - bool omitMinimizedComponentAttributeValues, - bool supportLocalizedComponentNames, - bool useEnhancedLinePragma, - string? suppressUniqueIds, - bool suppressAddComponentParameter, - bool remapLinePragmaPathsOnWindows) + string? suppressUniqueIds) { - public bool DesignTime { get; } = designTime; - public bool IndentWithTabs { get; } = indentWithTabs; + public bool DesignTime => flags.HasFlag(RazorCodeGenerationOptionsFlags.DesignTime); + public bool IndentWithTabs => flags.HasFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs); public int IndentSize { get; } = indentSize; /// @@ -40,7 +29,8 @@ public sealed class RazorCodeGenerationOptions( /// The #pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public bool SuppressChecksum { get; } = suppressChecksum; + public bool SuppressChecksum + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum); /// /// Gets a value that indicates whether to suppress the default metadata attributes in the generated @@ -58,7 +48,8 @@ public sealed class RazorCodeGenerationOptions( /// a reference to Microsoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public bool SuppressMetadataAttributes { get; } = suppressMetadataAttributes; + public bool SuppressMetadataAttributes + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -67,32 +58,38 @@ public sealed class RazorCodeGenerationOptions( /// edit are treated as rude edits by hot reload. /// /// - public bool SuppressMetadataSourceChecksumAttributes { get; } = suppressMetadataSourceChecksumAttributes; + public bool SuppressMetadataSourceChecksumAttributes + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public bool SuppressPrimaryMethodBody { get; } = suppressPrimaryMethodBody; + public bool SuppressPrimaryMethodBody + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); /// /// Gets a value that determines if nullability type enforcement should be suppressed for user code. /// - public bool SuppressNullabilityEnforcement { get; } = suppressNullabilityEnforcement; + public bool SuppressNullabilityEnforcement + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); /// /// Gets a value that determines if the components code writer may omit values for minimized attributes. /// - public bool OmitMinimizedComponentAttributeValues { get; } = omitMinimizedComponentAttributeValues; + public bool OmitMinimizedComponentAttributeValues + => flags.HasFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); /// /// Gets a value that determines if localized component names are to be supported. /// - public bool SupportLocalizedComponentNames { get; set; } = supportLocalizedComponentNames; + public bool SupportLocalizedComponentNames + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); /// /// Gets a value that determines if enhanced line pragmas are to be utilized. /// - public bool UseEnhancedLinePragma { get; } = useEnhancedLinePragma; + public bool UseEnhancedLinePragma + => flags.HasFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); /// /// Gets a value used for unique ids for testing purposes. Null for unique ids. @@ -102,46 +99,26 @@ public sealed class RazorCodeGenerationOptions( /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - public bool SuppressAddComponentParameter { get; } = suppressAddComponentParameter; + public bool SuppressAddComponentParameter + => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - public bool RemapLinePragmaPathsOnWindows { get; } = remapLinePragmaPathsOnWindows; + public bool RemapLinePragmaPathsOnWindows + => flags.HasFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); public static RazorCodeGenerationOptions Default { get; } = new RazorCodeGenerationOptions( - indentWithTabs: false, + flags: RazorCodeGenerationOptionsFlags.DefaultFlags, indentSize: 4, - designTime: false, - suppressChecksum: false, rootNamespace: null, - suppressMetadataAttributes: false, - suppressMetadataSourceChecksumAttributes: false, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: false); + suppressUniqueIds: null); public static RazorCodeGenerationOptions DesignTimeDefault { get; } = new RazorCodeGenerationOptions( - indentWithTabs: false, + flags: RazorCodeGenerationOptionsFlags.DefaultDesignTimeFlags, indentSize: 4, - designTime: true, rootNamespace: null, - suppressChecksum: false, - suppressMetadataAttributes: true, - suppressMetadataSourceChecksumAttributes: false, - suppressPrimaryMethodBody: false, - suppressNullabilityEnforcement: false, - omitMinimizedComponentAttributeValues: false, - supportLocalizedComponentNames: false, - useEnhancedLinePragma: true, - suppressUniqueIds: null, - suppressAddComponentParameter: false, - remapLinePragmaPathsOnWindows: true); + suppressUniqueIds: null); public static RazorCodeGenerationOptions Create(Action configure) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs index 242e5e0b7ac..e5042bd1545 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsBuilder.cs @@ -5,15 +5,19 @@ namespace Microsoft.AspNetCore.Razor.Language; public sealed class RazorCodeGenerationOptionsBuilder { - private bool _designTime; + private RazorCodeGenerationOptionsFlags _flags; public RazorConfiguration? Configuration { get; } - public bool DesignTime => _designTime; + public bool DesignTime => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.DesignTime); public int IndentSize { get; set; } = 4; - public bool IndentWithTabs { get; set; } + public bool IndentWithTabs + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.IndentWithTabs); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs, value); + } /// /// Gets or sets the root namespace of the generated code. @@ -29,7 +33,11 @@ public sealed class RazorCodeGenerationOptionsBuilder /// The #pragma checksum is required to enable debugging and should only be suppressed for testing /// purposes. /// - public bool SuppressChecksum { get; set; } + public bool SuppressChecksum + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressChecksum); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum, value); + } /// /// Gets or sets a value that indicates whether to suppress the default metadata attributes in the generated @@ -47,7 +55,11 @@ public sealed class RazorCodeGenerationOptionsBuilder /// a reference to Microsoft.AspNetCore.Razor.Runtime, or for testing purposes. /// /// - public bool SuppressMetadataAttributes { get; set; } + public bool SuppressMetadataAttributes + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes, value); + } /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -56,47 +68,79 @@ public sealed class RazorCodeGenerationOptionsBuilder /// edit are treated as rude edits by hot reload. /// /// - internal bool SuppressMetadataSourceChecksumAttributes { get; set; } + public bool SuppressMetadataSourceChecksumAttributes + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes, value); + } /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// - public bool SuppressPrimaryMethodBody { get; set; } + public bool SuppressPrimaryMethodBody + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody, value); + } /// /// Gets or sets a value that determines if nullability type enforcement should be suppressed for user code. /// - public bool SuppressNullabilityEnforcement { get; set; } + public bool SuppressNullabilityEnforcement + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement, value); + } /// /// Gets or sets a value that determines if the components code writer may omit values for minimized attributes. /// - public bool OmitMinimizedComponentAttributeValues { get; set; } + public bool OmitMinimizedComponentAttributeValues + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues, value); + } /// /// Gets or sets a value that determines if localized component names are to be supported. /// - public bool SupportLocalizedComponentNames { get; set; } + public bool SupportLocalizedComponentNames + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames, value); + } /// /// Gets or sets a value that determines if enhanced line pragmas are to be utilized. /// - public bool UseEnhancedLinePragma { get; set; } + public bool UseEnhancedLinePragma + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma, value); + } /// /// Gets or sets a value that determines if unique ids are suppressed for testing. /// - internal string? SuppressUniqueIds { get; set; } + public string? SuppressUniqueIds { get; set; } /// /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// - internal bool SuppressAddComponentParameter { get; set; } + public bool SuppressAddComponentParameter + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter, value); + } /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// - internal bool RemapLinePragmaPathsOnWindows { get; set; } + public bool RemapLinePragmaPathsOnWindows + { + get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); + set => _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows, value); + } public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration) { @@ -107,29 +151,21 @@ public RazorCodeGenerationOptionsBuilder(RazorConfiguration configuration) public RazorCodeGenerationOptionsBuilder(bool designTime) { - _designTime = designTime; + if (designTime) + { + _flags = RazorCodeGenerationOptionsFlags.DesignTime; + } } public RazorCodeGenerationOptions Build() => new( - IndentWithTabs, + _flags, IndentSize, - DesignTime, RootNamespace, - SuppressChecksum, - SuppressMetadataAttributes, - SuppressMetadataSourceChecksumAttributes, - SuppressPrimaryMethodBody, - SuppressNullabilityEnforcement, - OmitMinimizedComponentAttributeValues, - SupportLocalizedComponentNames, - UseEnhancedLinePragma, - SuppressUniqueIds, - SuppressAddComponentParameter, - RemapLinePragmaPathsOnWindows); - - public void SetDesignTime(bool designTime) + SuppressUniqueIds); + + public void SetDesignTime(bool value) { - _designTime = designTime; + _flags.UpdateFlag(RazorCodeGenerationOptionsFlags.DesignTime, value); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs new file mode 100644 index 00000000000..f0c651e8e40 --- /dev/null +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptionsFlags.cs @@ -0,0 +1,26 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; + +namespace Microsoft.AspNetCore.Razor.Language; + +[Flags] +public enum RazorCodeGenerationOptionsFlags +{ + DesignTime = 1 << 0, + IndentWithTabs = 1 << 1, + SuppressChecksum = 1 << 2, + SuppressMetadataAttributes = 1 << 3, + SuppressMetadataSourceChecksumAttributes = 1 << 4, + SuppressPrimaryMethodBody = 1 << 5, + SuppressNullabilityEnforcement = 1 << 6, + OmitMinimizedComponentAttributeValues = 1 << 7, + SupportLocalizedComponentNames = 1 << 8, + UseEnhancedLinePragma = 1 << 9, + SuppressAddComponentParameter = 1 << 10, + RemapLinePragmaPathsOnWindows = 1 << 11, + + DefaultFlags = UseEnhancedLinePragma, + DefaultDesignTimeFlags = DesignTime | SuppressMetadataAttributes | UseEnhancedLinePragma | RemapLinePragmaPathsOnWindows +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs new file mode 100644 index 00000000000..6cd347ae095 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/EnumExtensionsTests.cs @@ -0,0 +1,525 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Xunit; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test; + +public class EnumExtensionsTests +{ + private enum ByteEnum : byte + { + Flag1 = 1 << 0, + Flag2 = 1 << 1, + Flag3 = 1 << 2, + Flag4 = 1 << 3, + Flag5 = 1 << 4, + Flag6 = 1 << 5, + Flag7 = 1 << 6, + Flag8 = 1 << 7 + } + + [Fact] + public void TestByteSizedEnum() + { + ByteEnum actual = 0; + ByteEnum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag1); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag2); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag3); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag4); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag5); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag6); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag7); + SetFlagAndAssert(ref actual, ref expected, ByteEnum.Flag8); + + Assert.Equal(byte.MaxValue, (byte)actual); + Assert.Equal(byte.MaxValue, (byte)expected); + + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, ByteEnum.Flag8); + + Assert.Equal(0, (byte)actual); + Assert.Equal(0, (byte)expected); + + static void SetFlagAndAssert(ref ByteEnum actual, ref ByteEnum expected, ByteEnum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref ByteEnum actual, ref ByteEnum expected, ByteEnum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt16Enum : ushort + { + Flag1 = 1 << 0, + Flag2 = 1 << 1, + Flag3 = 1 << 2, + Flag4 = 1 << 3, + Flag5 = 1 << 4, + Flag6 = 1 << 5, + Flag7 = 1 << 6, + Flag8 = 1 << 7, + Flag9 = 1 << 8, + Flag10 = 1 << 9, + Flag11 = 1 << 10, + Flag12 = 1 << 11, + Flag13 = 1 << 12, + Flag14 = 1 << 13, + Flag15 = 1 << 14, + Flag16 = 1 << 15 + } + + [Fact] + public void TestUInt16SizedEnum() + { + UInt16Enum actual = 0; + UInt16Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag16); + + Assert.Equal(ushort.MaxValue, (ushort)actual); + Assert.Equal(ushort.MaxValue, (ushort)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt16Enum.Flag16); + + Assert.Equal(0, (ushort)actual); + Assert.Equal(0, (ushort)expected); + + static void SetFlagAndAssert(ref UInt16Enum actual, ref UInt16Enum expected, UInt16Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt16Enum actual, ref UInt16Enum expected, UInt16Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt32Enum : uint + { + Flag1 = 1u << 0, + Flag2 = 1u << 1, + Flag3 = 1u << 2, + Flag4 = 1u << 3, + Flag5 = 1u << 4, + Flag6 = 1u << 5, + Flag7 = 1u << 6, + Flag8 = 1u << 7, + Flag9 = 1u << 8, + Flag10 = 1u << 9, + Flag11 = 1u << 10, + Flag12 = 1u << 11, + Flag13 = 1u << 12, + Flag14 = 1u << 13, + Flag15 = 1u << 14, + Flag16 = 1u << 15, + Flag17 = 1u << 16, + Flag18 = 1u << 17, + Flag19 = 1u << 18, + Flag20 = 1u << 19, + Flag21 = 1u << 20, + Flag22 = 1u << 21, + Flag23 = 1u << 22, + Flag24 = 1u << 23, + Flag25 = 1u << 24, + Flag26 = 1u << 25, + Flag27 = 1u << 26, + Flag28 = 1u << 27, + Flag29 = 1u << 28, + Flag30 = 1u << 29, + Flag31 = 1u << 30, + Flag32 = 1u << 31 + } + + [Fact] + public void TestUInt32SizedEnum() + { + UInt32Enum actual = 0; + UInt32Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag16); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag17); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag18); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag19); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag20); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag21); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag22); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag23); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag24); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag25); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag26); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag27); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag28); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag29); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag30); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag31); + SetFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag32); + + Assert.Equal(uint.MaxValue, (uint)actual); + Assert.Equal(uint.MaxValue, (uint)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag16); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag17); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag18); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag19); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag20); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag21); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag22); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag23); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag24); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag25); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag26); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag27); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag28); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag29); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag30); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag31); + ClearFlagAndAssert(ref actual, ref expected, UInt32Enum.Flag32); + + Assert.Equal(0u, (uint)actual); + Assert.Equal(0u, (uint)expected); + + static void SetFlagAndAssert(ref UInt32Enum actual, ref UInt32Enum expected, UInt32Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt32Enum actual, ref UInt32Enum expected, UInt32Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } + + private enum UInt64Enum : ulong + { + Flag1 = 1ul << 0, + Flag2 = 1ul << 1, + Flag3 = 1ul << 2, + Flag4 = 1ul << 3, + Flag5 = 1ul << 4, + Flag6 = 1ul << 5, + Flag7 = 1ul << 6, + Flag8 = 1ul << 7, + Flag9 = 1ul << 8, + Flag10 = 1ul << 9, + Flag11 = 1ul << 10, + Flag12 = 1ul << 11, + Flag13 = 1ul << 12, + Flag14 = 1ul << 13, + Flag15 = 1ul << 14, + Flag16 = 1ul << 15, + Flag17 = 1ul << 16, + Flag18 = 1ul << 17, + Flag19 = 1ul << 18, + Flag20 = 1ul << 19, + Flag21 = 1ul << 20, + Flag22 = 1ul << 21, + Flag23 = 1ul << 22, + Flag24 = 1ul << 23, + Flag25 = 1ul << 24, + Flag26 = 1ul << 25, + Flag27 = 1ul << 26, + Flag28 = 1ul << 27, + Flag29 = 1ul << 28, + Flag30 = 1ul << 29, + Flag31 = 1ul << 30, + Flag32 = 1ul << 31, + Flag33 = 1ul << 32, + Flag34 = 1ul << 33, + Flag35 = 1ul << 34, + Flag36 = 1ul << 35, + Flag37 = 1ul << 36, + Flag38 = 1ul << 37, + Flag39 = 1ul << 38, + Flag40 = 1ul << 39, + Flag41 = 1ul << 40, + Flag42 = 1ul << 41, + Flag43 = 1ul << 42, + Flag44 = 1ul << 43, + Flag45 = 1ul << 44, + Flag46 = 1ul << 45, + Flag47 = 1ul << 46, + Flag48 = 1ul << 47, + Flag49 = 1ul << 48, + Flag50 = 1ul << 49, + Flag51 = 1ul << 50, + Flag52 = 1ul << 51, + Flag53 = 1ul << 52, + Flag54 = 1ul << 53, + Flag55 = 1ul << 54, + Flag56 = 1ul << 55, + Flag57 = 1ul << 56, + Flag58 = 1ul << 57, + Flag59 = 1ul << 58, + Flag60 = 1ul << 59, + Flag61 = 1ul << 60, + Flag62 = 1ul << 61, + Flag63 = 1ul << 62, + Flag64 = 1ul << 63 + } + + [Fact] + public void TestUInt64SizedEnum() + { + UInt64Enum actual = 0; + UInt64Enum expected = 0; + + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag1); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag2); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag3); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag4); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag5); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag6); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag7); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag8); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag9); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag10); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag11); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag12); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag13); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag14); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag15); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag16); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag17); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag18); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag19); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag20); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag21); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag22); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag23); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag24); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag25); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag26); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag27); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag28); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag29); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag30); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag31); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag32); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag33); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag34); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag35); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag36); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag37); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag38); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag39); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag40); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag41); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag42); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag43); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag44); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag45); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag46); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag47); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag48); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag49); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag50); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag51); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag52); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag53); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag54); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag55); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag56); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag57); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag58); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag59); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag60); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag61); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag62); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag63); + SetFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag64); + + Assert.Equal(ulong.MaxValue, (ulong)actual); + Assert.Equal(ulong.MaxValue, (ulong)expected); + + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag1); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag2); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag3); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag4); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag5); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag6); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag7); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag8); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag9); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag10); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag11); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag12); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag13); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag14); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag15); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag16); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag17); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag18); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag19); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag20); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag21); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag22); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag23); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag24); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag25); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag26); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag27); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag28); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag29); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag30); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag31); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag32); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag33); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag34); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag35); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag36); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag37); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag38); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag39); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag40); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag41); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag42); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag43); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag44); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag45); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag46); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag47); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag48); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag49); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag50); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag51); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag52); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag53); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag54); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag55); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag56); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag57); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag58); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag59); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag60); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag61); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag62); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag63); + ClearFlagAndAssert(ref actual, ref expected, UInt64Enum.Flag64); + + Assert.Equal(0ul, (ulong)actual); + Assert.Equal(0ul, (ulong)expected); + + static void SetFlagAndAssert(ref UInt64Enum actual, ref UInt64Enum expected, UInt64Enum flag) + { + actual.SetFlag(flag); + expected |= flag; + Assert.Equal(expected, actual); + + Assert.True(actual.IsFlagSet(flag)); + Assert.False(actual.IsFlagClear(flag)); + } + + static void ClearFlagAndAssert(ref UInt64Enum actual, ref UInt64Enum expected, UInt64Enum flag) + { + actual.ClearFlag(flag); + expected &= ~flag; + Assert.Equal(expected, actual); + + Assert.False(actual.IsFlagSet(flag)); + Assert.True(actual.IsFlagClear(flag)); + } + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs new file mode 100644 index 00000000000..2e23da02435 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs @@ -0,0 +1,143 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Runtime.CompilerServices; + +namespace Microsoft.AspNetCore.Razor; + +internal static class EnumExtensions +{ + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void SetFlag(ref this T value, T flag) + where T : unmanaged, Enum + { + var v = (T*)Unsafe.AsPointer(ref value); + + if (sizeof(T) == sizeof(byte)) + { + *(byte*)v |= *(byte*)&flag; + return; + } + else if (sizeof(T) == sizeof(ushort)) + { + *(ushort*)v |= *(ushort*)&flag; + return; + } + else if (sizeof(T) == sizeof(uint)) + { + *(uint*)v |= *(uint*)&flag; + return; + } + else if (sizeof(T) == sizeof(ulong)) + { + *(ulong*)v |= *(ulong*)&flag; + return; + } + + Debug.Fail("Unexpected enum underlying type."); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void ClearFlag(ref this T value, T flag) + where T : unmanaged, Enum + { + var v = (T*)Unsafe.AsPointer(ref value); + + if (sizeof(T) == sizeof(byte)) + { + *(byte*)v &= (byte)~*(byte*)&flag; + return; + } + else if (sizeof(T) == sizeof(ushort)) + { + *(ushort*)v &= (ushort)~*(ushort*)&flag; + return; + } + else if (sizeof(T) == sizeof(uint)) + { + *(uint*)v &= ~*(uint*)&flag; + return; + } + else if (sizeof(T) == sizeof(ulong)) + { + *(ulong*)v &= ~*(ulong*)&flag; + return; + } + + Debug.Fail("Unexpected enum underlying type."); + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe void UpdateFlag(ref this T value, T flag, bool set) + where T : unmanaged, Enum + { + if (set) + { + value.SetFlag(flag); + } + else + { + value.ClearFlag(flag); + } + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool IsFlagSet(this T value, T flags) + where T : unmanaged, Enum + { + if (sizeof(T) == sizeof(byte)) + { + var f = *(byte*)&flags; + return (*(byte*)&value & f) == f; + } + else if (sizeof(T) == sizeof(ushort)) + { + var f = *(ushort*)&flags; + return (*(ushort*)&value & f) == f; + } + else if (sizeof(T) == sizeof(uint)) + { + var f = *(uint*)&flags; + return (*(uint*)&value & f) == f; + } + else if (sizeof(T) == sizeof(ulong)) + { + var f = *(ulong*)&flags; + return (*(ulong*)&value & f) == f; + } + + Debug.Fail("Unexpected enum underlying type."); + return false; + } + + [MethodImpl(MethodImplOptions.AggressiveInlining)] + public static unsafe bool IsFlagClear(this T value, T flags) + where T : unmanaged, Enum + { + if (sizeof(T) == sizeof(byte)) + { + var f = *(byte*)&flags; + return (*(byte*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(ushort)) + { + var f = *(ushort*)&flags; + return (*(ushort*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(uint)) + { + var f = *(uint*)&flags; + return (*(uint*)&value & f) == 0; + } + else if (sizeof(T) == sizeof(ulong)) + { + var f = *(ulong*)&flags; + return (*(ulong*)&value & f) == 0; + } + + Debug.Fail("Unexpected enum underlying type."); + return false; + } +} From 28bfd61d3852a864dcc77902c96b6f5c9ff4e17f Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 12:41:39 -0700 Subject: [PATCH 115/271] Use SuppressUniqueIds exclusively from RazorCodeGenerationOptions This change stops pushing the SuppressUniqueIds value into RazorCodeDocument.Items. --- .../CodeGeneration/CodeRenderingContext.cs | 5 --- .../DefaultTagHelperTargetExtension.cs | 2 +- .../Language/RazorCodeGenerationOptions.cs | 36 ++++++++++++------- .../RazorCodeGenerationOptionsBuilder.cs | 5 +++ .../TestCodeRenderingContext.cs | 12 ++++--- .../IntegrationTests/IntegrationTestBase.cs | 12 ++++++- 6 files changed, 49 insertions(+), 23 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 045be588210..a2d1cee94ee 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -17,11 +17,8 @@ public sealed class CodeRenderingContext : IDisposable internal static readonly object NewLineStringKey = "NewLineString"; - internal static readonly object SuppressUniqueIdsKey = "SuppressUniqueIds"; - public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } - public string SuppressUniqueIds { get; } private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; @@ -68,8 +65,6 @@ public CodeRenderingContext( // Set new line character to a specific string regardless of platform, for testing purposes. var newLineString = codeDocument.Items[NewLineStringKey] as string ?? Environment.NewLine; CodeWriter = new CodeWriter(newLineString, options); - - SuppressUniqueIds = codeDocument.Items[SuppressUniqueIdsKey] as string ?? options.SuppressUniqueIds; } public void Dispose() diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs index 9509bb6cd61..381812e40f4 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs @@ -101,7 +101,7 @@ public void WriteTagHelperBody(CodeRenderingContext context, DefaultTagHelperBod // Assign a unique ID for this instance of the source HTML tag. This must be unique // per call site, e.g. if the tag is on the view twice, there should be two IDs. - var uniqueId = context.SuppressUniqueIds; + var uniqueId = context.Options.SuppressUniqueIds; if (uniqueId == null) { uniqueId = GetDeterministicId(context); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index c06233cf657..c80202b078d 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -11,8 +11,10 @@ public sealed class RazorCodeGenerationOptions( string? rootNamespace, string? suppressUniqueIds) { - public bool DesignTime => flags.HasFlag(RazorCodeGenerationOptionsFlags.DesignTime); - public bool IndentWithTabs => flags.HasFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs); + private readonly RazorCodeGenerationOptionsFlags _flags = flags; + + public bool DesignTime => _flags.HasFlag(RazorCodeGenerationOptionsFlags.DesignTime); + public bool IndentWithTabs => _flags.HasFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs); public int IndentSize { get; } = indentSize; /// @@ -30,7 +32,7 @@ public sealed class RazorCodeGenerationOptions( /// purposes. /// public bool SuppressChecksum - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressChecksum); /// /// Gets a value that indicates whether to suppress the default metadata attributes in the generated @@ -49,7 +51,7 @@ public bool SuppressChecksum /// /// public bool SuppressMetadataAttributes - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataAttributes); /// /// Gets a value that indicates whether to suppress the RazorSourceChecksumAttribute. @@ -59,37 +61,37 @@ public bool SuppressMetadataAttributes /// /// public bool SuppressMetadataSourceChecksumAttributes - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressMetadataSourceChecksumAttributes); /// /// Gets or sets a value that determines if an empty body is generated for the primary method. /// public bool SuppressPrimaryMethodBody - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressPrimaryMethodBody); /// /// Gets a value that determines if nullability type enforcement should be suppressed for user code. /// public bool SuppressNullabilityEnforcement - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressNullabilityEnforcement); /// /// Gets a value that determines if the components code writer may omit values for minimized attributes. /// public bool OmitMinimizedComponentAttributeValues - => flags.HasFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.OmitMinimizedComponentAttributeValues); /// /// Gets a value that determines if localized component names are to be supported. /// public bool SupportLocalizedComponentNames - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SupportLocalizedComponentNames); /// /// Gets a value that determines if enhanced line pragmas are to be utilized. /// public bool UseEnhancedLinePragma - => flags.HasFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.UseEnhancedLinePragma); /// /// Gets a value used for unique ids for testing purposes. Null for unique ids. @@ -100,13 +102,13 @@ public bool UseEnhancedLinePragma /// Determines whether RenderTreeBuilder.AddComponentParameter should not be used. /// public bool SuppressAddComponentParameter - => flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.SuppressAddComponentParameter); /// /// Determines if the file paths emitted as part of line pragmas should be mapped back to a valid path on windows. /// public bool RemapLinePragmaPathsOnWindows - => flags.HasFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); + => _flags.HasFlag(RazorCodeGenerationOptionsFlags.RemapLinePragmaPathsOnWindows); public static RazorCodeGenerationOptions Default { get; } = new RazorCodeGenerationOptions( flags: RazorCodeGenerationOptionsFlags.DefaultFlags, @@ -145,4 +147,14 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action { + b.Features.Add(new ConfigureCodeGenerationOptionsFeature()); b.Phases.Insert(0, new ConfigureCodeRenderingPhase(LineEnding)); b.RegisterExtensions(); @@ -782,6 +783,16 @@ private static string NormalizeNewLines(string content, string lineEnding) return Regex.Replace(content, "(? Date: Wed, 14 Aug 2024 13:03:27 -0700 Subject: [PATCH 116/271] Push NewLine setting into RazorCodeGenerationOptions This change stops pushing the NewLine value into RazorCodeDocument.Items. --- .../CodeGeneration/CSharpCodeWriterTest.cs | 4 ++-- .../CodeGeneration/CodeRenderingContext.cs | 6 +---- .../src/Language/CodeGeneration/CodeWriter.cs | 6 ++--- .../Language/RazorCodeGenerationOptions.cs | 16 ++++++++++---- .../RazorCodeGenerationOptionsBuilder.cs | 13 +++++++++++ .../RazorToolingIntegrationTestBase.cs | 16 +++++--------- .../TestCodeRenderingContext.cs | 4 ++-- .../IntegrationTests/IntegrationTestBase.cs | 22 +++---------------- .../RazorIntegrationTestBase.cs | 16 +++++--------- 9 files changed, 46 insertions(+), 57 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs index 8d7c6ff83c3..39604a88965 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/CodeGeneration/CSharpCodeWriterTest.cs @@ -402,7 +402,7 @@ public void CSharpCodeWriter_RespectTabSetting() o.IndentSize = 4; }); - using var writer = new CodeWriter(Environment.NewLine, options); + using var writer = new CodeWriter(options); // Act writer.BuildClassDeclaration(Array.Empty(), "C", "", Array.Empty(), Array.Empty(), context: null); @@ -428,7 +428,7 @@ public void CSharpCodeWriter_RespectSpaceSetting() o.IndentSize = 4; }); - using var writer = new CodeWriter(Environment.NewLine, options); + using var writer = new CodeWriter(options); // Act writer.BuildClassDeclaration(Array.Empty(), "C", "", Array.Empty(), Array.Empty(), context: null); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index a2d1cee94ee..16c95e3b050 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -15,8 +15,6 @@ public sealed class CodeRenderingContext : IDisposable { private readonly record struct ScopeInternal(IntermediateNodeWriter Writer); - internal static readonly object NewLineStringKey = "NewLineString"; - public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } @@ -62,9 +60,7 @@ public CodeRenderingContext( _linePragmas = ArrayBuilderPool.Default.Get(); _sourceMappings = ArrayBuilderPool.Default.Get(); - // Set new line character to a specific string regardless of platform, for testing purposes. - var newLineString = codeDocument.Items[NewLineStringKey] as string ?? Environment.NewLine; - CodeWriter = new CodeWriter(newLineString, options); + CodeWriter = new CodeWriter(options); } public void Dispose() diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs index 2c070e4e97e..15f762cc291 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeWriter.cs @@ -43,13 +43,13 @@ public sealed partial class CodeWriter : IDisposable private int _currentLineCharacterIndex; public CodeWriter() - : this(Environment.NewLine, RazorCodeGenerationOptions.Default) + : this(RazorCodeGenerationOptions.Default) { } - public CodeWriter(string newLine, RazorCodeGenerationOptions options) + public CodeWriter(RazorCodeGenerationOptions options) { - SetNewLine(newLine); + SetNewLine(options.NewLine); IndentWithTabs = options.IndentWithTabs; TabSize = options.IndentSize; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs index c80202b078d..62d0985a558 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorCodeGenerationOptions.cs @@ -8,14 +8,17 @@ namespace Microsoft.AspNetCore.Razor.Language; public sealed class RazorCodeGenerationOptions( RazorCodeGenerationOptionsFlags flags, int indentSize, + string newLine, string? rootNamespace, string? suppressUniqueIds) { private readonly RazorCodeGenerationOptionsFlags _flags = flags; public bool DesignTime => _flags.HasFlag(RazorCodeGenerationOptionsFlags.DesignTime); + public bool IndentWithTabs => _flags.HasFlag(RazorCodeGenerationOptionsFlags.IndentWithTabs); public int IndentSize { get; } = indentSize; + public string NewLine { get; } = newLine; /// /// Gets the root namespace for the generated code. @@ -113,12 +116,14 @@ public bool RemapLinePragmaPathsOnWindows public static RazorCodeGenerationOptions Default { get; } = new RazorCodeGenerationOptions( flags: RazorCodeGenerationOptionsFlags.DefaultFlags, indentSize: 4, + newLine: Environment.NewLine, rootNamespace: null, suppressUniqueIds: null); public static RazorCodeGenerationOptions DesignTimeDefault { get; } = new RazorCodeGenerationOptions( flags: RazorCodeGenerationOptionsFlags.DefaultDesignTimeFlags, indentSize: 4, + newLine: Environment.NewLine, rootNamespace: null, suppressUniqueIds: null); @@ -150,10 +155,13 @@ public static RazorCodeGenerationOptions CreateDesignTime(Action _newLine; + set + { + _newLine = value ?? Environment.NewLine; + } + } + public bool IndentWithTabs { get => _flags.IsFlagSet(RazorCodeGenerationOptionsFlags.IndentWithTabs); @@ -166,6 +178,7 @@ public RazorCodeGenerationOptions Build() => new( _flags, IndentSize, + NewLine, RootNamespace, SuppressUniqueIds); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs index f51221d8a55..8d4d088e7d9 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/IntegrationTests/RazorToolingIntegrationTestBase.cs @@ -10,7 +10,6 @@ using System.Reflection; using System.Runtime.InteropServices; using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.Mef; @@ -117,7 +116,7 @@ private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, if (LineEnding != null) { - b.Phases.Insert(0, new ForceLineEndingPhase(LineEnding)); + b.Features.Add(new SetNewLineOptionFeature(LineEnding)); } b.Features.Add(new DefaultTypeNameFeature()); @@ -430,18 +429,13 @@ public void Configure(RazorCodeGenerationOptionsBuilder options) } } - private class ForceLineEndingPhase : RazorEnginePhaseBase + private sealed class SetNewLineOptionFeature(string newLine) : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature { - public ForceLineEndingPhase(string lineEnding) - { - LineEnding = lineEnding; - } + public int Order { get; } - public string LineEnding { get; } - - protected override void ExecuteCore(RazorCodeDocument codeDocument) + public void Configure(RazorCodeGenerationOptionsBuilder options) { - codeDocument.Items[CodeRenderingContext.NewLineStringKey] = LineEnding; + options.NewLine = newLine; } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index cfa1bc85fd6..95171e4d37f 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -26,7 +26,7 @@ public static CodeRenderingContext CreateDesignTime( var codeDocument = RazorCodeDocument.Create(source); if (newLineString != null) { - codeDocument.Items[CodeRenderingContext.NewLineStringKey] = newLineString; + optionsBuilder.NewLine = newLineString; } if (suppressUniqueIds != null) @@ -64,7 +64,7 @@ public static CodeRenderingContext CreateRuntime( var codeDocument = RazorCodeDocument.Create(source); if (newLineString != null) { - codeDocument.Items[CodeRenderingContext.NewLineStringKey] = newLineString; + optionsBuilder.NewLine = newLineString; } if (suppressUniqueIds != null) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs index 1a4f8dedcc0..9ec2db725da 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/IntegrationTestBase.cs @@ -10,7 +10,6 @@ using System.Runtime.CompilerServices; using System.Text; using System.Text.RegularExpressions; -using Microsoft.AspNetCore.Razor.Language.CodeGeneration; using Microsoft.AspNetCore.Razor.Language.Intermediate; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; @@ -299,8 +298,7 @@ private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, { return RazorProjectEngine.Create(configuration, FileSystem, b => { - b.Features.Add(new ConfigureCodeGenerationOptionsFeature()); - b.Phases.Insert(0, new ConfigureCodeRenderingPhase(LineEnding)); + b.Features.Add(new ConfigureCodeGenerationOptionsFeature(LineEnding)); b.RegisterExtensions(); @@ -783,31 +781,17 @@ private static string NormalizeNewLines(string content, string lineEnding) return Regex.Replace(content, "(? Date: Wed, 14 Aug 2024 13:04:06 -0700 Subject: [PATCH 117/271] Pass RazorSourceDocument into CodeRenderingContext rather than RazorCodeDocument --- .../CodeGeneration/CodeRenderingContext.cs | 9 ++- .../CodeGeneration/DefaultDocumentWriter.cs | 15 ++--- .../TestCodeRenderingContext.cs | 66 +++++++------------ 3 files changed, 32 insertions(+), 58 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 16c95e3b050..9a464eb3ad8 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -15,10 +15,10 @@ public sealed class CodeRenderingContext : IDisposable { private readonly record struct ScopeInternal(IntermediateNodeWriter Writer); + public RazorSourceDocument SourceDocument { get; } public RazorCodeGenerationOptions Options { get; } public CodeWriter CodeWriter { get; } - private readonly RazorCodeDocument _codeDocument; private readonly DocumentIntermediateNode _documentNode; private readonly Stack _ancestorStack; @@ -29,20 +29,19 @@ public sealed class CodeRenderingContext : IDisposable private readonly ImmutableArray.Builder _linePragmas; public string DocumentKind => _documentNode.DocumentKind; - public RazorSourceDocument SourceDocument => _codeDocument.Source; public CodeRenderingContext( IntermediateNodeWriter nodeWriter, - RazorCodeDocument codeDocument, + RazorSourceDocument sourceDocument, DocumentIntermediateNode documentNode, RazorCodeGenerationOptions options) { ArgHelper.ThrowIfNull(nodeWriter); - ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(sourceDocument); ArgHelper.ThrowIfNull(documentNode); ArgHelper.ThrowIfNull(options); - _codeDocument = codeDocument; + SourceDocument = sourceDocument; _documentNode = documentNode; Options = options; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index cd9a8ab0833..81c09425d0c 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -4,7 +4,6 @@ #nullable disable using System; -using System.Collections.Immutable; using System.Linq; using System.Security.Cryptography; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -24,21 +23,15 @@ public DefaultDocumentWriter(CodeTarget codeTarget, RazorCodeGenerationOptions o public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) { - if (codeDocument == null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (documentNode == null) - { - throw new ArgumentNullException(nameof(documentNode)); - } + ArgHelper.ThrowIfNull(codeDocument); + ArgHelper.ThrowIfNull(documentNode); using var context = new CodeRenderingContext( _codeTarget.CreateNodeWriter(), - codeDocument, + codeDocument.Source, documentNode, _options); + context.Visitor = new Visitor(_codeTarget, context); context.Visitor.VisitDocument(documentNode); diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index 95171e4d37f..23338cab77b 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -15,33 +15,13 @@ public static CodeRenderingContext CreateDesignTime( RazorSourceDocument source = null, IntermediateNodeWriter nodeWriter = null) { + nodeWriter ??= new RuntimeNodeWriter(); + source ??= TestRazorSourceDocument.Create(); var documentNode = new DocumentIntermediateNode(); - var optionsBuilder = RazorCodeGenerationOptions.DesignTimeDefault.ToBuilder(); - if (source == null) - { - source = TestRazorSourceDocument.Create(); - } + var options = ConfigureOptions(RazorCodeGenerationOptions.DesignTimeDefault, newLineString, suppressUniqueIds); - var codeDocument = RazorCodeDocument.Create(source); - if (newLineString != null) - { - optionsBuilder.NewLine = newLineString; - } - - if (suppressUniqueIds != null) - { - optionsBuilder.SuppressUniqueIds = suppressUniqueIds; - } - - if (nodeWriter == null) - { - nodeWriter = new DesignTimeNodeWriter(); - } - - var options = optionsBuilder.Build(); - - var context = new CodeRenderingContext(nodeWriter, codeDocument, documentNode, options); + var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); context.Visitor = new RenderChildrenVisitor(context); return context; @@ -53,36 +33,38 @@ public static CodeRenderingContext CreateRuntime( RazorSourceDocument source = null, IntermediateNodeWriter nodeWriter = null) { + nodeWriter ??= new RuntimeNodeWriter(); + source ??= TestRazorSourceDocument.Create(); var documentNode = new DocumentIntermediateNode(); - var optionsBuilder = RazorCodeGenerationOptions.Default.ToBuilder(); - if (source == null) - { - source = TestRazorSourceDocument.Create(); - } + var options = ConfigureOptions(RazorCodeGenerationOptions.Default, newLineString, suppressUniqueIds); + + var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); + context.Visitor = new RenderChildrenVisitor(context); + + return context; + } - var codeDocument = RazorCodeDocument.Create(source); - if (newLineString != null) + private static RazorCodeGenerationOptions ConfigureOptions(RazorCodeGenerationOptions options, string newLine, string suppressUniqueIds) + { + if (newLine is null && suppressUniqueIds is null) { - optionsBuilder.NewLine = newLineString; + return options; } - if (suppressUniqueIds != null) + var builder = options.ToBuilder(); + + if (newLine is not null) { - optionsBuilder.SuppressUniqueIds = suppressUniqueIds; + builder.NewLine = newLine; } - if (nodeWriter == null) + if (suppressUniqueIds is not null) { - nodeWriter = new RuntimeNodeWriter(); + builder.SuppressUniqueIds = suppressUniqueIds; } - var options = optionsBuilder.Build(); - - var context = new CodeRenderingContext(nodeWriter, codeDocument, documentNode, options); - context.Visitor = new RenderChildrenVisitor(context); - - return context; + return builder.Build(); } private class RenderChildrenVisitor : IntermediateNodeVisitor From 6593264ac651f3511f82c9c9a0743786437c14c1 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Wed, 14 Aug 2024 14:37:56 -0700 Subject: [PATCH 118/271] Clean up and enable nullability for CodeRenderingContext and DefaultDocumentWriter --- .../src/Language/ChecksumUtilities.cs | 1 - .../CodeGeneration/CodeRenderingContext.cs | 15 +- .../CodeGeneration/DefaultDocumentWriter.cs | 176 ++++++++---------- .../TestCodeRenderingContext.cs | 14 +- 4 files changed, 94 insertions(+), 112 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs index 790b35abe3a..4b40a41f45f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/ChecksumUtilities.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Immutable; using System.Globalization; -using System.Text; using Microsoft.AspNetCore.Razor.PooledObjects; namespace Microsoft.AspNetCore.Razor.Language; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs index 9a464eb3ad8..23cc201671f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/CodeRenderingContext.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -28,6 +26,9 @@ public sealed class CodeRenderingContext : IDisposable private readonly ImmutableArray.Builder _sourceMappings; private readonly ImmutableArray.Builder _linePragmas; + private IntermediateNodeVisitor? _visitor; + public IntermediateNodeVisitor Visitor => _visitor.AssumeNotNull(); + public string DocumentKind => _documentNode.DocumentKind; public CodeRenderingContext( @@ -74,12 +75,16 @@ public void Dispose() CodeWriter.Dispose(); } - // This will be initialized by the document writer when the context is 'live'. - public IntermediateNodeVisitor Visitor { get; set; } + // This will be called by the document writer when the context is 'live'. + public void SetVisitor(IntermediateNodeVisitor visitor) + { + _visitor = visitor; + } public IntermediateNodeWriter NodeWriter => _scopeStack.Peek().Writer; - public IntermediateNode Parent => _ancestorStack.Count == 0 ? null : _ancestorStack.Peek(); + public IntermediateNode? Parent + => _ancestorStack.Count == 0 ? null : _ancestorStack.Peek(); public void AddDiagnostic(RazorDiagnostic diagnostic) { diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 81c09425d0c..550e32ca7ea 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System; using System.Linq; using System.Security.Cryptography; @@ -10,16 +8,10 @@ namespace Microsoft.AspNetCore.Razor.Language.CodeGeneration; -internal class DefaultDocumentWriter : DocumentWriter +internal class DefaultDocumentWriter(CodeTarget codeTarget, RazorCodeGenerationOptions options) : DocumentWriter { - private readonly CodeTarget _codeTarget; - private readonly RazorCodeGenerationOptions _options; - - public DefaultDocumentWriter(CodeTarget codeTarget, RazorCodeGenerationOptions options) - { - _codeTarget = codeTarget; - _options = options; - } + private readonly CodeTarget _codeTarget = codeTarget; + private readonly RazorCodeGenerationOptions _options = options; public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument, DocumentIntermediateNode documentNode) { @@ -32,37 +24,35 @@ public override RazorCSharpDocument WriteDocument(RazorCodeDocument codeDocument documentNode, _options); - context.Visitor = new Visitor(_codeTarget, context); + context.SetVisitor(new Visitor(_codeTarget, context)); context.Visitor.VisitDocument(documentNode); - var csharp = context.CodeWriter.GenerateCode(); + var generatedCode = context.CodeWriter.GenerateCode(); return new RazorCSharpDocument( codeDocument, - csharp, + generatedCode, _options, context.GetDiagnostics(), context.GetSourceMappings(), context.GetLinePragmas()); } - private class Visitor : IntermediateNodeVisitor + private sealed class Visitor(CodeTarget codeTarget, CodeRenderingContext context) : IntermediateNodeVisitor { - private readonly CodeRenderingContext _context; - private readonly CodeTarget _target; + private readonly CodeRenderingContext _context = context; + private readonly CodeTarget _codeTarget = codeTarget; - public Visitor(CodeTarget target, CodeRenderingContext context) - { - _target = target; - _context = context; - } - - private CodeRenderingContext Context => _context; + private CodeWriter CodeWriter => _context.CodeWriter; + private IntermediateNodeWriter NodeWriter => _context.NodeWriter; + private RazorCodeGenerationOptions Options => _context.Options; public override void VisitDocument(DocumentIntermediateNode node) { - if (!Context.Options.SuppressChecksum) + var codeWriter = CodeWriter; + + if (!Options.SuppressChecksum) { // See http://msdn.microsoft.com/en-us/library/system.codedom.codechecksumpragma.checksumalgorithmid.aspx // And https://github.com/dotnet/roslyn/blob/614299ff83da9959fa07131c6d0ffbc58873b6ae/src/Compilers/Core/Portable/PEWriter/DebugSourceDocument.cs#L67 @@ -70,7 +60,7 @@ public override void VisitDocument(DocumentIntermediateNode node) // We only support algorithms that the debugger understands, which is currently SHA1 and SHA256. string algorithmId; - var algorithm = Context.SourceDocument.Text.ChecksumAlgorithm; + var algorithm = _context.SourceDocument.Text.ChecksumAlgorithm; if (algorithm == CodeAnalysis.Text.SourceHashAlgorithm.Sha256) { algorithmId = "{8829d00f-11b8-4213-878b-770e8597ac16}"; @@ -81,80 +71,75 @@ public override void VisitDocument(DocumentIntermediateNode node) } else { - var supportedAlgorithms = string.Join(" ", new string[] - { - HashAlgorithmName.SHA1.Name, - HashAlgorithmName.SHA256.Name - }); + string?[] supportedAlgorithms = [HashAlgorithmName.SHA1.Name, HashAlgorithmName.SHA256.Name]; var message = Resources.FormatUnsupportedChecksumAlgorithm( algorithm, - supportedAlgorithms, - nameof(RazorCodeGenerationOptions) + "." + nameof(RazorCodeGenerationOptions.SuppressChecksum), + string.Join(" ", supportedAlgorithms), + $"{nameof(RazorCodeGenerationOptions)}.{nameof(RazorCodeGenerationOptions.SuppressChecksum)}", bool.TrueString); + throw new InvalidOperationException(message); } - var sourceDocument = Context.SourceDocument; + var sourceDocument = _context.SourceDocument; var checksum = ChecksumUtilities.BytesToString(sourceDocument.Text.GetChecksum()); - if (!string.IsNullOrEmpty(checksum)) + var filePath = sourceDocument.FilePath.AssumeNotNull(); + + if (checksum.Length > 0) { - Context.CodeWriter - .Write("#pragma checksum \"") - .Write(sourceDocument.FilePath) - .Write("\" \"") - .Write(algorithmId) - .Write("\" \"") - .Write(checksum) - .WriteLine("\""); + codeWriter.WriteLine($"#pragma checksum \"{filePath}\" \"{algorithmId}\" \"{checksum}\""); } } - Context.CodeWriter + codeWriter .WriteLine("// ") .WriteLine("#pragma warning disable 1591"); VisitDefault(node); - Context.CodeWriter.WriteLine("#pragma warning restore 1591"); + codeWriter.WriteLine("#pragma warning restore 1591"); } public override void VisitUsingDirective(UsingDirectiveIntermediateNode node) { - Context.NodeWriter.WriteUsingDirective(Context, node); + NodeWriter.WriteUsingDirective(_context, node); } public override void VisitNamespaceDeclaration(NamespaceDeclarationIntermediateNode node) { - using (Context.CodeWriter.BuildNamespace(node.Content, node.Source, Context)) + var codeWriter = CodeWriter; + + using (codeWriter.BuildNamespace(node.Content, node.Source, _context)) { if (node.Children.OfType().Any()) { // Tooling needs at least one line directive before using directives, otherwise Roslyn will // not offer to create a new one. The last using in the group will output a hidden line // directive after itself. - Context.CodeWriter.WriteLine("#line default"); + codeWriter.WriteLine("#line default"); } else { // If there are no using directives, we output the hidden directive here. - Context.CodeWriter.WriteLine("#line hidden"); + codeWriter.WriteLine("#line hidden"); } + VisitDefault(node); } } public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { - using (Context.CodeWriter.BuildClassDeclaration( + using (CodeWriter.BuildClassDeclaration( node.Modifiers, node.ClassName, node.BaseType, node.Interfaces, node.TypeParameters, - Context, - useNullableContext: !Context.Options.SuppressNullabilityEnforcement && node.Annotations[CommonAnnotations.NullableContext] is not null)) + _context, + useNullableContext: !Options.SuppressNullabilityEnforcement && node.Annotations[CommonAnnotations.NullableContext] is not null)) { VisitDefault(node); } @@ -162,100 +147,99 @@ public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node public override void VisitMethodDeclaration(MethodDeclarationIntermediateNode node) { - Context.CodeWriter.WriteLine("#pragma warning disable 1998"); + var codeWriter = CodeWriter; + + codeWriter.WriteLine("#pragma warning disable 1998"); for (var i = 0; i < node.Modifiers.Count; i++) { - Context.CodeWriter.Write(node.Modifiers[i]); - Context.CodeWriter.Write(" "); + codeWriter.Write($"{node.Modifiers[i]} "); } - Context.CodeWriter.Write(node.ReturnType); - Context.CodeWriter.Write(" "); + codeWriter.Write($"{node.ReturnType} "); + codeWriter.Write($"{node.MethodName}("); - Context.CodeWriter.Write(node.MethodName); - Context.CodeWriter.Write("("); + var isFirst = true; for (var i = 0; i < node.Parameters.Count; i++) { var parameter = node.Parameters[i]; - for (var j = 0; j < parameter.Modifiers.Count; j++) + if (isFirst) { - Context.CodeWriter.Write(parameter.Modifiers[j]); - Context.CodeWriter.Write(" "); + isFirst = false; + } + else + { + codeWriter.Write(", "); } - Context.CodeWriter.Write(parameter.TypeName); - Context.CodeWriter.Write(" "); - - Context.CodeWriter.Write(parameter.ParameterName); - - if (i < node.Parameters.Count - 1) + for (var j = 0; j < parameter.Modifiers.Count; j++) { - Context.CodeWriter.Write(", "); + codeWriter.Write($"{parameter.Modifiers[j]} "); } + + codeWriter.Write($"{parameter.TypeName} {parameter.ParameterName}"); } - Context.CodeWriter.Write(")"); - Context.CodeWriter.WriteLine(); + codeWriter.WriteLine(")"); - using (Context.CodeWriter.BuildScope()) + using (codeWriter.BuildScope()) { VisitDefault(node); } - Context.CodeWriter.WriteLine("#pragma warning restore 1998"); + codeWriter.WriteLine("#pragma warning restore 1998"); } public override void VisitFieldDeclaration(FieldDeclarationIntermediateNode node) { - Context.CodeWriter.WriteField(node.SuppressWarnings, node.Modifiers, node.FieldType, node.FieldName); + CodeWriter.WriteField(node.SuppressWarnings, node.Modifiers, node.FieldType, node.FieldName); } public override void VisitPropertyDeclaration(PropertyDeclarationIntermediateNode node) { - Context.CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.PropertyType, node.PropertyName); + CodeWriter.WriteAutoPropertyDeclaration(node.Modifiers, node.PropertyType, node.PropertyName); } public override void VisitExtension(ExtensionIntermediateNode node) { - node.WriteNode(_target, Context); + node.WriteNode(_codeTarget, _context); } public override void VisitCSharpExpression(CSharpExpressionIntermediateNode node) { - Context.NodeWriter.WriteCSharpExpression(Context, node); + NodeWriter.WriteCSharpExpression(_context, node); } public override void VisitCSharpCode(CSharpCodeIntermediateNode node) { - Context.NodeWriter.WriteCSharpCode(Context, node); + NodeWriter.WriteCSharpCode(_context, node); } public override void VisitHtmlAttribute(HtmlAttributeIntermediateNode node) { - Context.NodeWriter.WriteHtmlAttribute(Context, node); + NodeWriter.WriteHtmlAttribute(_context, node); } public override void VisitHtmlAttributeValue(HtmlAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteHtmlAttributeValue(Context, node); + NodeWriter.WriteHtmlAttributeValue(_context, node); } public override void VisitCSharpExpressionAttributeValue(CSharpExpressionAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteCSharpExpressionAttributeValue(Context, node); + NodeWriter.WriteCSharpExpressionAttributeValue(_context, node); } public override void VisitCSharpCodeAttributeValue(CSharpCodeAttributeValueIntermediateNode node) { - Context.NodeWriter.WriteCSharpCodeAttributeValue(Context, node); + NodeWriter.WriteCSharpCodeAttributeValue(_context, node); } public override void VisitHtml(HtmlContentIntermediateNode node) { - Context.NodeWriter.WriteHtmlContent(Context, node); + NodeWriter.WriteHtmlContent(_context, node); } public override void VisitTagHelper(TagHelperIntermediateNode node) @@ -265,67 +249,67 @@ public override void VisitTagHelper(TagHelperIntermediateNode node) public override void VisitComponent(ComponentIntermediateNode node) { - Context.NodeWriter.WriteComponent(Context, node); + NodeWriter.WriteComponent(_context, node); } public override void VisitComponentAttribute(ComponentAttributeIntermediateNode node) { - Context.NodeWriter.WriteComponentAttribute(Context, node); + NodeWriter.WriteComponentAttribute(_context, node); } public override void VisitComponentChildContent(ComponentChildContentIntermediateNode node) { - Context.NodeWriter.WriteComponentChildContent(Context, node); + NodeWriter.WriteComponentChildContent(_context, node); } public override void VisitComponentTypeArgument(ComponentTypeArgumentIntermediateNode node) { - Context.NodeWriter.WriteComponentTypeArgument(Context, node); + NodeWriter.WriteComponentTypeArgument(_context, node); } public override void VisitComponentTypeInferenceMethod(ComponentTypeInferenceMethodIntermediateNode node) { - Context.NodeWriter.WriteComponentTypeInferenceMethod(Context, node); + NodeWriter.WriteComponentTypeInferenceMethod(_context, node); } public override void VisitMarkupElement(MarkupElementIntermediateNode node) { - Context.NodeWriter.WriteMarkupElement(Context, node); + NodeWriter.WriteMarkupElement(_context, node); } public override void VisitMarkupBlock(MarkupBlockIntermediateNode node) { - Context.NodeWriter.WriteMarkupBlock(Context, node); + NodeWriter.WriteMarkupBlock(_context, node); } public override void VisitReferenceCapture(ReferenceCaptureIntermediateNode node) { - Context.NodeWriter.WriteReferenceCapture(Context, node); + NodeWriter.WriteReferenceCapture(_context, node); } public override void VisitSetKey(SetKeyIntermediateNode node) { - Context.NodeWriter.WriteSetKey(Context, node); + NodeWriter.WriteSetKey(_context, node); } public override void VisitSplat(SplatIntermediateNode node) { - Context.NodeWriter.WriteSplat(Context, node); + NodeWriter.WriteSplat(_context, node); } public override void VisitRenderMode(RenderModeIntermediateNode node) { - Context.NodeWriter.WriteRenderMode(Context, node); + NodeWriter.WriteRenderMode(_context, node); } public override void VisitFormName(FormNameIntermediateNode node) { - Context.NodeWriter.WriteFormName(Context, node); + NodeWriter.WriteFormName(_context, node); } public override void VisitDefault(IntermediateNode node) { - Context.RenderChildren(node); + _context.RenderChildren(node); } } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs index 23338cab77b..b884acf51ef 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/CodeGeneration/TestCodeRenderingContext.cs @@ -22,7 +22,7 @@ public static CodeRenderingContext CreateDesignTime( var options = ConfigureOptions(RazorCodeGenerationOptions.DesignTimeDefault, newLineString, suppressUniqueIds); var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); - context.Visitor = new RenderChildrenVisitor(context); + context.SetVisitor(new RenderChildrenVisitor(context.CodeWriter)); return context; } @@ -40,7 +40,7 @@ public static CodeRenderingContext CreateRuntime( var options = ConfigureOptions(RazorCodeGenerationOptions.Default, newLineString, suppressUniqueIds); var context = new CodeRenderingContext(nodeWriter, source, documentNode, options); - context.Visitor = new RenderChildrenVisitor(context); + context.SetVisitor(new RenderChildrenVisitor(context.CodeWriter)); return context; } @@ -67,17 +67,11 @@ private static RazorCodeGenerationOptions ConfigureOptions(RazorCodeGenerationOp return builder.Build(); } - private class RenderChildrenVisitor : IntermediateNodeVisitor + private class RenderChildrenVisitor(CodeWriter writer) : IntermediateNodeVisitor { - private readonly CodeRenderingContext _context; - public RenderChildrenVisitor(CodeRenderingContext context) - { - _context = context; - } - public override void VisitDefault(IntermediateNode node) { - _context.CodeWriter.WriteLine("Render Children"); + writer.WriteLine("Render Children"); } } } From 80ae134f9f2d0a7218624f85935df17a3f7a213b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 20 Aug 2024 10:24:35 +1000 Subject: [PATCH 119/271] PR Feedback --- .../ProjectSystem/DocumentState.cs | 38 +++++++++---------- .../ProjectSystem/ProjectState.cs | 6 +-- ...RazorCustomMessageTarget_SemanticTokens.cs | 2 +- ...rCustomMessageTarget_UpdateCSharpBuffer.cs | 21 +++++----- .../ProjectSystem/TestDocumentSnapshot.cs | 18 ++++----- .../ProjectSystem/ProjectStateTest.cs | 10 ++--- 6 files changed, 47 insertions(+), 48 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs index 64385538afa..fded1912608 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentState.cs @@ -27,12 +27,12 @@ internal partial class DocumentState private readonly Func> _loader; private Task? _loaderTask; private SourceText? _sourceText; - private VersionStamp? _version; - private readonly int _numericVersion; + private VersionStamp? _textVersion; + private readonly int _version; public static DocumentState Create( HostDocument hostDocument, - int numericVersion, + int version, Func>? loader) { if (hostDocument is null) @@ -40,7 +40,7 @@ public static DocumentState Create( throw new ArgumentNullException(nameof(hostDocument)); } - return new DocumentState(hostDocument, null, null, numericVersion, loader); + return new DocumentState(hostDocument, null, null, version, loader); } public static DocumentState Create( @@ -52,27 +52,27 @@ public static DocumentState Create( throw new ArgumentNullException(nameof(hostDocument)); } - return new DocumentState(hostDocument, null, null, 1, loader); + return new DocumentState(hostDocument, null, null, version: 1, loader); } // Internal for testing internal DocumentState( HostDocument hostDocument, SourceText? text, - VersionStamp? version, - int numericVersion, + VersionStamp? textVersion, + int version, Func>? loader) { HostDocument = hostDocument; _sourceText = text; + _textVersion = textVersion; _version = version; - _numericVersion = numericVersion; _loader = loader ?? EmptyLoader; _lock = new object(); } public HostDocument HostDocument { get; } - public int Version => _numericVersion; + public int Version => _version; public bool IsGeneratedOutputResultAvailable => ComputedState.IsResultAvailable == true; @@ -149,7 +149,7 @@ public bool TryGetText([NotNullWhen(true)] out SourceText? result) public bool TryGetTextVersion(out VersionStamp result) { - if (_version is { } version) + if (_textVersion is { } version) { result = version; return true; @@ -169,11 +169,11 @@ public bool TryGetTextVersion(out VersionStamp result) public virtual DocumentState WithConfigurationChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) + var state = new DocumentState(HostDocument, _sourceText, _textVersion, _version + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, - _version = _version, + _textVersion = _textVersion, _loaderTask = _loaderTask, }; @@ -184,11 +184,11 @@ public virtual DocumentState WithConfigurationChange() public virtual DocumentState WithImportsChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) + var state = new DocumentState(HostDocument, _sourceText, _textVersion, _version + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, - _version = _version, + _textVersion = _textVersion, _loaderTask = _loaderTask }; @@ -200,11 +200,11 @@ public virtual DocumentState WithImportsChange() public virtual DocumentState WithProjectWorkspaceStateChange() { - var state = new DocumentState(HostDocument, _sourceText, _version, _numericVersion + 1, _loader) + var state = new DocumentState(HostDocument, _sourceText, _textVersion, _version + 1, _loader) { // The source could not have possibly changed. _sourceText = _sourceText, - _version = _version, + _textVersion = _textVersion, _loaderTask = _loaderTask }; @@ -214,7 +214,7 @@ public virtual DocumentState WithProjectWorkspaceStateChange() return state; } - public virtual DocumentState WithText(SourceText sourceText, VersionStamp version) + public virtual DocumentState WithText(SourceText sourceText, VersionStamp textVersion) { if (sourceText is null) { @@ -223,7 +223,7 @@ public virtual DocumentState WithText(SourceText sourceText, VersionStamp versio // Do not cache the computed state - return new DocumentState(HostDocument, sourceText, version, _numericVersion + 1, null); + return new DocumentState(HostDocument, sourceText, textVersion, _version + 1, null); } public virtual DocumentState WithTextLoader(Func> loader) @@ -235,7 +235,7 @@ public virtual DocumentState WithTextLoader(Func> loader) // Do not cache the computed state - return new DocumentState(HostDocument, null, null, _numericVersion + 1, loader); + return new DocumentState(HostDocument, null, null, _version + 1, loader); } // Internal, because we are temporarily sharing code with CohostDocumentSnapshot diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs index b51e3bbd285..dde23d8e562 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs @@ -243,7 +243,7 @@ public ProjectState WithAddedHostDocument(HostDocument hostDocument, Func r.End.Line)} max line number, host version {semanticTokensParams.RequiredHostDocumentVersion}, correlation ID {semanticTokensParams.CorrelationId}"); + _logger.LogDebug($"Semantic tokens request for {semanticTokensParams.Ranges.Max(static r => r.End.Line)} max line number, host version {semanticTokensParams.RequiredHostDocumentVersion}, correlation ID {semanticTokensParams.CorrelationId}"); var (synchronized, csharpDoc) = await TrySynchronizeVirtualDocumentAsync( semanticTokensParams.RequiredHostDocumentVersion, diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs index e2b6355c927..47b797d2ef0 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_UpdateCSharpBuffer.cs @@ -87,15 +87,7 @@ request.ProjectKeyId is not null && request.HostDocumentVersion.Value, state: request.PreviousWasEmpty); - if (_documentManager.TryGetDocument(hostDocumentUri, out var newDocSnapshot)) - { - var newDoc = newDocSnapshot.VirtualDocuments.Where(e => e.Uri == virtualDocument.Uri).FirstOrDefault(); - - if (newDoc is not null) - { - _logger.LogDebug($"UpdateCSharpBuffer finished updating doc for {request.HostDocumentVersion} of {virtualDocument.Uri}. New lines: {newDoc.Snapshot.LineCount}"); - } - } + _logger.LogDebug($"UpdateCSharpBuffer finished updating doc for {request.HostDocumentVersion} of {virtualDocument.Uri}. New lines: {GetLineCountOfVirtualDocument(hostDocumentUri, virtualDocument)}"); return; } @@ -127,4 +119,15 @@ request.ProjectKeyId is not null && request.HostDocumentVersion.Value, state: request.PreviousWasEmpty); } + + private int GetLineCountOfVirtualDocument(Uri hostDocumentUri, CSharpVirtualDocumentSnapshot virtualDocument) + { + if (_documentManager.TryGetDocument(hostDocumentUri, out var newDocSnapshot) && + newDocSnapshot.VirtualDocuments.FirstOrDefault(e => e.Uri == virtualDocument.Uri) is { } newDoc) + { + return newDoc.Snapshot.LineCount; + } + + return -1; + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs index 1f86e7fe5ce..65c0670b26c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs @@ -20,16 +20,16 @@ internal class TestDocumentSnapshot : DocumentSnapshot public static TestDocumentSnapshot Create(string filePath) => Create(filePath, string.Empty); - public static TestDocumentSnapshot Create(string filePath, VersionStamp version) - => Create(filePath, string.Empty, version); + public static TestDocumentSnapshot Create(string filePath, VersionStamp textVersion) + => Create(filePath, string.Empty, textVersion); public static TestDocumentSnapshot Create(string filePath, string text, int version = 0) - => Create(filePath, text, VersionStamp.Default, numericVersion: version); + => Create(filePath, text, VersionStamp.Default, version: version); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, ProjectWorkspaceState? projectWorkspaceState = null, int numericVersion = 0) - => Create(filePath, text, version, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState), numericVersion); + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp textVersion, ProjectWorkspaceState? projectWorkspaceState = null, int version = 0) + => Create(filePath, text, textVersion, TestProjectSnapshot.Create(filePath + ".csproj", projectWorkspaceState), version); - public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp version, TestProjectSnapshot projectSnapshot, int numericVersion) + public static TestDocumentSnapshot Create(string filePath, string text, VersionStamp textVersion, TestProjectSnapshot projectSnapshot, int version) { var targetPath = Path.GetDirectoryName(projectSnapshot.FilePath) is string projectDirectory && filePath.StartsWith(projectDirectory) ? filePath[projectDirectory.Length..] @@ -40,9 +40,9 @@ public static TestDocumentSnapshot Create(string filePath, string text, VersionS var documentState = new DocumentState( hostDocument, SourceText.From(text), + textVersion, version, - numericVersion, - () => Task.FromResult(TextAndVersion.Create(sourceText, version))); + () => Task.FromResult(TextAndVersion.Create(sourceText, textVersion))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); return testDocument; @@ -65,7 +65,7 @@ internal static TestDocumentSnapshot Create(ProjectSnapshot projectSnapshot, str hostDocument, SourceText.From(text), version, - 1, + version: 1, () => Task.FromResult(TextAndVersion.Create(sourceText, version.Value))); var testDocument = new TestDocumentSnapshot(projectSnapshot, documentState); diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs index 3cc38fe40d3..5f5c1a8e422 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/ProjectStateTest.cs @@ -1000,8 +1000,6 @@ public static TestDocumentState Create( { return new TestDocumentState( hostDocument, - null, - null, loader, onTextChange, onTextLoaderChange, @@ -1018,15 +1016,13 @@ public static TestDocumentState Create( private TestDocumentState( HostDocument hostDocument, - SourceText? text, - VersionStamp? version, Func>? loader, Action? onTextChange, Action? onTextLoaderChange, Action? onConfigurationChange, Action? onImportsChange, Action? onProjectWorkspaceStateChange) - : base(hostDocument, text, version, 1, loader) + : base(hostDocument, text: null, textVersion: null, version: 1, loader) { _onTextChange = onTextChange; _onTextLoaderChange = onTextLoaderChange; @@ -1035,10 +1031,10 @@ private TestDocumentState( _onProjectWorkspaceStateChange = onProjectWorkspaceStateChange; } - public override DocumentState WithText(SourceText sourceText, VersionStamp version) + public override DocumentState WithText(SourceText sourceText, VersionStamp textVersion) { _onTextChange?.Invoke(); - return base.WithText(sourceText, version); + return base.WithText(sourceText, textVersion); } public override DocumentState WithTextLoader(Func> loader) From caac5992ab36af9d7ee210f3398bbbcff5c966c6 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 20 Aug 2024 11:14:24 +1000 Subject: [PATCH 120/271] Fix after merge --- .../Refactoring/RenameEndpointTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs index b03b5fd25aa..53ebd97eec8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Refactoring/RenameEndpointTest.cs @@ -278,7 +278,7 @@ public async Task Handle_Rename_OnComponentEndTag_ReturnsResult() NewName = "Test2" }; - Assert.True(documentContextFactory.TryCreateForOpenDocument(uri, out var documentContext)); + Assert.True(documentContextFactory.TryCreate(uri, out var documentContext)); var requestContext = CreateRazorRequestContext(documentContext); // Act From b58f1809105f2435c50c7c4daabbc89a3930e608 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 20 Aug 2024 10:24:06 -0700 Subject: [PATCH 121/271] Fix goofy whitespace --- .../RazorDocumentMappingServiceTest.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs index 0895c0cbd82..041d32417a2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/RazorDocumentMappingServiceTest.cs @@ -1035,7 +1035,7 @@ private static RazorCodeDocument CreateCodeDocumentWithCSharpProjection(string r var csharpDocument = new RazorCSharpDocument( codeDocument, projectedCSharpSource, - RazorCodeGenerationOptions. Default, + RazorCodeGenerationOptions.Default, diagnostics: [], sourceMappings, linePragmas: []); From 934fea83a748638399af237d54c6690390abeabe Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 20 Aug 2024 10:38:02 -0700 Subject: [PATCH 122/271] Add comments explaining the aggressive inlining behavior of EnumExtensions --- .../EnumExtensions.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs index 2e23da02435..67df57e028c 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/EnumExtensions.cs @@ -9,6 +9,7 @@ namespace Microsoft.AspNetCore.Razor; internal static class EnumExtensions { + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void SetFlag(ref this T value, T flag) where T : unmanaged, Enum @@ -39,6 +40,7 @@ public static unsafe void SetFlag(ref this T value, T flag) Debug.Fail("Unexpected enum underlying type."); } + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe void ClearFlag(ref this T value, T flag) where T : unmanaged, Enum @@ -83,6 +85,8 @@ public static unsafe void UpdateFlag(ref this T value, T flag, bool set) } } + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. + // This is somewhat faster than Enum.HasFlag(...) when running on .NET Framework. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool IsFlagSet(this T value, T flags) where T : unmanaged, Enum @@ -112,6 +116,7 @@ public static unsafe bool IsFlagSet(this T value, T flags) return false; } + // Note: This is written to allow the JIT to inline only the correct branch depending on the size of T. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe bool IsFlagClear(this T value, T flags) where T : unmanaged, Enum From 97ac5367c76246e972838dbc99502acc091953ae Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 14:18:10 +1000 Subject: [PATCH 123/271] Move add usings helper code down to the workspaces layer This commit is just moves, no functionality changes. Minor tweaks to method visibility, and one rename of a static field :) --- .../AddUsingsCodeActionProviderHelper.cs | 190 ------------ .../TypeAccessibilityCodeActionProvider.cs | 5 +- .../Razor/AddUsingsCodeActionResolver.cs | 188 ++++-------- ...omponentAccessibilityCodeActionProvider.cs | 2 +- .../LspCSharpOnTypeFormattingPass.cs | 2 +- .../Formatting/AddUsingsHelper.cs | 272 ++++++++++++++++++ .../AddUsingsCodeActionProviderFactoryTest.cs | 114 -------- .../AddUsingsCodeActionResolverTest.cs | 42 +++ .../Formatting/AddUsingsHelperTest.cs | 71 +++++ 9 files changed, 446 insertions(+), 440 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs delete mode 100644 src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs create mode 100644 src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs deleted file mode 100644 index a216287aea1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/AddUsingsCodeActionProviderHelper.cs +++ /dev/null @@ -1,190 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using System.Linq; -using System.Text.RegularExpressions; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.CSharp; -using Microsoft.CodeAnalysis.CSharp.Syntax; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; - -internal static class AddUsingsCodeActionProviderHelper -{ - public static async Task GetUsingStatementEditsAsync(RazorCodeDocument codeDocument, SourceText originalCSharpText, SourceText changedCSharpText, CancellationToken cancellationToken) - { - // Now that we're done with everything, lets see if there are any using statements to fix up - // We do this by comparing the original generated C# code, and the changed C# code, and look for a difference - // in using statements. We can't use edits for this for two main reasons: - // - // 1. Using statements in the generated code might come from _Imports.razor, or from this file, and C# will shove them anywhere - // 2. The edit might not be clean. eg given: - // using System; - // using System.Text; - // Adding "using System.Linq;" could result in an insert of "Linq;\r\nusing System." on line 2 - // - // So because of the above, we look for a difference in C# using directive nodes directly from the C# syntax tree, and apply them manually - // to the Razor document. - - var oldUsings = await FindUsingDirectiveStringsAsync(originalCSharpText, cancellationToken).ConfigureAwait(false); - var newUsings = await FindUsingDirectiveStringsAsync(changedCSharpText, cancellationToken).ConfigureAwait(false); - - using var edits = new PooledArrayBuilder(); - foreach (var usingStatement in newUsings.Except(oldUsings)) - { - // This identifier will be eventually thrown away. - Debug.Assert(codeDocument.Source.FilePath != null); - var identifier = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(codeDocument.Source.FilePath, UriKind.Relative) }; - var workspaceEdit = AddUsingsCodeActionResolver.CreateAddUsingWorkspaceEdit(usingStatement, additionalEdit: null, codeDocument, codeDocumentIdentifier: identifier); - edits.AddRange(workspaceEdit.DocumentChanges!.Value.First.First().Edits); - } - - return edits.ToArray(); - } - - private static async Task> FindUsingDirectiveStringsAsync(SourceText originalCSharpText, CancellationToken cancellationToken) - { - var syntaxTree = CSharpSyntaxTree.ParseText(originalCSharpText, cancellationToken: cancellationToken); - var syntaxRoot = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); - - // We descend any compilation unit (ie, the file) or and namespaces because the compiler puts all usings inside - // the namespace node. - var usings = syntaxRoot.DescendantNodes(n => n is BaseNamespaceDeclarationSyntax or CompilationUnitSyntax) - // Filter to using directives - .OfType() - // Select everything after the initial "using " part of the statement, and excluding the ending semi-colon. The - // semi-colon is valid in Razor, but users find it surprising. This is slightly lazy, for sure, but has - // the advantage of us not caring about changes to C# syntax, we just grab whatever Roslyn wanted to put in, so - // we should still work in C# v26 - .Select(u => u.ToString()["using ".Length..^1]); - - return usings; - } - - internal static readonly Regex AddUsingVSCodeAction = new Regex("@?using ([^;]+);?$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); - - // Internal for testing - internal static string GetNamespaceFromFQN(string fullyQualifiedName) - { - if (!TrySplitNamespaceAndType(fullyQualifiedName.AsSpan(), out var namespaceName, out _)) - { - return string.Empty; - } - - return namespaceName.ToString(); - } - - internal static bool TryCreateAddUsingResolutionParams(string fullyQualifiedName, Uri uri, TextDocumentEdit? additionalEdit, [NotNullWhen(true)] out string? @namespace, [NotNullWhen(true)] out RazorCodeActionResolutionParams? resolutionParams) - { - @namespace = GetNamespaceFromFQN(fullyQualifiedName); - if (string.IsNullOrEmpty(@namespace)) - { - @namespace = null; - resolutionParams = null; - return false; - } - - var actionParams = new AddUsingsCodeActionParams - { - Uri = uri, - Namespace = @namespace, - AdditionalEdit = additionalEdit - }; - - resolutionParams = new RazorCodeActionResolutionParams - { - Action = LanguageServerConstants.CodeActions.AddUsing, - Language = LanguageServerConstants.CodeActions.Languages.Razor, - Data = actionParams, - }; - - return true; - } - - /// - /// Extracts the namespace from a C# add using statement provided by Visual Studio - /// - /// Add using statement of the form `using System.X;` - /// Extract namespace `System.X` - /// The prefix to show, before the namespace, if any - /// - internal static bool TryExtractNamespace(string csharpAddUsing, out string @namespace, out string prefix) - { - // We must remove any leading/trailing new lines from the add using edit - csharpAddUsing = csharpAddUsing.Trim(); - var regexMatchedTextEdit = AddUsingVSCodeAction.Match(csharpAddUsing); - if (!regexMatchedTextEdit.Success || - - // Two Regex matching groups are expected - // 1. `using namespace;` - // 2. `namespace` - regexMatchedTextEdit.Groups.Count != 2) - { - // Text edit in an unexpected format - @namespace = string.Empty; - prefix = string.Empty; - return false; - } - - @namespace = regexMatchedTextEdit.Groups[1].Value; - prefix = csharpAddUsing[..regexMatchedTextEdit.Index]; - return true; - } - - internal static bool TrySplitNamespaceAndType(ReadOnlySpan fullTypeName, out ReadOnlySpan @namespace, out ReadOnlySpan typeName) - { - @namespace = default; - typeName = default; - - if (fullTypeName.IsEmpty) - { - return false; - } - - var nestingLevel = 0; - var splitLocation = -1; - for (var i = fullTypeName.Length - 1; i >= 0; i--) - { - var c = fullTypeName[i]; - if (c == Type.Delimiter && nestingLevel == 0) - { - splitLocation = i; - break; - } - else if (c == '>') - { - nestingLevel++; - } - else if (c == '<') - { - nestingLevel--; - } - } - - if (splitLocation == -1) - { - typeName = fullTypeName; - return true; - } - - @namespace = fullTypeName[..splitLocation]; - - var typeNameStartLocation = splitLocation + 1; - if (typeNameStartLocation < fullTypeName.Length) - { - typeName = fullTypeName[typeNameStartLocation..]; - } - - return true; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs index 0cbd6d6f4a6..679eb58c843 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/TypeAccessibilityCodeActionProvider.cs @@ -16,6 +16,7 @@ using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -138,7 +139,7 @@ private static ImmutableArray ProcessCodeActionsVSCod var fqnCodeAction = CreateFQNCodeAction(context, diagnostic, codeAction, fqn); typeAccessibilityCodeActions.Add(fqnCodeAction); - if (AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fqn, context.Request.TextDocument.Uri, additionalEdit: null, out var @namespace, out var resolutionParams)) + if (AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fqn, context.Request.TextDocument.Uri, additionalEdit: null, out var @namespace, out var resolutionParams)) { var addUsingCodeAction = RazorCodeActionFactory.CreateAddComponentUsing(@namespace, newTagName: null, resolutionParams); typeAccessibilityCodeActions.Add(addUsingCodeAction); @@ -191,7 +192,7 @@ private static ImmutableArray ProcessCodeActionsVS( // For add using suggestions, the code action title is of the form: // `using System.Net;` else if (codeAction.Name is not null && codeAction.Name.Equals(RazorPredefinedCodeFixProviderNames.AddImport, StringComparison.Ordinal) && - AddUsingsCodeActionProviderHelper.TryExtractNamespace(codeAction.Title, out var @namespace, out var prefix)) + AddUsingsHelper.TryExtractNamespace(codeAction.Title, out var @namespace, out var prefix)) { codeAction.Title = $"{prefix}@using {@namespace}"; typeAccessibilityCodeActions.Add(codeAction.WrapResolvableCodeAction(context, LanguageServerConstants.CodeActions.Default)); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs index 5923d2ed861..f0516a53585 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/AddUsingsCodeActionResolver.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.Json; using System.Threading; @@ -16,6 +17,7 @@ using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions.Models; using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -50,169 +52,91 @@ internal sealed class AddUsingsCodeActionResolver(IDocumentContextFactory docume } var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { Uri = actionParams.Uri }; - return CreateAddUsingWorkspaceEdit(actionParams.Namespace, actionParams.AdditionalEdit, codeDocument, codeDocumentIdentifier); + return AddUsingsHelper.CreateAddUsingWorkspaceEdit(actionParams.Namespace, actionParams.AdditionalEdit, codeDocument, codeDocumentIdentifier); } - internal static WorkspaceEdit CreateAddUsingWorkspaceEdit(string @namespace, TextDocumentEdit? additionalEdit, RazorCodeDocument codeDocument, OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier) + internal static bool TryCreateAddUsingResolutionParams(string fullyQualifiedName, Uri uri, TextDocumentEdit? additionalEdit, [NotNullWhen(true)] out string? @namespace, [NotNullWhen(true)] out RazorCodeActionResolutionParams? resolutionParams) { - /* The heuristic is as follows: - * - * - If no @using, @namespace, or @page directives are present, insert the statements at the top of the - * file in alphabetical order. - * - If a @namespace or @page are present, the statements are inserted after the last line-wise in - * alphabetical order. - * - If @using directives are present and alphabetized with System directives at the top, the statements - * will be placed in the correct locations according to that ordering. - * - Otherwise it's kind of undefined; it's only geared to insert based on alphabetization. - * - * This is generally sufficient for our current situation (inserting a single @using statement to include a - * component), however it has holes if we eventually use it for other purposes. If we want to deal with - * that now I can come up with a more sophisticated heuristic (something along the lines of checking if - * there's already an ordering, etc.). - */ - using var documentChanges = new PooledArrayBuilder(); - - // Need to add the additional edit first, as the actual usings go at the top of the file, and would - // change the ranges needed in the additional edit if they went in first - if (additionalEdit is not null) + @namespace = GetNamespaceFromFQN(fullyQualifiedName); + if (string.IsNullOrEmpty(@namespace)) { - documentChanges.Add(additionalEdit); + @namespace = null; + resolutionParams = null; + return false; } - using var usingDirectives = new PooledArrayBuilder(); - CollectUsingDirectives(codeDocument, ref usingDirectives.AsRef()); - if (usingDirectives.Count > 0) + var actionParams = new AddUsingsCodeActionParams { - // Interpolate based on existing @using statements - var edits = GenerateSingleUsingEditsInterpolated(codeDocument, codeDocumentIdentifier, @namespace, in usingDirectives); - documentChanges.Add(edits); - } - else - { - // Just throw them at the top - var edits = GenerateSingleUsingEditsAtTop(codeDocument, codeDocumentIdentifier, @namespace); - documentChanges.Add(edits); - } + Uri = uri, + Namespace = @namespace, + AdditionalEdit = additionalEdit + }; - return new WorkspaceEdit() + resolutionParams = new RazorCodeActionResolutionParams { - DocumentChanges = documentChanges.ToArray(), + Action = LanguageServerConstants.CodeActions.AddUsing, + Language = LanguageServerConstants.CodeActions.Languages.Razor, + Data = actionParams, }; + + return true; } - private static TextDocumentEdit GenerateSingleUsingEditsInterpolated( - RazorCodeDocument codeDocument, - OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, - string newUsingNamespace, - ref readonly PooledArrayBuilder existingUsingDirectives) + // Internal for testing + internal static string GetNamespaceFromFQN(string fullyQualifiedName) { - Debug.Assert(existingUsingDirectives.Count > 0); - - using var edits = new PooledArrayBuilder(); - var newText = $"@using {newUsingNamespace}{Environment.NewLine}"; - - foreach (var usingDirective in existingUsingDirectives) + if (!TrySplitNamespaceAndType(fullyQualifiedName.AsSpan(), out var namespaceName, out _)) { - // Skip System directives; if they're at the top we don't want to insert before them - var usingDirectiveNamespace = usingDirective.Statement.ParsedNamespace; - if (usingDirectiveNamespace.StartsWith("System", StringComparison.Ordinal)) - { - continue; - } - - if (string.CompareOrdinal(newUsingNamespace, usingDirectiveNamespace) < 0) - { - var usingDirectiveLineIndex = codeDocument.Source.Text.GetLinePosition(usingDirective.Node.Span.Start).Line; - var edit = VsLspFactory.CreateTextEdit(line: usingDirectiveLineIndex, character: 0, newText); - edits.Add(edit); - break; - } - } - - // If we haven't actually found a place to insert the using directive, do so at the end - if (edits.Count == 0) - { - var endIndex = existingUsingDirectives[^1].Node.Span.End; - var lineIndex = GetLineIndexOrEnd(codeDocument, endIndex - 1) + 1; - var edit = VsLspFactory.CreateTextEdit(line: lineIndex, character: 0, newText); - edits.Add(edit); + return string.Empty; } - return new TextDocumentEdit() - { - TextDocument = codeDocumentIdentifier, - Edits = edits.ToArray() - }; + return namespaceName.ToString(); } - private static TextDocumentEdit GenerateSingleUsingEditsAtTop( - RazorCodeDocument codeDocument, - OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, - string newUsingNamespace) + private static bool TrySplitNamespaceAndType(ReadOnlySpan fullTypeName, out ReadOnlySpan @namespace, out ReadOnlySpan typeName) { - var insertPosition = (0, 0); - - // If we don't have usings, insert after the last namespace or page directive, which ever comes later - var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; - var lastNamespaceOrPageDirective = syntaxTreeRoot - .DescendantNodes() - .LastOrDefault(IsNamespaceOrPageDirective); + @namespace = default; + typeName = default; - if (lastNamespaceOrPageDirective != null) + if (fullTypeName.IsEmpty) { - var lineIndex = GetLineIndexOrEnd(codeDocument, lastNamespaceOrPageDirective.Span.End - 1) + 1; - insertPosition = (lineIndex, 0); + return false; } - // Insert all usings at the given point - return new TextDocumentEdit + var nestingLevel = 0; + var splitLocation = -1; + for (var i = fullTypeName.Length - 1; i >= 0; i--) { - TextDocument = codeDocumentIdentifier, - Edits = [VsLspFactory.CreateTextEdit(insertPosition, newText: $"@using {newUsingNamespace}{Environment.NewLine}")] - }; - } - - private static int GetLineIndexOrEnd(RazorCodeDocument codeDocument, int endIndex) - { - if (endIndex < codeDocument.Source.Text.Length) - { - return codeDocument.Source.Text.GetLinePosition(endIndex).Line; - } - else - { - return codeDocument.Source.Text.Lines.Count; + var c = fullTypeName[i]; + if (c == Type.Delimiter && nestingLevel == 0) + { + splitLocation = i; + break; + } + else if (c == '>') + { + nestingLevel++; + } + else if (c == '<') + { + nestingLevel--; + } } - } - private static void CollectUsingDirectives(RazorCodeDocument codeDocument, ref PooledArrayBuilder directives) - { - var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; - foreach (var node in syntaxTreeRoot.DescendantNodes()) + if (splitLocation == -1) { - if (node is RazorDirectiveSyntax directiveNode) - { - foreach (var child in directiveNode.DescendantNodes()) - { - if (child.GetChunkGenerator() is AddImportChunkGenerator { IsStatic: false } usingStatement) - { - directives.Add(new RazorUsingDirective(directiveNode, usingStatement)); - } - } - } + typeName = fullTypeName; + return true; } - } - private static bool IsNamespaceOrPageDirective(SyntaxNode node) - { - if (node is RazorDirectiveSyntax directiveNode) + @namespace = fullTypeName[..splitLocation]; + + var typeNameStartLocation = splitLocation + 1; + if (typeNameStartLocation < fullTypeName.Length) { - return directiveNode.DirectiveDescriptor == ComponentPageDirective.Directive || - directiveNode.DirectiveDescriptor == NamespaceDirective.Directive || - directiveNode.DirectiveDescriptor == PageDirective.Directive; + typeName = fullTypeName[typeNameStartLocation..]; } - return false; + return true; } - - private readonly record struct RazorUsingDirective(RazorDirectiveSyntax Node, AddImportChunkGenerator Statement); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs index 2e8ec37c2f9..8a551f300b3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/ComponentAccessibilityCodeActionProvider.cs @@ -176,7 +176,7 @@ private static async Task AddComponentAccessFromTagAsync(RazorCodeActionContext // name to give the tag. if (!tagHelperPair.CaseInsensitiveMatch || newTagName is not null) { - if (AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fullyQualifiedName, context.Request.TextDocument.Uri, additionalEdit, out var @namespace, out var resolutionParams)) + if (AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fullyQualifiedName, context.Request.TextDocument.Uri, additionalEdit, out var @namespace, out var resolutionParams)) { var addUsingCodeAction = RazorCodeActionFactory.CreateAddComponentUsing(@namespace, newTagName, resolutionParams); container.Add(addUsingCodeAction); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs index c163bc336d7..a737698a1d9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs @@ -29,7 +29,7 @@ protected override async Task AddUsingStatementEditsIfNecessaryAsync // Because we need to parse the C# code twice for this operation, lets do a quick check to see if its even necessary if (textEdits.Any(e => e.NewText.IndexOf("using") != -1)) { - var usingStatementEdits = await AddUsingsCodeActionProviderHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); + var usingStatementEdits = await AddUsingsHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); finalEdits = [.. usingStatementEdits, .. finalEdits]; } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs new file mode 100644 index 00000000000..b7bc5f33fc3 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/AddUsingsHelper.cs @@ -0,0 +1,272 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.Linq; +using System.Text.RegularExpressions; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc.Razor.Extensions; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Components; +using Microsoft.AspNetCore.Razor.Language.Extensions; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal static class AddUsingsHelper +{ + private static readonly Regex s_addUsingVSCodeAction = new Regex("@?using ([^;]+);?$", RegexOptions.Compiled, TimeSpan.FromSeconds(1)); + + private readonly record struct RazorUsingDirective(RazorDirectiveSyntax Node, AddImportChunkGenerator Statement); + + public static async Task GetUsingStatementEditsAsync(RazorCodeDocument codeDocument, SourceText originalCSharpText, SourceText changedCSharpText, CancellationToken cancellationToken) + { + // Now that we're done with everything, lets see if there are any using statements to fix up + // We do this by comparing the original generated C# code, and the changed C# code, and look for a difference + // in using statements. We can't use edits for this for two main reasons: + // + // 1. Using statements in the generated code might come from _Imports.razor, or from this file, and C# will shove them anywhere + // 2. The edit might not be clean. eg given: + // using System; + // using System.Text; + // Adding "using System.Linq;" could result in an insert of "Linq;\r\nusing System." on line 2 + // + // So because of the above, we look for a difference in C# using directive nodes directly from the C# syntax tree, and apply them manually + // to the Razor document. + + var oldUsings = await FindUsingDirectiveStringsAsync(originalCSharpText, cancellationToken).ConfigureAwait(false); + var newUsings = await FindUsingDirectiveStringsAsync(changedCSharpText, cancellationToken).ConfigureAwait(false); + + using var edits = new PooledArrayBuilder(); + foreach (var usingStatement in newUsings.Except(oldUsings)) + { + // This identifier will be eventually thrown away. + Debug.Assert(codeDocument.Source.FilePath != null); + var identifier = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(codeDocument.Source.FilePath, UriKind.Relative) }; + var workspaceEdit = CreateAddUsingWorkspaceEdit(usingStatement, additionalEdit: null, codeDocument, codeDocumentIdentifier: identifier); + edits.AddRange(workspaceEdit.DocumentChanges!.Value.First.First().Edits); + } + + return edits.ToArray(); + } + + /// + /// Extracts the namespace from a C# add using statement provided by Visual Studio + /// + /// Add using statement of the form `using System.X;` + /// Extract namespace `System.X` + /// The prefix to show, before the namespace, if any + /// + public static bool TryExtractNamespace(string csharpAddUsing, out string @namespace, out string prefix) + { + // We must remove any leading/trailing new lines from the add using edit + csharpAddUsing = csharpAddUsing.Trim(); + var regexMatchedTextEdit = s_addUsingVSCodeAction.Match(csharpAddUsing); + if (!regexMatchedTextEdit.Success || + + // Two Regex matching groups are expected + // 1. `using namespace;` + // 2. `namespace` + regexMatchedTextEdit.Groups.Count != 2) + { + // Text edit in an unexpected format + @namespace = string.Empty; + prefix = string.Empty; + return false; + } + + @namespace = regexMatchedTextEdit.Groups[1].Value; + prefix = csharpAddUsing[..regexMatchedTextEdit.Index]; + return true; + } + + public static WorkspaceEdit CreateAddUsingWorkspaceEdit(string @namespace, TextDocumentEdit? additionalEdit, RazorCodeDocument codeDocument, OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier) + { + /* The heuristic is as follows: + * + * - If no @using, @namespace, or @page directives are present, insert the statements at the top of the + * file in alphabetical order. + * - If a @namespace or @page are present, the statements are inserted after the last line-wise in + * alphabetical order. + * - If @using directives are present and alphabetized with System directives at the top, the statements + * will be placed in the correct locations according to that ordering. + * - Otherwise it's kind of undefined; it's only geared to insert based on alphabetization. + * + * This is generally sufficient for our current situation (inserting a single @using statement to include a + * component), however it has holes if we eventually use it for other purposes. If we want to deal with + * that now I can come up with a more sophisticated heuristic (something along the lines of checking if + * there's already an ordering, etc.). + */ + using var documentChanges = new PooledArrayBuilder(); + + // Need to add the additional edit first, as the actual usings go at the top of the file, and would + // change the ranges needed in the additional edit if they went in first + if (additionalEdit is not null) + { + documentChanges.Add(additionalEdit); + } + + using var usingDirectives = new PooledArrayBuilder(); + CollectUsingDirectives(codeDocument, ref usingDirectives.AsRef()); + if (usingDirectives.Count > 0) + { + // Interpolate based on existing @using statements + var edits = GenerateSingleUsingEditsInterpolated(codeDocument, codeDocumentIdentifier, @namespace, in usingDirectives); + documentChanges.Add(edits); + } + else + { + // Just throw them at the top + var edits = GenerateSingleUsingEditsAtTop(codeDocument, codeDocumentIdentifier, @namespace); + documentChanges.Add(edits); + } + + return new WorkspaceEdit() + { + DocumentChanges = documentChanges.ToArray(), + }; + } + + private static async Task> FindUsingDirectiveStringsAsync(SourceText originalCSharpText, CancellationToken cancellationToken) + { + var syntaxTree = CSharpSyntaxTree.ParseText(originalCSharpText, cancellationToken: cancellationToken); + var syntaxRoot = await syntaxTree.GetRootAsync(cancellationToken).ConfigureAwait(false); + + // We descend any compilation unit (ie, the file) or and namespaces because the compiler puts all usings inside + // the namespace node. + var usings = syntaxRoot.DescendantNodes(n => n is BaseNamespaceDeclarationSyntax or CompilationUnitSyntax) + // Filter to using directives + .OfType() + // Select everything after the initial "using " part of the statement, and excluding the ending semi-colon. The + // semi-colon is valid in Razor, but users find it surprising. This is slightly lazy, for sure, but has + // the advantage of us not caring about changes to C# syntax, we just grab whatever Roslyn wanted to put in, so + // we should still work in C# v26 + .Select(u => u.ToString()["using ".Length..^1]); + + return usings; + } + + private static TextDocumentEdit GenerateSingleUsingEditsInterpolated( + RazorCodeDocument codeDocument, + OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, + string newUsingNamespace, + ref readonly PooledArrayBuilder existingUsingDirectives) + { + Debug.Assert(existingUsingDirectives.Count > 0); + + using var edits = new PooledArrayBuilder(); + var newText = $"@using {newUsingNamespace}{Environment.NewLine}"; + + foreach (var usingDirective in existingUsingDirectives) + { + // Skip System directives; if they're at the top we don't want to insert before them + var usingDirectiveNamespace = usingDirective.Statement.ParsedNamespace; + if (usingDirectiveNamespace.StartsWith("System", StringComparison.Ordinal)) + { + continue; + } + + if (string.CompareOrdinal(newUsingNamespace, usingDirectiveNamespace) < 0) + { + var usingDirectiveLineIndex = codeDocument.Source.Text.GetLinePosition(usingDirective.Node.Span.Start).Line; + var edit = VsLspFactory.CreateTextEdit(line: usingDirectiveLineIndex, character: 0, newText); + edits.Add(edit); + break; + } + } + + // If we haven't actually found a place to insert the using directive, do so at the end + if (edits.Count == 0) + { + var endIndex = existingUsingDirectives[^1].Node.Span.End; + var lineIndex = GetLineIndexOrEnd(codeDocument, endIndex - 1) + 1; + var edit = VsLspFactory.CreateTextEdit(line: lineIndex, character: 0, newText); + edits.Add(edit); + } + + return new TextDocumentEdit() + { + TextDocument = codeDocumentIdentifier, + Edits = edits.ToArray() + }; + } + + private static TextDocumentEdit GenerateSingleUsingEditsAtTop( + RazorCodeDocument codeDocument, + OptionalVersionedTextDocumentIdentifier codeDocumentIdentifier, + string newUsingNamespace) + { + var insertPosition = (0, 0); + + // If we don't have usings, insert after the last namespace or page directive, which ever comes later + var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; + var lastNamespaceOrPageDirective = syntaxTreeRoot + .DescendantNodes() + .LastOrDefault(IsNamespaceOrPageDirective); + + if (lastNamespaceOrPageDirective != null) + { + var lineIndex = GetLineIndexOrEnd(codeDocument, lastNamespaceOrPageDirective.Span.End - 1) + 1; + insertPosition = (lineIndex, 0); + } + + // Insert all usings at the given point + return new TextDocumentEdit + { + TextDocument = codeDocumentIdentifier, + Edits = [VsLspFactory.CreateTextEdit(insertPosition, newText: $"@using {newUsingNamespace}{Environment.NewLine}")] + }; + } + + private static int GetLineIndexOrEnd(RazorCodeDocument codeDocument, int endIndex) + { + if (endIndex < codeDocument.Source.Text.Length) + { + return codeDocument.Source.Text.GetLinePosition(endIndex).Line; + } + else + { + return codeDocument.Source.Text.Lines.Count; + } + } + + private static void CollectUsingDirectives(RazorCodeDocument codeDocument, ref PooledArrayBuilder directives) + { + var syntaxTreeRoot = codeDocument.GetSyntaxTree().Root; + foreach (var node in syntaxTreeRoot.DescendantNodes()) + { + if (node is RazorDirectiveSyntax directiveNode) + { + foreach (var child in directiveNode.DescendantNodes()) + { + if (child.GetChunkGenerator() is AddImportChunkGenerator { IsStatic: false } usingStatement) + { + directives.Add(new RazorUsingDirective(directiveNode, usingStatement)); + } + } + } + } + } + + private static bool IsNamespaceOrPageDirective(RazorSyntaxNode node) + { + if (node is RazorDirectiveSyntax directiveNode) + { + return directiveNode.DirectiveDescriptor == ComponentPageDirective.Directive || + directiveNode.DirectiveDescriptor == NamespaceDirective.Directive || + directiveNode.DirectiveDescriptor == PageDirective.Directive; + } + + return false; + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs deleted file mode 100644 index 5ce053f830a..00000000000 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionProviderFactoryTest.cs +++ /dev/null @@ -1,114 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using Microsoft.AspNetCore.Razor.Test.Common; -using Xunit; -using Xunit.Abstractions; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; - -public class AddUsingsCodeActionProviderFactoryTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) -{ - [Fact] - public void GetNamespaceFromFQN_Invalid_ReturnsEmpty() - { - // Arrange - var fqn = "Abc"; - - // Act - var namespaceName = AddUsingsCodeActionProviderHelper.GetNamespaceFromFQN(fqn); - - // Assert - Assert.Empty(namespaceName); - } - - [Fact] - public void GetNamespaceFromFQN_Valid_ReturnsNamespace() - { - // Arrange - var fqn = "Abc.Xyz"; - - // Act - var namespaceName = AddUsingsCodeActionProviderHelper.GetNamespaceFromFQN(fqn); - - // Assert - Assert.Equal("Abc", namespaceName); - } - - [Fact] - public void TryCreateAddUsingResolutionParams_CreatesResolutionParams() - { - // Arrange - var fqn = "Abc.Xyz"; - var docUri = new Uri("c:/path"); - - // Act - var result = AddUsingsCodeActionProviderHelper.TryCreateAddUsingResolutionParams(fqn, docUri, additionalEdit: null, out var @namespace, out var resolutionParams); - - // Assert - Assert.True(result); - Assert.Equal("Abc", @namespace); - Assert.NotNull(resolutionParams); - } - - [Fact] - public void TryExtractNamespace_Invalid_ReturnsFalse() - { - // Arrange - var csharpAddUsing = "Abc.Xyz;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.False(res); - Assert.Empty(@namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "using Abc.Xyz;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("Abc.Xyz", @namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_WithStatic_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "using static X.Y.Z;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("static X.Y.Z", @namespace); - Assert.Empty(prefix); - } - - [Fact] - public void TryExtractNamespace_WithTypeNameCorrection_ReturnsTrue() - { - // Arrange - var csharpAddUsing = "Goo - using X.Y.Z;"; - - // Act - var res = AddUsingsCodeActionProviderHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); - - // Assert - Assert.True(res); - Assert.Equal("X.Y.Z", @namespace); - Assert.Equal("Goo - ", prefix); - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs index 7d22fc8ee82..2808f79a5f3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/AddUsingsCodeActionResolverTest.cs @@ -20,6 +20,48 @@ public class AddUsingsCodeActionResolverTest(ITestOutputHelper testOutput) : Lan { private readonly IDocumentContextFactory _emptyDocumentContextFactory = new TestDocumentContextFactory(); + [Fact] + public void GetNamespaceFromFQN_Invalid_ReturnsEmpty() + { + // Arrange + var fqn = "Abc"; + + // Act + var namespaceName = AddUsingsCodeActionResolver.GetNamespaceFromFQN(fqn); + + // Assert + Assert.Empty(namespaceName); + } + + [Fact] + public void GetNamespaceFromFQN_Valid_ReturnsNamespace() + { + // Arrange + var fqn = "Abc.Xyz"; + + // Act + var namespaceName = AddUsingsCodeActionResolver.GetNamespaceFromFQN(fqn); + + // Assert + Assert.Equal("Abc", namespaceName); + } + + [Fact] + public void TryCreateAddUsingResolutionParams_CreatesResolutionParams() + { + // Arrange + var fqn = "Abc.Xyz"; + var docUri = new Uri("c:/path"); + + // Act + var result = AddUsingsCodeActionResolver.TryCreateAddUsingResolutionParams(fqn, docUri, additionalEdit: null, out var @namespace, out var resolutionParams); + + // Assert + Assert.True(result); + Assert.Equal("Abc", @namespace); + Assert.NotNull(resolutionParams); + } + [Fact] public async Task Handle_MissingFile() { diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs new file mode 100644 index 00000000000..3f2b2066886 --- /dev/null +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/Formatting/AddUsingsHelperTest.cs @@ -0,0 +1,71 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.AspNetCore.Razor.Test.Common; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +public class AddUsingsHelperTest(ITestOutputHelper testOutput) : ToolingTestBase(testOutput) +{ + [Fact] + public void TryExtractNamespace_Invalid_ReturnsFalse() + { + // Arrange + var csharpAddUsing = "Abc.Xyz;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.False(res); + Assert.Empty(@namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "using Abc.Xyz;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("Abc.Xyz", @namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_WithStatic_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "using static X.Y.Z;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("static X.Y.Z", @namespace); + Assert.Empty(prefix); + } + + [Fact] + public void TryExtractNamespace_WithTypeNameCorrection_ReturnsTrue() + { + // Arrange + var csharpAddUsing = "Goo - using X.Y.Z;"; + + // Act + var res = AddUsingsHelper.TryExtractNamespace(csharpAddUsing, out var @namespace, out var prefix); + + // Assert + Assert.True(res); + Assert.Equal("X.Y.Z", @namespace); + Assert.Equal("Goo - ", prefix); + } +} From 8984db9496ea28e92a061bc560ad430ac7c90716 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 14:29:29 +1000 Subject: [PATCH 124/271] Combine back into one on type formatting pass --- .../IServiceCollectionExtensions.cs | 2 +- .../LspCSharpOnTypeFormattingPass.cs | 39 ------------------- ...sBase.cs => CSharpOnTypeFormattingPass.cs} | 27 +++++++++---- .../RemoteCSharpOnTypeFormattingPass.cs | 27 ------------- .../TestRazorFormattingService.cs | 2 +- 5 files changed, 21 insertions(+), 76 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{CSharpOnTypeFormattingPassBase.cs => CSharpOnTypeFormattingPass.cs} (94%) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 851e04822aa..865632e5da2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -64,7 +64,7 @@ public static void AddFormattingServices(this IServiceCollection services) // Formatting Passes services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs deleted file mode 100644 index a737698a1d9..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspCSharpOnTypeFormattingPass.cs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.CodeActions; -using Microsoft.CodeAnalysis; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal sealed class LspCSharpOnTypeFormattingPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : CSharpOnTypeFormattingPassBase(documentMappingService, loggerFactory) -{ - - protected override async Task AddUsingStatementEditsIfNecessaryAsync(CodeAnalysis.Razor.Formatting.FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) - { - if (context.AutomaticallyAddUsings) - { - // Because we need to parse the C# code twice for this operation, lets do a quick check to see if its even necessary - if (textEdits.Any(e => e.NewText.IndexOf("using") != -1)) - { - var usingStatementEdits = await AddUsingsHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); - finalEdits = [.. usingStatementEdits, .. finalEdits]; - } - } - - return finalEdits; - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs similarity index 94% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPassBase.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs index 8e17fba8298..d20744517ed 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs @@ -24,14 +24,12 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; - -internal abstract class CSharpOnTypeFormattingPassBase( +internal sealed class CSharpOnTypeFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) : CSharpFormattingPassBase(documentMappingService) { - private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { @@ -208,7 +206,20 @@ public async override Task ExecuteAsync(FormattingContext cont return new FormattingResult(finalEdits); } - protected abstract Task AddUsingStatementEditsIfNecessaryAsync(FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken); + private static async Task AddUsingStatementEditsIfNecessaryAsync(CodeAnalysis.Razor.Formatting.FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) + { + if (context.AutomaticallyAddUsings) + { + // Because we need to parse the C# code twice for this operation, lets do a quick check to see if its even necessary + if (textEdits.Any(e => e.NewText.IndexOf("using") != -1)) + { + var usingStatementEdits = await AddUsingsHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); + finalEdits = [.. usingStatementEdits, .. finalEdits]; + } + } + + return finalEdits; + } // Returns the minimal TextSpan that encompasses all the differences between the old and the new text. private static SourceText ApplyChangesAndTrackChange(SourceText oldText, IEnumerable changes, out TextSpan spanBeforeChange, out TextSpan spanAfterChange) @@ -323,7 +334,7 @@ private static void CleanupSourceMappingStart(FormattingContext context, Range s if (owner is CSharpStatementLiteralSyntax && owner.TryGetPreviousSibling(out var prevNode) && - prevNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + prevNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && owner.SpanStart == template.Span.End && IsOnSingleLine(template, text)) { @@ -477,7 +488,7 @@ private static void CleanupSourceMappingEnd(FormattingContext context, Range sou if (owner is CSharpStatementLiteralSyntax && owner.NextSpan() is { } nextNode && - nextNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + nextNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && template.SpanStart == owner.Span.End && IsOnSingleLine(template, text)) { @@ -523,7 +534,7 @@ private static void CleanupSourceMappingEnd(FormattingContext context, Range sou changes.Add(change); } - private static bool IsOnSingleLine(SyntaxNode node, SourceText text) + private static bool IsOnSingleLine(RazorSyntaxNode node, SourceText text) { var linePositionSpan = text.GetLinePositionSpan(node.Span); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs deleted file mode 100644 index 6d4e33d0af8..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal sealed class RemoteCSharpOnTypeFormattingPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : CSharpOnTypeFormattingPassBase(documentMappingService, loggerFactory) -{ - protected override Task AddUsingStatementEditsIfNecessaryAsync(CodeAnalysis.Razor.Formatting.FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) - { - Debug.Fail("Implement this when code actions are migrated to cohosting"); - - return Task.FromResult(finalEdits); - } -} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 11e6b4f1553..a1e3f585baa 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -57,7 +57,7 @@ public static async Task CreateWithFullSupportAsync( { new HtmlFormattingPass(mappingService, client, versionCache, loggerFactory), new CSharpFormattingPass(mappingService, loggerFactory), - new LspCSharpOnTypeFormattingPass(mappingService, loggerFactory), + new CSharpOnTypeFormattingPass(mappingService, loggerFactory), new LspRazorFormattingPass(mappingService, optionsMonitor), new FormattingDiagnosticValidationPass(mappingService, loggerFactory), new FormattingContentValidationPass(mappingService, loggerFactory), From fba3f1e3042e41a4085d54e469240949dec59522 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 14:55:51 +1000 Subject: [PATCH 125/271] Rename some methods --- .../LanguageServer/RazorCSharpFormattingBenchmark.cs | 2 +- .../AutoInsert/OnAutoInsertEndpoint.cs | 4 ++-- .../CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs | 2 +- .../CodeActions/Html/DefaultHtmlCodeActionProvider.cs | 2 +- .../CodeActions/Razor/GenerateMethodCodeActionResolver.cs | 2 +- .../Delegation/DelegatedCompletionItemResolver.cs | 4 ++-- .../Formatting/DocumentFormattingEndpoint.cs | 2 +- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 2 +- .../Formatting/DocumentRangeFormattingEndpoint.cs | 2 +- .../Formatting/HtmlFormatter.cs | 2 +- .../WrapWithTag/WrapWithTagEndpoint.cs | 2 +- .../Formatting/IRazorFormattingService.cs | 8 ++++---- .../Formatting/RazorFormattingService.cs | 8 ++++---- .../CSharp/DefaultCSharpCodeActionResolverTest.cs | 2 +- .../Formatting_NetFx/FormattingLanguageServerTestBase.cs | 8 ++++---- .../Formatting_NetFx/FormattingTestBase.cs | 6 +++--- .../WrapWithTag/WrapWithTagEndpointTests.cs | 6 +++--- 17 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 2d965e9ce51..8c08ab2b481 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -118,7 +118,7 @@ public async Task RazorCSharpFormattingAsync() var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); - var edits = await RazorFormattingService.FormatAsync(documentContext, range: null, options, CancellationToken.None); + var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, range: null, options, CancellationToken.None); #if DEBUG // For debugging purposes only. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index cbcef4ece99..43f4e4fa6d4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -206,8 +206,8 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V var edits = new[] { delegatedResponse.TextEdit }; var mappedEdits = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet - ? await _razorFormattingService.FormatSnippetAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, cancellationToken).ConfigureAwait(false) - : await _razorFormattingService.FormatOnTypeAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, hostDocumentIndex: 0, triggerCharacter: '\0', cancellationToken).ConfigureAwait(false); + ? await _razorFormattingService.GetSnippetFormattingEditsAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, cancellationToken).ConfigureAwait(false) + : await _razorFormattingService.GetOnTypeFormattingEditsAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, hostDocumentIndex: 0, triggerCharacter: '\0', cancellationToken).ConfigureAwait(false); if (mappedEdits is not [{ } edit]) { return null; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 8c44e462dc1..7a59a497c31 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -80,7 +80,7 @@ public async override Task ResolveAsync( // Remaps the text edits from the generated C# to the razor file, // as well as applying appropriate formatting. - var formattedEdits = await _razorFormattingService.FormatCodeActionAsync( + var formattedEdits = await _razorFormattingService.GetCodeActionEditsAsync( documentContext, RazorLanguageKind.CSharp, csharpTextEdits, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs index 1ce1cba0a8e..b5d22fabb6c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Html/DefaultHtmlCodeActionProvider.cs @@ -54,7 +54,7 @@ public static async Task RemapAndFixHtmlCodeActionEditAsync(IEditMappingService foreach (var edit in documentEdits) { - edit.Edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, edit.Edits); + edit.Edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, edit.Edits); } codeAction.Edit = new WorkspaceEdit diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index 34a71cd61b9..bc6a10fc10d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -210,7 +210,7 @@ private async Task GenerateMethodInCodeBlockAsync( InsertSpaces = _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, }; - var formattedEdits = await _razorFormattingService.FormatCodeActionAsync( + var formattedEdits = await _razorFormattingService.GetCodeActionEditsAsync( documentContext, RazorLanguageKind.CSharp, result, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index 4f3ae959b27..fdfcc2c0b74 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -122,7 +122,7 @@ private async Task PostProcessCompletionItemAsync( { if (resolvedCompletionItem.TextEdit.Value.TryGetFirst(out var textEdit)) { - var formattedTextEdit = await _formattingService.FormatSnippetAsync( + var formattedTextEdit = await _formattingService.GetSnippetFormattingEditsAsync( documentContext, RazorLanguageKind.CSharp, new[] { textEdit }, @@ -141,7 +141,7 @@ private async Task PostProcessCompletionItemAsync( if (resolvedCompletionItem.AdditionalTextEdits is not null) { - var formattedTextEdits = await _formattingService.FormatSnippetAsync( + var formattedTextEdits = await _formattingService.GetSnippetFormattingEditsAsync( documentContext, RazorLanguageKind.CSharp, resolvedCompletionItem.AdditionalTextEdits, diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index d25fff093bc..f290028d351 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -56,7 +56,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentFormattingParams return null; } - var edits = await _razorFormattingService.FormatAsync(documentContext, range: null, request.Options, cancellationToken).ConfigureAwait(false); + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, range: null, request.Options, cancellationToken).ConfigureAwait(false); return edits; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index c165d829a7a..0a8a1d3c3bc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -114,7 +114,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting Debug.Assert(request.Character.Length > 0); - var formattedEdits = await _razorFormattingService.FormatOnTypeAsync(documentContext, triggerCharacterKind, Array.Empty(), request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + var formattedEdits = await _razorFormattingService.GetOnTypeFormattingEditsAsync(documentContext, triggerCharacterKind, Array.Empty(), request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); if (formattedEdits.Length == 0) { _logger.LogInformation($"No formatting changes were necessary"); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index 4fa0207619b..aedd7d1edfa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -56,7 +56,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentRangeFormattingP return null; } - var edits = await _razorFormattingService.FormatAsync(documentContext, request.Range, request.Options, cancellationToken).ConfigureAwait(false); + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, request.Range, request.Options, cancellationToken).ConfigureAwait(false); return edits; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 2b613a183e9..5f5206fd8b4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -92,7 +92,7 @@ public async Task FormatOnTypeAsync( /// minimal text edits /// // Internal for testing - public static TextEdit[] FixHtmlTestEdits(SourceText htmlSourceText, TextEdit[] edits) + public static TextEdit[] FixHtmlTextEdits(SourceText htmlSourceText, TextEdit[] edits) { // Avoid computing a minimal diff if we don't need to if (!edits.Any(e => e.NewText.Contains("~"))) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs index 990dbc07a6e..743b84d60bf 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/WrapWithTag/WrapWithTagEndpoint.cs @@ -116,7 +116,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(WrapWithTagParams reques if (htmlResponse.TextEdits is not null) { var htmlSourceText = await documentContext.GetHtmlSourceTextAsync(cancellationToken).ConfigureAwait(false); - htmlResponse.TextEdits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, htmlResponse.TextEdits); + htmlResponse.TextEdits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, htmlResponse.TextEdits); } return htmlResponse; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index a5001dddd02..afca7fb2283 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -11,13 +11,13 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal interface IRazorFormattingService { - Task FormatAsync( + Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken); - Task FormatOnTypeAsync( + Task GetOnTypeFormattingEditsAsync( DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, @@ -26,14 +26,14 @@ Task FormatOnTypeAsync( char triggerCharacter, CancellationToken cancellationToken); - Task FormatCodeActionAsync( + Task GetCodeActionEditsAsync( DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken); - Task FormatSnippetAsync( + Task GetSnippetFormattingEditsAsync( DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 1b14b3fa013..4a638abfc0f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -36,7 +36,7 @@ public RazorFormattingService( _workspaceFactory = workspaceFactory ?? throw new ArgumentNullException(nameof(workspaceFactory)); } - public async Task FormatAsync( + public async Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, Range? range, FormattingOptions options, @@ -104,13 +104,13 @@ private static TextEdit[] GetMinimalEdits(SourceText originalText, IEnumerable FormatOnTypeAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public Task FormatCodeActionAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCodeActionEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: false, automaticallyAddUsings: true, cancellationToken: cancellationToken); - public async Task FormatSnippetAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) + public async Task GetSnippetFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) { if (kind == RazorLanguageKind.CSharp) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs index 8ee8500337e..b29742538c6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs @@ -188,7 +188,7 @@ private static void CreateCodeActionResolver( private static IRazorFormattingService CreateRazorFormattingService(Uri documentUri) { var razorFormattingService = Mock.Of( - rfs => rfs.FormatCodeActionAsync( + rfs => rfs.GetCodeActionEditsAsync( It.Is(c => c.Uri == documentUri), RazorLanguageKind.CSharp, It.IsAny(), diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 54ae3aa7ff7..d3d2a80cc53 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -38,23 +38,23 @@ internal class DummyRazorFormattingService : IRazorFormattingService { public bool Called { get; private set; } - public Task FormatAsync(VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) + public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) { Called = true; return SpecializedTasks.EmptyArray(); } - public Task FormatCodeActionAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCodeActionEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) { return Task.FromResult(formattedEdits); } - public Task FormatOnTypeAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) { return Task.FromResult(formattedEdits); } - public Task FormatSnippetAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetSnippetFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) { return Task.FromResult(formattedEdits); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 497b2b175d9..a5039858157 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -81,7 +81,7 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act - var edits = await formattingService.FormatAsync(documentContext, range, options, DisposalToken); + var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, range, options, DisposalToken); // Assert var edited = ApplyEdits(source, edits); @@ -131,7 +131,7 @@ private protected async Task RunOnTypeFormattingTestAsync( var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act - var edits = await formattingService.FormatOnTypeAsync(documentContext, languageKind, Array.Empty(), options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + var edits = await formattingService.GetOnTypeFormattingEditsAsync(documentContext, languageKind, Array.Empty(), options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); // Assert var edited = ApplyEdits(razorSourceText, edits); @@ -199,7 +199,7 @@ protected async Task RunCodeActionFormattingTestAsync( var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act - var edits = await formattingService.FormatCodeActionAsync(documentContext, languageKind, codeActionEdits, options, DisposalToken); + var edits = await formattingService.GetCodeActionEditsAsync(documentContext, languageKind, codeActionEdits, options, DisposalToken); // Assert var edited = ApplyEdits(razorSourceText, edits); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs index 80a563b38d4..b7c5955ea81 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/WrapWithTag/WrapWithTagEndpointTests.cs @@ -282,7 +282,7 @@ public async Task CleanUpTextEdits_NoTilde() }; var htmlSourceText = await context!.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.Same(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); @@ -322,7 +322,7 @@ public async Task CleanUpTextEdits_BadEditWithTilde() }; var htmlSourceText = await context!.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.NotSame(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); @@ -362,7 +362,7 @@ public async Task CleanUpTextEdits_GoodEditWithTilde() }; var htmlSourceText = await context.GetHtmlSourceTextAsync(DisposalToken); - var edits = HtmlFormatter.FixHtmlTestEdits(htmlSourceText, computedEdits); + var edits = HtmlFormatter.FixHtmlTextEdits(htmlSourceText, computedEdits); Assert.NotSame(computedEdits, edits); var finalText = inputSourceText.WithChanges(edits.Select(inputSourceText.GetTextChange)); From 2c39c207c74f1608b9bff7adabefbfe19ea138fb Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 16:01:18 +1000 Subject: [PATCH 126/271] Random bits of cleanup before some bigger moves --- .../Formatting/DocumentFormattingEndpoint.cs | 16 ++-- .../Formatting/HtmlFormatter.cs | 39 +++------- .../Extensions/SourceTextExtensions.cs | 21 +++++ .../Formatting/CSharpOnTypeFormattingPass.cs | 14 +--- .../Formatting/RazorFormattingService.cs | 77 +++++-------------- 5 files changed, 56 insertions(+), 111 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index f290028d351..7887eb319d6 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -12,18 +12,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentFormattingName)] -internal class DocumentFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal class DocumentFormattingEndpoint( + IRazorFormattingService razorFormattingService, + RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService; - private readonly RazorLSPOptionsMonitor _optionsMonitor; - - public DocumentFormattingEndpoint( - IRazorFormattingService razorFormattingService, - RazorLSPOptionsMonitor optionsMonitor) - { - _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - } + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 5f5206fd8b4..224ae300c68 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -15,31 +15,20 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -internal class HtmlFormatter +internal sealed class HtmlFormatter( + IClientConnection clientConnection, + IDocumentVersionCache documentVersionCache) { - private readonly IDocumentVersionCache _documentVersionCache; - private readonly IClientConnection _clientConnection; - - public HtmlFormatter( - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache) - { - _clientConnection = clientConnection; - _documentVersionCache = documentVersionCache; - } + private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; + private readonly IClientConnection _clientConnection = clientConnection; public async Task FormatAsync( FormattingContext context, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) { - return Array.Empty(); + return []; } var @params = new RazorDocumentFormattingParams() @@ -57,7 +46,7 @@ public async Task FormatAsync( @params, cancellationToken).ConfigureAwait(false); - return result?.Edits ?? Array.Empty(); + return result?.Edits ?? []; } public async Task FormatOnTypeAsync( @@ -66,7 +55,7 @@ public async Task FormatOnTypeAsync( { if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) { - return Array.Empty(); + return []; } var @params = new RazorDocumentOnTypeFormattingParams() @@ -83,7 +72,7 @@ public async Task FormatOnTypeAsync( @params, cancellationToken).ConfigureAwait(false); - return result?.Edits ?? Array.Empty(); + return result?.Edits ?? []; } /// @@ -98,14 +87,6 @@ public static TextEdit[] FixHtmlTextEdits(SourceText htmlSourceText, TextEdit[] if (!edits.Any(e => e.NewText.Contains("~"))) return edits; - // First we apply the edits that the Html language server wanted, to the Html document - var textChanges = edits.Select(htmlSourceText.GetTextChange); - var changedText = htmlSourceText.WithChanges(textChanges); - - // Now we use our minimal text differ algorithm to get the bare minimum of edits - var minimalChanges = SourceTextDiffer.GetMinimalTextChanges(htmlSourceText, changedText, DiffKind.Char); - var minimalEdits = minimalChanges.Select(htmlSourceText.GetTextEdit).ToArray(); - - return minimalEdits; + return htmlSourceText.NormalizeTextEdits(edits); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs index 6d72290f117..cf8b62aa8c5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs @@ -3,9 +3,12 @@ using System; using System.Buffers; +using System.Linq; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.TextDifferencing; using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Text; @@ -269,4 +272,22 @@ public static bool TryGetSourceLocation(this SourceText text, int line, int char location = default; return false; } + + public static TextEdit[] NormalizeTextEdits(this SourceText text, TextEdit[] edits) + => NormalizeTextEdits(text, edits, out _); + + public static TextEdit[] NormalizeTextEdits(this SourceText text, TextEdit[] edits, out SourceText originalTextWithChanges) + { + var changes = edits.Select(text.GetTextChange); + originalTextWithChanges = text.WithChanges(changes); + + if (text.ContentEquals(originalTextWithChanges)) + { + return []; + } + + var cleanChanges = SourceTextDiffer.GetMinimalTextChanges(text, originalTextWithChanges, DiffKind.Char); + var cleanEdits = cleanChanges.Select(text.GetTextEdit).ToArray(); + return cleanEdits; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs index d20744517ed..1d965250575 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.AspNetCore.Razor.TextDifferencing; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; @@ -91,7 +90,7 @@ public async override Task ExecuteAsync(FormattingContext cont } } - var normalizedEdits = NormalizeTextEdits(csharpText, textEdits, out var originalTextWithChanges); + var normalizedEdits = csharpText.NormalizeTextEdits(textEdits, out var originalTextWithChanges); var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits, result.Kind); var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); if (filteredEdits.Length == 0) @@ -206,7 +205,7 @@ public async override Task ExecuteAsync(FormattingContext cont return new FormattingResult(finalEdits); } - private static async Task AddUsingStatementEditsIfNecessaryAsync(CodeAnalysis.Razor.Formatting.FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) + private static async Task AddUsingStatementEditsIfNecessaryAsync(FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) { if (context.AutomaticallyAddUsings) { @@ -540,13 +539,4 @@ private static bool IsOnSingleLine(RazorSyntaxNode node, SourceText text) return linePositionSpan.Start.Line == linePositionSpan.End.Line; } - - private static TextEdit[] NormalizeTextEdits(SourceText originalText, TextEdit[] edits, out SourceText originalTextWithChanges) - { - var changes = edits.Select(originalText.GetTextChange); - originalTextWithChanges = originalText.WithChanges(changes); - var cleanChanges = SourceTextDiffer.GetMinimalTextChanges(originalText, originalTextWithChanges, DiffKind.Char); - var cleanEdits = cleanChanges.Select(originalText.GetTextEdit).ToArray(); - return cleanEdits; - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 4a638abfc0f..5db87f7a9c7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -1,13 +1,12 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.TextDifferencing; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -18,23 +17,12 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal class RazorFormattingService : IRazorFormattingService +internal class RazorFormattingService( + IEnumerable formattingPasses, + IAdhocWorkspaceFactory workspaceFactory) : IRazorFormattingService { - private readonly List _formattingPasses; - private readonly IAdhocWorkspaceFactory _workspaceFactory; - - public RazorFormattingService( - IEnumerable formattingPasses, - IAdhocWorkspaceFactory workspaceFactory) - { - if (formattingPasses is null) - { - throw new ArgumentNullException(nameof(formattingPasses)); - } - - _formattingPasses = formattingPasses.OrderBy(f => f.Order).ToList(); - _workspaceFactory = workspaceFactory ?? throw new ArgumentNullException(nameof(workspaceFactory)); - } + private readonly ImmutableArray _formattingPasses = formattingPasses.OrderByAsArray(f => f.Order); + private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory; public async Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, @@ -82,26 +70,9 @@ public async Task GetDocumentFormattingEditsAsync( var filteredEdits = range is null ? result.Edits - : result.Edits.Where(e => range.LineOverlapsWith(e.Range)); + : result.Edits.Where(e => range.LineOverlapsWith(e.Range)).ToArray(); - return GetMinimalEdits(originalText, filteredEdits); - } - - private static TextEdit[] GetMinimalEdits(SourceText originalText, IEnumerable filteredEdits) - { - // Make sure the edits actually change something, or its not worth responding - var textChanges = filteredEdits.Select(originalText.GetTextChange); - var changedText = originalText.WithChanges(textChanges); - if (changedText.ContentEquals(originalText)) - { - return Array.Empty(); - } - - // Only send back the minimum edits - var minimalChanges = SourceTextDiffer.GetMinimalTextChanges(originalText, changedText, DiffKind.Char); - var finalEdits = minimalChanges.Select(originalText.GetTextEdit).ToArray(); - - return finalEdits; + return originalText.NormalizeTextEdits(filteredEdits); } public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) @@ -171,7 +142,7 @@ private async Task ApplyFormattedEditsAsync( } var originalText = context.SourceText; - var edits = GetMinimalEdits(originalText, result.Edits); + var edits = originalText.NormalizeTextEdits(result.Edits); if (collapseEdits) { @@ -179,10 +150,10 @@ private async Task ApplyFormattedEditsAsync( if (collapsedEdit.NewText.Length == 0 && collapsedEdit.Range.IsZeroWidth()) { - return Array.Empty(); + return []; } - return new[] { collapsedEdit }; + return [collapsedEdit]; } return edits; @@ -196,14 +167,7 @@ internal static TextEdit MergeEdits(TextEdit[] edits, SourceText sourceText) return edits[0]; } - var textChanges = new List(); - foreach (var edit in edits) - { - var change = new TextChange(sourceText.GetTextSpan(edit.Range), edit.NewText); - textChanges.Add(change); - } - - var changedText = sourceText.WithChanges(textChanges); + var changedText = sourceText.WithChanges(edits.Select(sourceText.GetTextChange)); var affectedRange = changedText.GetEncompassingTextChangeRange(sourceText); var spanBeforeChange = affectedRange.Span; var spanAfterChange = new TextSpan(spanBeforeChange.Start, affectedRange.NewLength); @@ -218,26 +182,21 @@ private static void WrapCSharpSnippets(TextEdit[] snippetEdits) { // Currently this method only supports wrapping `$0`, any additional markers aren't formatted properly. - for (var i = 0; i < snippetEdits.Length; i++) + foreach (var snippetEdit in snippetEdits) { - var snippetEdit = snippetEdits[i]; - // Formatting doesn't work with syntax errors caused by the cursor marker ($0). // So, let's avoid the error by wrapping the cursor marker in a comment. - var wrappedText = snippetEdit.NewText.Replace("$0", "/*$0*/"); - snippetEdit.NewText = wrappedText; + snippetEdit.NewText = snippetEdit.NewText.Replace("$0", "/*$0*/"); } } private static void UnwrapCSharpSnippets(TextEdit[] snippetEdits) { - for (var i = 0; i < snippetEdits.Length; i++) + foreach (var snippetEdit in snippetEdits) { - var snippetEdit = snippetEdits[i]; - - // Unwrap the cursor marker. - var unwrappedText = snippetEdit.NewText.Replace("/*$0*/", "$0"); - snippetEdit.NewText = unwrappedText; + // Formatting doesn't work with syntax errors caused by the cursor marker ($0). + // So, let's avoid the error by wrapping the cursor marker in a comment. + snippetEdit.NewText = snippetEdit.NewText.Replace("/*$0*/", "$0"); } } } From e45f09468d5377aec2bd99d868cb877c8355687d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 16:25:41 +1000 Subject: [PATCH 127/271] Make it more explicit that we only do code action formatting for C# --- .../CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs | 3 +-- .../CodeActions/Razor/GenerateMethodCodeActionResolver.cs | 3 +-- .../Formatting/IRazorFormattingService.cs | 3 +-- .../Formatting/RazorFormattingService.cs | 4 ++-- .../CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs | 3 +-- .../Formatting_NetFx/FormattingLanguageServerTestBase.cs | 2 +- 6 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 7a59a497c31..ec5b35b595b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -80,9 +80,8 @@ public async override Task ResolveAsync( // Remaps the text edits from the generated C# to the razor file, // as well as applying appropriate formatting. - var formattedEdits = await _razorFormattingService.GetCodeActionEditsAsync( + var formattedEdits = await _razorFormattingService.GetCSharpCodeActionEditsAsync( documentContext, - RazorLanguageKind.CSharp, csharpTextEdits, s_defaultFormattingOptions, cancellationToken).ConfigureAwait(false); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index bc6a10fc10d..918e13fe064 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -210,9 +210,8 @@ private async Task GenerateMethodInCodeBlockAsync( InsertSpaces = _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, }; - var formattedEdits = await _razorFormattingService.GetCodeActionEditsAsync( + var formattedEdits = await _razorFormattingService.GetCSharpCodeActionEditsAsync( documentContext, - RazorLanguageKind.CSharp, result, formattingOptions, cancellationToken).ConfigureAwait(false); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index afca7fb2283..0c49c56f288 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -26,9 +26,8 @@ Task GetOnTypeFormattingEditsAsync( char triggerCharacter, CancellationToken cancellationToken); - Task GetCodeActionEditsAsync( + Task GetCSharpCodeActionEditsAsync( DocumentContext documentContext, - RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 5db87f7a9c7..5e5420010b7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -78,8 +78,8 @@ public async Task GetDocumentFormattingEditsAsync( public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public Task GetCodeActionEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: false, automaticallyAddUsings: true, cancellationToken: cancellationToken); + public Task GetCSharpCodeActionEditsAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, formattedEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: false, automaticallyAddUsings: true, cancellationToken: cancellationToken); public async Task GetSnippetFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs index b29742538c6..fbaadf3db89 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs @@ -188,9 +188,8 @@ private static void CreateCodeActionResolver( private static IRazorFormattingService CreateRazorFormattingService(Uri documentUri) { var razorFormattingService = Mock.Of( - rfs => rfs.GetCodeActionEditsAsync( + rfs => rfs.GetCSharpCodeActionEditsAsync( It.Is(c => c.Uri == documentUri), - RazorLanguageKind.CSharp, It.IsAny(), It.IsAny(), It.IsAny()) == Task.FromResult(s_defaultFormattedEdits), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index d3d2a80cc53..9f00c0c5494 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -44,7 +44,7 @@ public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext return SpecializedTasks.EmptyArray(); } - public Task GetCodeActionEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCSharpCodeActionEditsAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) { return Task.FromResult(formattedEdits); } From a7027160acadff26eaf1f74f848d60f29efc3f52 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 17:06:55 +1000 Subject: [PATCH 128/271] Be SUPER specific about our APIs, what they accept, and what they return This probably looks like overkill, but hopefully the next commit will help explain a little about what is going on. --- .../RazorCSharpFormattingBenchmark.cs | 2 +- .../AutoInsert/OnAutoInsertEndpoint.cs | 13 ++++--- .../CSharp/DefaultCSharpCodeActionResolver.cs | 4 +- .../Razor/GenerateMethodCodeActionResolver.cs | 4 +- .../DelegatedCompletionItemResolver.cs | 33 ++++++---------- .../Formatting/DocumentFormattingEndpoint.cs | 5 ++- .../DocumentOnTypeFormattingEndpoint.cs | 18 ++++++++- .../DocumentRangeFormattingEndpoint.cs | 5 ++- .../Formatting/IRazorFormattingService.cs | 25 ++++++++---- .../Formatting/RazorFormattingService.cs | 39 +++++++++++-------- .../DefaultCSharpCodeActionResolverTest.cs | 8 ++-- .../FormattingLanguageServerTestBase.cs | 25 ++++++++---- .../Formatting_NetFx/FormattingTestBase.cs | 21 ++++++++-- 13 files changed, 128 insertions(+), 74 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 8c08ab2b481..2c74f91bc7d 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -118,7 +118,7 @@ public async Task RazorCSharpFormattingAsync() var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); - var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, range: null, options, CancellationToken.None); + var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, [], range: null, options, CancellationToken.None); #if DEBUG // For debugging purposes only. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 43f4e4fa6d4..4ec4479463a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -203,19 +204,19 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } // For C# we run the edit through our formatting engine - var edits = new[] { delegatedResponse.TextEdit }; + Debug.Assert(positionInfo.LanguageKind == RazorLanguageKind.CSharp); - var mappedEdits = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet - ? await _razorFormattingService.GetSnippetFormattingEditsAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, cancellationToken).ConfigureAwait(false) - : await _razorFormattingService.GetOnTypeFormattingEditsAsync(documentContext, positionInfo.LanguageKind, edits, originalRequest.Options, hostDocumentIndex: 0, triggerCharacter: '\0', cancellationToken).ConfigureAwait(false); - if (mappedEdits is not [{ } edit]) + var mappedEdit = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet + ? await _razorFormattingService.GetCSharpSnippetFormattingEditAsync(documentContext, [delegatedResponse.TextEdit], originalRequest.Options, cancellationToken).ConfigureAwait(false) + : await _razorFormattingService.GetSingleCSharpEditAsync(documentContext, delegatedResponse.TextEdit, originalRequest.Options, cancellationToken).ConfigureAwait(false); + if (mappedEdit is null) { return null; } return new VSInternalDocumentOnAutoInsertResponseItem() { - TextEdit = edit, + TextEdit = mappedEdit, TextEditFormat = delegatedResponse.TextEditFormat, }; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index ec5b35b595b..5dca63c9137 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -80,7 +80,7 @@ public async override Task ResolveAsync( // Remaps the text edits from the generated C# to the razor file, // as well as applying appropriate formatting. - var formattedEdits = await _razorFormattingService.GetCSharpCodeActionEditsAsync( + var formattedEdit = await _razorFormattingService.GetCSharpCodeActionEditAsync( documentContext, csharpTextEdits, s_defaultFormattingOptions, @@ -101,7 +101,7 @@ public async override Task ResolveAsync( new TextDocumentEdit() { TextDocument = codeDocumentIdentifier, - Edits = formattedEdits, + Edits = formattedEdit is null ? [] : [formattedEdit], } } }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index 918e13fe064..15a36e487aa 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -210,13 +210,13 @@ private async Task GenerateMethodInCodeBlockAsync( InsertSpaces = _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, }; - var formattedEdits = await _razorFormattingService.GetCSharpCodeActionEditsAsync( + var formattedEdit = await _razorFormattingService.GetCSharpCodeActionEditAsync( documentContext, result, formattingOptions, cancellationToken).ConfigureAwait(false); - edits = formattedEdits; + edits = formattedEdit is null ? [] : [formattedEdit]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index fdfcc2c0b74..4b4644be46e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -15,21 +15,14 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; -internal class DelegatedCompletionItemResolver : CompletionItemResolver +internal class DelegatedCompletionItemResolver( + IDocumentContextFactory documentContextFactory, + IRazorFormattingService formattingService, + IClientConnection clientConnection) : CompletionItemResolver { - private readonly IDocumentContextFactory _documentContextFactory; - private readonly IRazorFormattingService _formattingService; - private readonly IClientConnection _clientConnection; - - public DelegatedCompletionItemResolver( - IDocumentContextFactory documentContextFactory, - IRazorFormattingService formattingService, - IClientConnection clientConnection) - { - _documentContextFactory = documentContextFactory; - _formattingService = formattingService; - _clientConnection = clientConnection; - } + private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; + private readonly IRazorFormattingService _formattingService = formattingService; + private readonly IClientConnection _clientConnection = clientConnection; public override async Task ResolveAsync( VSInternalCompletionItem item, @@ -122,14 +115,13 @@ private async Task PostProcessCompletionItemAsync( { if (resolvedCompletionItem.TextEdit.Value.TryGetFirst(out var textEdit)) { - var formattedTextEdit = await _formattingService.GetSnippetFormattingEditsAsync( + var formattedTextEdit = await _formattingService.GetCSharpSnippetFormattingEditAsync( documentContext, - RazorLanguageKind.CSharp, - new[] { textEdit }, + [textEdit], formattingOptions, cancellationToken).ConfigureAwait(false); - resolvedCompletionItem.TextEdit = formattedTextEdit.FirstOrDefault(); + resolvedCompletionItem.TextEdit = formattedTextEdit; } else { @@ -141,14 +133,13 @@ private async Task PostProcessCompletionItemAsync( if (resolvedCompletionItem.AdditionalTextEdits is not null) { - var formattedTextEdits = await _formattingService.GetSnippetFormattingEditsAsync( + var formattedTextEdit = await _formattingService.GetCSharpSnippetFormattingEditAsync( documentContext, - RazorLanguageKind.CSharp, resolvedCompletionItem.AdditionalTextEdits, formattingOptions, cancellationToken).ConfigureAwait(false); - resolvedCompletionItem.AdditionalTextEdits = formattedTextEdits; + resolvedCompletionItem.AdditionalTextEdits = formattedTextEdit is null ? null : [formattedTextEdit]; } return resolvedCompletionItem; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index 7887eb319d6..92b146fb504 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -50,7 +50,10 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentFormattingParams return null; } - var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, range: null, request.Options, cancellationToken).ConfigureAwait(false); + // TODO: In the next commit, get the Html edits from the Html formatter + var htmlEdits = Array.Empty(); + + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range: null, request.Options, cancellationToken).ConfigureAwait(false); return edits; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 0a8a1d3c3bc..0f88d469b94 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -114,7 +114,23 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting Debug.Assert(request.Character.Length > 0); - var formattedEdits = await _razorFormattingService.GetOnTypeFormattingEditsAsync(documentContext, triggerCharacterKind, Array.Empty(), request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + TextEdit[] formattedEdits; + if (triggerCharacterKind == RazorLanguageKind.CSharp) + { + formattedEdits = await _razorFormattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + } + else if (triggerCharacterKind == RazorLanguageKind.Html) + { + // TODO: In the next commit, get the Html edits from the Html formatter + var htmlEdits = Array.Empty(); + formattedEdits = await _razorFormattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + } + else + { + Assumed.Unreachable(); + return null; + } + if (formattedEdits.Length == 0) { _logger.LogInformation($"No formatting changes were necessary"); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index aedd7d1edfa..48ead551983 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -56,7 +56,10 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentRangeFormattingP return null; } - var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, request.Range, request.Options, cancellationToken).ConfigureAwait(false); + // TODO: In the next commit, get the Html edits from the Html formatter + var htmlEdits = Array.Empty(); + + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, request.Range, request.Options, cancellationToken).ConfigureAwait(false); return edits; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index 0c49c56f288..54bfba4f885 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -4,7 +4,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; @@ -13,28 +12,40 @@ internal interface IRazorFormattingService { Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, + TextEdit[] htmlEdits, Range? range, FormattingOptions options, CancellationToken cancellationToken); - Task GetOnTypeFormattingEditsAsync( + Task GetHtmlOnTypeFormattingEditsAsync( DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] formattedEdits, + TextEdit[] htmlEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken); - Task GetCSharpCodeActionEditsAsync( + Task GetCSharpOnTypeFormattingEditsAsync( + DocumentContext documentContext, + FormattingOptions options, + int hostDocumentIndex, + char triggerCharacter, + CancellationToken cancellationToken); + + Task GetSingleCSharpEditAsync( + DocumentContext documentContext, + TextEdit initialEdit, + FormattingOptions options, + CancellationToken cancellationToken); + + Task GetCSharpCodeActionEditAsync( DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken); - Task GetSnippetFormattingEditsAsync( + Task GetCSharpSnippetFormattingEditAsync( DocumentContext documentContext, - RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 5e5420010b7..eedc6f49899 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -26,6 +26,7 @@ internal class RazorFormattingService( public async Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, + TextEdit[] htmlEdits, Range? range, FormattingOptions options, CancellationToken cancellationToken) @@ -61,7 +62,7 @@ public async Task GetDocumentFormattingEditsAsync( using var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, _workspaceFactory); var originalText = context.SourceText; - var result = new FormattingResult([]); + var result = new FormattingResult(htmlEdits); foreach (var pass in _formattingPasses) { cancellationToken.ThrowIfCancellationRequested(); @@ -75,22 +76,31 @@ public async Task GetDocumentFormattingEditsAsync( return originalText.NormalizeTextEdits(filteredEdits); } - public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, kind, formattedEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); + public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [], options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public Task GetCSharpCodeActionEditsAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, formattedEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: false, automaticallyAddUsings: true, cancellationToken: cancellationToken); + public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.Html, htmlEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public async Task GetSnippetFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) + public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit edit, FormattingOptions options, CancellationToken cancellationToken) { - if (kind == RazorLanguageKind.CSharp) - { - WrapCSharpSnippets(edits); - } + var formattedEdits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [edit], options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); + return formattedEdits.SingleOrDefault(); + } + + public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] initialEdits, FormattingOptions options, CancellationToken cancellationToken) + { + var edits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, initialEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: true, automaticallyAddUsings: true, cancellationToken: cancellationToken).ConfigureAwait(false); + return edits.SingleOrDefault(); + } + + public async Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) + { + WrapCSharpSnippets(edits); var formattedEdits = await ApplyFormattedEditsAsync( documentContext, - kind, + RazorLanguageKind.CSharp, edits, options, hostDocumentIndex: 0, @@ -100,12 +110,9 @@ public async Task GetSnippetFormattingEditsAsync(DocumentContext doc automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); - if (kind == RazorLanguageKind.CSharp) - { - UnwrapCSharpSnippets(formattedEdits); - } + UnwrapCSharpSnippets(formattedEdits); - return formattedEdits; + return formattedEdits.SingleOrDefault(); } private async Task ApplyFormattedEditsAsync( diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs index fbaadf3db89..4bd0ec70dfe 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs @@ -39,7 +39,7 @@ public class DefaultCSharpCodeActionResolverTest(ITestOutputHelper testOutput) : } }; - private static readonly TextEdit[] s_defaultFormattedEdits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Remapped & Formatted Edit")]; + private static readonly TextEdit s_defaultFormattedEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "Remapped & Formatted Edit"); private static readonly CodeAction s_defaultUnresolvedCodeAction = new CodeAction() { @@ -63,7 +63,7 @@ public async Task ResolveAsync_ReturnsResolvedCodeAction() var returnedEdits = returnedCodeAction.Edit.DocumentChanges.Value; Assert.True(returnedEdits.TryGetFirst(out var textDocumentEdits)); var returnedTextDocumentEdit = Assert.Single(textDocumentEdits[0].Edits); - Assert.Equal(s_defaultFormattedEdits.First(), returnedTextDocumentEdit); + Assert.Equal(s_defaultFormattedEdit, returnedTextDocumentEdit); } [Fact] @@ -188,11 +188,11 @@ private static void CreateCodeActionResolver( private static IRazorFormattingService CreateRazorFormattingService(Uri documentUri) { var razorFormattingService = Mock.Of( - rfs => rfs.GetCSharpCodeActionEditsAsync( + rfs => rfs.GetCSharpCodeActionEditAsync( It.Is(c => c.Uri == documentUri), It.IsAny(), It.IsAny(), - It.IsAny()) == Task.FromResult(s_defaultFormattedEdits), MockBehavior.Strict); + It.IsAny()) == Task.FromResult(s_defaultFormattedEdit), MockBehavior.Strict); return razorFormattingService; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 9f00c0c5494..e6771a34d08 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -12,7 +12,6 @@ using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit.Abstractions; using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; @@ -38,25 +37,35 @@ internal class DummyRazorFormattingService : IRazorFormattingService { public bool Called { get; private set; } - public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext documentContext, Range? range, FormattingOptions options, CancellationToken cancellationToken) + public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext documentContext, TextEdit[] htmlEdits, Range? range, FormattingOptions options, CancellationToken cancellationToken) { Called = true; return SpecializedTasks.EmptyArray(); } - public Task GetCSharpCodeActionEditsAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); } - public Task GetOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); } - public Task GetSnippetFormattingEditsAsync(DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) { - return Task.FromResult(formattedEdits); + throw new NotImplementedException(); + } + + public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + { + return Task.FromResult(htmlEdits); + } + + public Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit initialEdit, FormattingOptions options, CancellationToken cancellationToken) + { + throw new NotImplementedException(); } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index a5039858157..de1c65f5dcd 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -80,8 +80,11 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); + // TODO: In the next commit, get the Html edits from the Html formatter + var htmlEdits = Array.Empty(); + // Act - var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, range, options, DisposalToken); + var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range, options, DisposalToken); // Assert var edited = ApplyEdits(source, edits); @@ -131,7 +134,17 @@ private protected async Task RunOnTypeFormattingTestAsync( var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act - var edits = await formattingService.GetOnTypeFormattingEditsAsync(documentContext, languageKind, Array.Empty(), options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + TextEdit[] edits; + if (languageKind == RazorLanguageKind.CSharp) + { + edits = await formattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + } + else + { + // todo: + var htmlEdits = Array.Empty(); + edits = await formattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + } // Assert var edited = ApplyEdits(razorSourceText, edits); @@ -199,10 +212,10 @@ protected async Task RunCodeActionFormattingTestAsync( var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act - var edits = await formattingService.GetCodeActionEditsAsync(documentContext, languageKind, codeActionEdits, options, DisposalToken); + var edit = await formattingService.GetCSharpCodeActionEditAsync(documentContext, codeActionEdits, options, DisposalToken); // Assert - var edited = ApplyEdits(razorSourceText, edits); + var edited = ApplyEdits(razorSourceText, [edit]); var actual = edited.ToString(); AssertEx.EqualOrDiff(expected, actual); From e56b85e264775d3a32aec230eb4c56f736ff73f9 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 21:26:18 +1000 Subject: [PATCH 129/271] Pass Html edits into the formatting service, so that the service doesn't need LSP client dependencies --- .../Formatting/DocumentFormattingEndpoint.cs | 9 ++--- .../DocumentOnTypeFormattingEndpoint.cs | 8 +++-- .../DocumentRangeFormattingEndpoint.cs | 25 ++++++------- .../Formatting/HtmlFormatter.cs | 35 +++++++++++-------- .../Formatting/HtmlFormattingPass.cs | 18 ++-------- .../CodeActionEndToEndTest.NetFx.cs | 2 +- .../DocumentOnTypeFormattingEndpointTest.cs | 26 ++++++++++---- .../DocumentRangeFormattingEndpointTest.cs | 19 +++++++--- .../Formatting_NetFx/FormattingTestBase.cs | 28 +++++++++++---- .../TestRazorFormattingService.cs | 13 +------ 10 files changed, 101 insertions(+), 82 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index 92b146fb504..b4e4a4a937c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -1,11 +1,11 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. 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.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -14,10 +14,13 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentFormattingName)] internal class DocumentFormattingEndpoint( IRazorFormattingService razorFormattingService, + IClientConnection clientConnection, + IDocumentVersionCache documentVersionCache, RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); public bool MutatesSolutionState => false; @@ -50,9 +53,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentFormattingParams return null; } - // TODO: In the next commit, get the Html edits from the Html formatter - var htmlEdits = Array.Empty(); - + var htmlEdits = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range: null, request.Options, cancellationToken).ConfigureAwait(false); return edits; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 0f88d469b94..6a7b42d1c0c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -9,6 +9,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; @@ -21,6 +22,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentOnTypeFormattingName)] internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, + IClientConnection clientConnection, + IDocumentVersionCache documentVersionCache, IDocumentMappingService documentMappingService, RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) @@ -29,6 +32,7 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); + private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; @@ -74,7 +78,6 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting } var documentContext = requestContext.DocumentContext; - if (documentContext is null) { _logger.LogWarning($"Failed to find document {request.TextDocument.Uri}."); @@ -121,8 +124,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting } else if (triggerCharacterKind == RazorLanguageKind.Html) { - // TODO: In the next commit, get the Html edits from the Html formatter - var htmlEdits = Array.Empty(); + var htmlEdits = await _htmlFormatter.GetOnTypeFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Position, request.Character, request.Options, cancellationToken).ConfigureAwait(false); formattedEdits = await _razorFormattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); } else diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index 48ead551983..c83d7ac3fd3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -1,29 +1,26 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. 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.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentRangeFormattingName)] -internal class DocumentRangeFormattingEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal class DocumentRangeFormattingEndpoint( + IRazorFormattingService razorFormattingService, + IClientConnection clientConnection, + IDocumentVersionCache documentVersionCache, + RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService; - private readonly RazorLSPOptionsMonitor _optionsMonitor; - - public DocumentRangeFormattingEndpoint( - IRazorFormattingService razorFormattingService, - RazorLSPOptionsMonitor optionsMonitor) - { - _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - } + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; + private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); public bool MutatesSolutionState => false; @@ -56,9 +53,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentRangeFormattingP return null; } - // TODO: In the next commit, get the Html edits from the Html formatter - var htmlEdits = Array.Empty(); - + var htmlEdits = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, request.Range, request.Options, cancellationToken).ConfigureAwait(false); return edits; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 224ae300c68..17f6a13235e 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -6,8 +6,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.TextDifferencing; -using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Formatting; using Microsoft.CodeAnalysis.Text; @@ -22,11 +21,13 @@ internal sealed class HtmlFormatter( private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly IClientConnection _clientConnection = clientConnection; - public async Task FormatAsync( - FormattingContext context, + public async Task GetDocumentFormattingEditsAsync( + IDocumentSnapshot documentSnapshot, + Uri uri, + FormattingOptions options, CancellationToken cancellationToken) { - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) + if (!_documentVersionCache.TryGetDocumentVersion(documentSnapshot, out var documentVersion)) { return []; } @@ -35,10 +36,10 @@ public async Task FormatAsync( { TextDocument = new TextDocumentIdentifier { - Uri = context.Uri, + Uri = uri, }, HostDocumentVersion = documentVersion.Value, - Options = context.Options + Options = options }; var result = await _clientConnection.SendRequestAsync( @@ -49,21 +50,25 @@ public async Task FormatAsync( return result?.Edits ?? []; } - public async Task FormatOnTypeAsync( - FormattingContext context, - CancellationToken cancellationToken) + public async Task GetOnTypeFormattingEditsAsync( + IDocumentSnapshot documentSnapshot, + Uri uri, + Position position, + string triggerCharacter, + FormattingOptions options, + CancellationToken cancellationToken) { - if (!_documentVersionCache.TryGetDocumentVersion(context.OriginalSnapshot, out var documentVersion)) + if (!_documentVersionCache.TryGetDocumentVersion(documentSnapshot, out var documentVersion)) { return []; } var @params = new RazorDocumentOnTypeFormattingParams() { - Position = context.SourceText.GetPosition(context.HostDocumentIndex), - Character = context.TriggerCharacter.ToString(), - TextDocument = new TextDocumentIdentifier { Uri = context.Uri }, - Options = context.Options, + Position = position, + Character = triggerCharacter.ToString(), + TextDocument = new TextDocumentIdentifier { Uri = uri }, + Options = options, HostDocumentVersion = documentVersion.Value, }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs index 3b3b4023e40..de1f7f83417 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; @@ -19,12 +18,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal sealed class HtmlFormattingPass( IDocumentMappingService documentMappingService, - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, ILoggerFactory loggerFactory) : FormattingPassBase(documentMappingService) { - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); // We want this to run first because it uses the client HTML formatter. @@ -36,22 +32,14 @@ public async override Task ExecuteAsync(FormattingContext cont { var originalText = context.SourceText; - TextEdit[] htmlEdits; - - if (context.IsFormatOnType && result.Kind == RazorLanguageKind.Html) - { - htmlEdits = await _htmlFormatter.FormatOnTypeAsync(context, cancellationToken).ConfigureAwait(false); - } - else if (!context.IsFormatOnType) - { - htmlEdits = await _htmlFormatter.FormatAsync(context, cancellationToken).ConfigureAwait(false); - } - else + if (context.IsFormatOnType && result.Kind != RazorLanguageKind.Html) { // We don't want to handle on type formatting requests for other languages return result; } + var htmlEdits = result.Edits; + var changedText = originalText; var changedContext = context; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs index 1090b3672e3..5519014c08c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CodeActionEndToEndTest.NetFx.cs @@ -1132,7 +1132,7 @@ private async Task ValidateCodeActionAsync( Assert.NotNull(codeActionToRun); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentContext.Snapshot, optionsMonitor?.CurrentValue); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, optionsMonitor?.CurrentValue); var changes = await GetEditsAsync( codeActionToRun, requestContext, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 17177a8e49c..d53ad0ecbdc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -5,6 +5,8 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -27,8 +29,10 @@ public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams { TextDocument = new TextDocumentIdentifier { Uri = uri, } }; var requestContext = CreateRazorRequestContext(documentContext: null); @@ -56,8 +60,10 @@ public async Task Handle_OnTypeFormatting_DocumentNotFound_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -91,8 +97,10 @@ public async Task Handle_OnTypeFormatting_RemapFailed_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -127,8 +135,10 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService.Object, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -163,8 +173,10 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService.Object, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -198,8 +210,10 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs index 964ed2d0ef8..f1a3cbebc8b 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs @@ -4,6 +4,8 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -22,9 +24,12 @@ public async Task Handle_FormattingEnabled_InvokesFormattingService() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); + var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var endpoint = new DocumentRangeFormattingEndpoint( - formattingService, optionsMonitor); + formattingService, clientConnection, documentVersionCache, optionsMonitor); var @params = new DocumentRangeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, } @@ -45,7 +50,9 @@ public async Task Handle_DocumentNotFound_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); var uri = new Uri("file://path/test.razor"); var @params = new DocumentRangeFormattingParams() { @@ -71,7 +78,9 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); var @params = new DocumentRangeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, } @@ -91,7 +100,9 @@ public async Task Handle_FormattingDisabled_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, optionsMonitor); + var clientConnection = StrictMock.Of(); + var documentVersionCache = StrictMock.Of(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); var @params = new DocumentRangeFormattingParams(); var requestContext = CreateRazorRequestContext(documentContext: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index de1c65f5dcd..559eba75bfc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -24,6 +24,7 @@ using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Settings.Internal; using Moq; using Roslyn.Test.Utilities; using Xunit; @@ -77,11 +78,18 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab InsertSpaces = insertSpaces, }; - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); - // TODO: In the next commit, get the Html edits from the Html formatter - var htmlEdits = Array.Empty(); + var projectManager = StrictMock.Of(); + var versionCache = new DocumentVersionCache(projectManager); + versionCache.TrackDocumentVersion(documentSnapshot, version: 1); + + var client = new FormattingLanguageServerClient(LoggerFactory); + client.AddCodeDocument(codeDocument); + + var htmlFormatter = new HtmlFormatter(client, versionCache); + var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); // Act var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range, options, DisposalToken); @@ -124,8 +132,7 @@ private protected async Task RunOnTypeFormattingTestAsync( filePathService, new TestDocumentContextFactory(), LoggerFactory); var languageKind = mappingService.GetLanguageKind(codeDocument, positionAfterTrigger, rightAssociative: false); - var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync( - LoggerFactory, codeDocument, documentSnapshot, razorLSPOptions); + var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var options = new FormattingOptions() { TabSize = tabSize, @@ -141,8 +148,15 @@ private protected async Task RunOnTypeFormattingTestAsync( } else { - // todo: - var htmlEdits = Array.Empty(); + var projectManager = StrictMock.Of(); + var versionCache = new DocumentVersionCache(projectManager); + versionCache.TrackDocumentVersion(documentSnapshot, version: 1); + + var client = new FormattingLanguageServerClient(LoggerFactory); + client.AddCodeDocument(codeDocument); + + var htmlFormatter = new HtmlFormatter(client, versionCache); + var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); edits = await formattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index a1e3f585baa..c9efe60bea0 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -22,7 +22,6 @@ internal static class TestRazorFormattingService public static async Task CreateWithFullSupportAsync( ILoggerFactory loggerFactory, RazorCodeDocument? codeDocument = null, - IDocumentSnapshot? documentSnapshot = null, RazorLSPOptions? razorLSPOptions = null) { codeDocument ??= TestRazorCodeDocument.CreateEmpty(); @@ -30,16 +29,6 @@ public static async Task CreateWithFullSupportAsync( var filePathService = new LSPFilePathService(TestLanguageServerFeatureOptions.Instance); var mappingService = new LspDocumentMappingService(filePathService, new TestDocumentContextFactory(), loggerFactory); - var projectManager = StrictMock.Of(); - var versionCache = new DocumentVersionCache(projectManager); - if (documentSnapshot is not null) - { - versionCache.TrackDocumentVersion(documentSnapshot, version: 1); - } - - var client = new FormattingLanguageServerClient(loggerFactory); - client.AddCodeDocument(codeDocument); - var configurationSyncService = new Mock(MockBehavior.Strict); configurationSyncService .Setup(c => c.GetLatestOptionsAsync(It.IsAny())) @@ -55,7 +44,7 @@ public static async Task CreateWithFullSupportAsync( var passes = new List() { - new HtmlFormattingPass(mappingService, client, versionCache, loggerFactory), + new HtmlFormattingPass(mappingService, loggerFactory), new CSharpFormattingPass(mappingService, loggerFactory), new CSharpOnTypeFormattingPass(mappingService, loggerFactory), new LspRazorFormattingPass(mappingService, optionsMonitor), From 3f578100fe25abb36f825f52cd2b0158d0d8a47f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 21:39:44 +1000 Subject: [PATCH 130/271] Get HtmlFormatter from DI --- .../IServiceCollectionExtensions.cs | 1 + .../Formatting/DocumentFormattingEndpoint.cs | 5 ++- .../DocumentOnTypeFormattingEndpoint.cs | 5 ++- .../DocumentRangeFormattingEndpoint.cs | 5 ++- .../Formatting/HtmlFormatter.cs | 2 +- .../Formatting/IHtmlFormatter.cs | 15 +++++++++ .../Formatting/RazorFormattingService.cs | 5 +++ .../DocumentOnTypeFormattingEndpointTest.cs | 32 +++++++------------ .../DocumentRangeFormattingEndpointTest.cs | 23 +++++-------- .../Formatting_NetFx/TestHtmlFormatter.cs | 24 ++++++++++++++ 10 files changed, 72 insertions(+), 45 deletions(-) create mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs create mode 100644 src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 865632e5da2..b1888555f1c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -59,6 +59,7 @@ public static void AddLifeCycleServices(this IServiceCollection services, RazorL public static void AddFormattingServices(this IServiceCollection services) { // Formatting + services.AddSingleton(); services.AddSingleton(); // Formatting Passes diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index b4e4a4a937c..003ab22f198 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -14,13 +14,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentFormattingName)] internal class DocumentFormattingEndpoint( IRazorFormattingService razorFormattingService, - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, + IHtmlFormatter htmlFormatter, RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 6a7b42d1c0c..d75cd09242c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -22,8 +22,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentOnTypeFormattingName)] internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, + IHtmlFormatter htmlFormatter, IDocumentMappingService documentMappingService, RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) @@ -32,7 +31,7 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index c83d7ac3fd3..bd27ec5b8fc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -14,13 +14,12 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; [RazorLanguageServerEndpoint(Methods.TextDocumentRangeFormattingName)] internal class DocumentRangeFormattingEndpoint( IRazorFormattingService razorFormattingService, - IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache, + IHtmlFormatter htmlFormatter, RazorLSPOptionsMonitor optionsMonitor) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - private readonly HtmlFormatter _htmlFormatter = new HtmlFormatter(clientConnection, documentVersionCache); + private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; public bool MutatesSolutionState => false; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 17f6a13235e..0522c8360ff 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -16,7 +16,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal sealed class HtmlFormatter( IClientConnection clientConnection, - IDocumentVersionCache documentVersionCache) + IDocumentVersionCache documentVersionCache) : IHtmlFormatter { private readonly IDocumentVersionCache _documentVersionCache = documentVersionCache; private readonly IClientConnection _clientConnection = clientConnection; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs new file mode 100644 index 00000000000..fd388022be9 --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +internal interface IHtmlFormatter +{ + Task GetDocumentFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, FormattingOptions options, CancellationToken cancellationToken); + Task GetOnTypeFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, Position position, string triggerCharacter, FormattingOptions options, CancellationToken cancellationToken); +} \ No newline at end of file diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index eedc6f49899..4f806d916e2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -31,6 +32,8 @@ public async Task GetDocumentFormattingEditsAsync( FormattingOptions options, CancellationToken cancellationToken) { + Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html"); + var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); // Range formatting happens on every paste, and if there are Razor diagnostics in the file @@ -127,6 +130,8 @@ private async Task ApplyFormattedEditsAsync( bool automaticallyAddUsings, CancellationToken cancellationToken) { + Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html"); + // If we only received a single edit, let's always return a single edit back. // Otherwise, merge only if explicitly asked. collapseEdits |= formattedEdits.Length == 1; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index d53ad0ecbdc..74201d434c3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -5,8 +5,6 @@ using System.Collections.Generic; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; @@ -29,10 +27,9 @@ public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams { TextDocument = new TextDocumentIdentifier { Uri = uri, } }; var requestContext = CreateRazorRequestContext(documentContext: null); @@ -60,10 +57,9 @@ public async Task Handle_OnTypeFormatting_DocumentNotFound_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -97,10 +93,9 @@ public async Task Handle_OnTypeFormatting_RemapFailed_ReturnsNull() var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -135,10 +130,9 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -173,10 +167,9 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -210,10 +203,9 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); + var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs index f1a3cbebc8b..a497f70c2bd 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs @@ -4,8 +4,6 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -24,12 +22,10 @@ public async Task Handle_FormattingEnabled_InvokesFormattingService() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); - + var htmlFormatter = new TestHtmlFormatter(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var endpoint = new DocumentRangeFormattingEndpoint( - formattingService, clientConnection, documentVersionCache, optionsMonitor); + formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, } @@ -50,9 +46,8 @@ public async Task Handle_DocumentNotFound_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var uri = new Uri("file://path/test.razor"); var @params = new DocumentRangeFormattingParams() { @@ -78,9 +73,8 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, } @@ -100,9 +94,8 @@ public async Task Handle_FormattingDisabled_ReturnsNull() // Arrange var formattingService = new DummyRazorFormattingService(); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); - var clientConnection = StrictMock.Of(); - var documentVersionCache = StrictMock.Of(); - var endpoint = new DocumentRangeFormattingEndpoint(formattingService, clientConnection, documentVersionCache, optionsMonitor); + var htmlFormatter = new TestHtmlFormatter(); + var endpoint = new DocumentRangeFormattingEndpoint(formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams(); var requestContext = CreateRazorRequestContext(documentContext: null); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs new file mode 100644 index 00000000000..0774619dfa5 --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestHtmlFormatter.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +internal class TestHtmlFormatter : IHtmlFormatter +{ + public Task GetDocumentFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, FormattingOptions options, CancellationToken cancellationToken) + { + return SpecializedTasks.EmptyArray(); + } + + public Task GetOnTypeFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, Position position, string triggerCharacter, FormattingOptions options, CancellationToken cancellationToken) + { + return SpecializedTasks.EmptyArray(); + } +} From 38868db9c26ef5ec9403294429c23e0d3fd82379 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 21:45:52 +1000 Subject: [PATCH 131/271] Minor cleanup --- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 9 +++++---- .../Formatting/IHtmlFormatter.cs | 3 ++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index d75cd09242c..4279c550532 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Frozen; using System.Collections.Generic; using System.Diagnostics; using System.Linq; @@ -34,9 +35,9 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - private static readonly IReadOnlyList s_csharpTriggerCharacters = new[] { "}", ";" }; - private static readonly IReadOnlyList s_htmlTriggerCharacters = new[] { "\n", "{", "}", ";" }; - private static readonly IReadOnlyList s_allTriggerCharacters = s_csharpTriggerCharacters.Concat(s_htmlTriggerCharacters).ToArray(); + private static readonly FrozenSet s_csharpTriggerCharacters = FrozenSet.ToFrozenSet(["}", ";"]); + private static readonly FrozenSet s_htmlTriggerCharacters = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"]); + private static readonly FrozenSet s_allTriggerCharacters = FrozenSet.ToFrozenSet(s_csharpTriggerCharacters.Concat(s_htmlTriggerCharacters)); public bool MutatesSolutionState => false; @@ -44,7 +45,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V { serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { - FirstTriggerCharacter = s_allTriggerCharacters[0], + FirstTriggerCharacter = s_allTriggerCharacters.First(), MoreTriggerCharacter = s_allTriggerCharacters.Skip(1).ToArray(), }; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs index fd388022be9..cf3f9bf2633 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/IHtmlFormatter.cs @@ -8,8 +8,9 @@ using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + internal interface IHtmlFormatter { Task GetDocumentFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, FormattingOptions options, CancellationToken cancellationToken); Task GetOnTypeFormattingEditsAsync(IDocumentSnapshot documentSnapshot, Uri uri, Position position, string triggerCharacter, FormattingOptions options, CancellationToken cancellationToken); -} \ No newline at end of file +} From ca142becdc3258b786b935d65146229ff55f5cca Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 21 Aug 2024 21:57:49 +1000 Subject: [PATCH 132/271] Move HtmlFormattingPass down --- .../Formatting/HtmlFormattingPass.cs | 3 +-- .../Formatting/RazorFormattingService.cs | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) rename src/Razor/src/{Microsoft.AspNetCore.Razor.LanguageServer => Microsoft.CodeAnalysis.Razor.Workspaces}/Formatting/HtmlFormattingPass.cs (98%) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs similarity index 98% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs index de1f7f83417..0bedcf7b3fd 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs @@ -8,13 +8,12 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class HtmlFormattingPass( IDocumentMappingService documentMappingService, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 4f806d916e2..e3c61860f1d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -32,7 +32,7 @@ public async Task GetDocumentFormattingEditsAsync( FormattingOptions options, CancellationToken cancellationToken) { - Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html"); + Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html"); var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); @@ -130,7 +130,7 @@ private async Task ApplyFormattedEditsAsync( bool automaticallyAddUsings, CancellationToken cancellationToken) { - Debug.Assert(_formattingPasses[0].GetType().Name == "HtmlFormattingPass", "Formatting requires the first pass to be Html"); + Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html"); // If we only received a single edit, let's always return a single edit back. // Otherwise, merge only if explicitly asked. From a9eaef6edd10c5bfa62ef0dbff800c89598455aa Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 21 Aug 2024 12:46:59 +0000 Subject: [PATCH 133/271] Update dependencies from https://github.com/dotnet/arcade build 20240820.6 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24416.2 -> To Version 9.0.0-beta.24420.6 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6bed5d53c03..b9a905e10a0 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 8fe02bab989df1265eee225df2c28af6dbdccc83 + b435d26f349d3960d12281321972ed323c35319d - + https://github.com/dotnet/arcade - 8fe02bab989df1265eee225df2c28af6dbdccc83 + b435d26f349d3960d12281321972ed323c35319d diff --git a/eng/Versions.props b/eng/Versions.props index d9e34073baf..d36801d88d5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24416.2 + 9.0.0-beta.24420.6 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index ad54b2f3d29..b21306cba4f 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24416.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24420.6", "Microsoft.Build.NoTargets": "3.7.0" } } From 3458abac8b4447cc08670e6ef20692fd59fff902 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 21 Aug 2024 18:16:42 +0000 Subject: [PATCH 134/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240819.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24415.3 -> To Version 10.0.0-alpha.1.24419.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 4d8fce7e46b..628cd67a05b 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - e9c7c7740133e6e4f92d22d0410a379a8f2d24e7 + c818c3cf018e7aa9fd31f6aed5d14e9b59f03e4f diff --git a/eng/Versions.props b/eng/Versions.props index 02cd78c401b..98442709c0b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 10.0.0-alpha.1.24415.3 + 10.0.0-alpha.1.24419.1 8.0.0-beta.24321.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From ceb06132c11e4bbf3fcb2825c2107394d0cfd925 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Wed, 21 Aug 2024 18:17:13 +0000 Subject: [PATCH 135/271] Update dependencies from https://github.com/dotnet/arcade build 20240821.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24420.6 -> To Version 9.0.0-beta.24421.2 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/SetupNugetSources.ps1 | 2 +- eng/common/SetupNugetSources.sh | 2 +- global.json | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b9a905e10a0..164590a0e40 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + 9b24668b7196b9639e60770465683cf81465d89a - + https://github.com/dotnet/arcade - b435d26f349d3960d12281321972ed323c35319d + 9b24668b7196b9639e60770465683cf81465d89a diff --git a/eng/Versions.props b/eng/Versions.props index d36801d88d5..bd3e90635a5 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24420.6 + 9.0.0-beta.24421.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/SetupNugetSources.ps1 b/eng/common/SetupNugetSources.ps1 index 2b0a5c9e665..5db4ad71ee2 100644 --- a/eng/common/SetupNugetSources.ps1 +++ b/eng/common/SetupNugetSources.ps1 @@ -157,7 +157,7 @@ if ($dotnet31Source -ne $null) { AddPackageSource -Sources $sources -SourceName "dotnet3.1-internal-transport" -SourceEndPoint "https://pkgs.dev.azure.com/dnceng/_packaging/dotnet3.1-internal-transport/nuget/v2" -Creds $creds -Username $userName -pwd $Password } -$dotnetVersions = @('5','6','7','8') +$dotnetVersions = @('5','6','7','8','9') foreach ($dotnetVersion in $dotnetVersions) { $feedPrefix = "dotnet" + $dotnetVersion; diff --git a/eng/common/SetupNugetSources.sh b/eng/common/SetupNugetSources.sh index b493479a1da..4604b61b032 100644 --- a/eng/common/SetupNugetSources.sh +++ b/eng/common/SetupNugetSources.sh @@ -99,7 +99,7 @@ if [ "$?" == "0" ]; then PackageSources+=('dotnet3.1-internal-transport') fi -DotNetVersions=('5' '6' '7' '8') +DotNetVersions=('5' '6' '7' '8' '9') for DotNetVersion in ${DotNetVersions[@]} ; do FeedPrefix="dotnet${DotNetVersion}"; diff --git a/global.json b/global.json index b21306cba4f..6ecd23f1777 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "9.0.100-preview.5.24307.3", + "dotnet": "9.0.100-preview.7.24407.12", "runtimes": { "dotnet": [ "2.1.30", @@ -16,12 +16,12 @@ } }, "sdk": { - "version": "9.0.100-preview.5.24307.3", + "version": "9.0.100-preview.7.24407.12", "allowPrerelease": false, "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24420.6", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.2", "Microsoft.Build.NoTargets": "3.7.0" } } From 114390078e1f34b7aef598766b95f8f98bbe2ec9 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 09:13:11 +1000 Subject: [PATCH 136/271] Formalize Razor formatting options so we can have a single RazorFormattingPass --- .../RazorCSharpFormattingBenchmark.cs | 8 +-- .../AutoInsert/OnAutoInsertEndpoint.cs | 10 ++- .../CSharp/DefaultCSharpCodeActionResolver.cs | 17 +---- .../Razor/GenerateMethodCodeActionResolver.cs | 3 +- .../DelegatedCompletionItemResolver.cs | 9 ++- .../IServiceCollectionExtensions.cs | 2 +- .../Formatting/DocumentFormattingEndpoint.cs | 4 +- .../DocumentOnTypeFormattingEndpoint.cs | 6 +- .../DocumentRangeFormattingEndpoint.cs | 4 +- .../Formatting/LspRazorFormattingPass.cs | 15 ----- .../InlineCompletionEndPoint.cs | 8 ++- .../Formatting/FormattingContext.cs | 62 ++++--------------- .../Formatting/FormattingOptionsExtensions.cs | 16 ----- .../Formatting/IRazorFormattingService.cs | 12 ++-- .../Formatting/RazorFormattingOptions.cs | 37 +++++++++++ ...tingPassBase.cs => RazorFormattingPass.cs} | 6 +- .../Formatting/RazorFormattingService.cs | 14 ++--- .../Formatting/RemoteRazorFormattingPass.cs | 15 ----- ...Microsoft.CodeAnalysis.Remote.Razor.csproj | 4 ++ .../RazorOnAutoInsertProviderTestBase.cs | 2 +- .../DefaultCSharpCodeActionResolverTest.cs | 2 +- ...legatedCompletionItemResolverTest.NetFx.cs | 18 ++++-- .../DocumentRangeFormattingEndpointTest.cs | 3 +- .../FormattingContentValidationPassTest.cs | 2 +- .../FormattingDiagnosticValidationPassTest.cs | 2 +- .../FormattingLanguageServerTestBase.cs | 12 ++-- .../Formatting_NetFx/FormattingTestBase.cs | 13 ++-- .../TestRazorFormattingService.cs | 2 +- 28 files changed, 137 insertions(+), 171 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspRazorFormattingPass.cs delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingOptionsExtensions.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{RazorFormattingPassBase.cs => RazorFormattingPass.cs} (99%) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 2c74f91bc7d..571eeb689ca 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -110,15 +110,9 @@ void Method() { } [Benchmark(Description = "Formatting")] public async Task RazorCSharpFormattingAsync() { - var options = new FormattingOptions() - { - TabSize = 4, - InsertSpaces = true - }; - var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); - var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, [], range: null, options, CancellationToken.None); + var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, [], range: null, RazorFormattingOptions.Default, CancellationToken.None); #if DEBUG // For debugging purposes only. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index 4ec4479463a..8cdbb296fc8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -104,7 +104,9 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V var uri = request.TextDocument.Uri; var position = request.Position; - using var formattingContext = FormattingContext.Create(uri, documentContext.Snapshot, codeDocument, request.Options, _workspaceFactory); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + + using var formattingContext = FormattingContext.Create(uri, documentContext.Snapshot, codeDocument, options, _workspaceFactory); foreach (var provider in applicableProviders) { if (provider.TryResolveInsertion(position, formattingContext, out var textEdit, out var format)) @@ -206,9 +208,11 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V // For C# we run the edit through our formatting engine Debug.Assert(positionInfo.LanguageKind == RazorLanguageKind.CSharp); + var options = RazorFormattingOptions.From(originalRequest.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + var mappedEdit = delegatedResponse.TextEditFormat == InsertTextFormat.Snippet - ? await _razorFormattingService.GetCSharpSnippetFormattingEditAsync(documentContext, [delegatedResponse.TextEdit], originalRequest.Options, cancellationToken).ConfigureAwait(false) - : await _razorFormattingService.GetSingleCSharpEditAsync(documentContext, delegatedResponse.TextEdit, originalRequest.Options, cancellationToken).ConfigureAwait(false); + ? await _razorFormattingService.GetCSharpSnippetFormattingEditAsync(documentContext, [delegatedResponse.TextEdit], options, cancellationToken).ConfigureAwait(false) + : await _razorFormattingService.GetSingleCSharpEditAsync(documentContext, delegatedResponse.TextEdit, options, cancellationToken).ConfigureAwait(false); if (mappedEdit is null) { return null; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 5dca63c9137..4a1a8eb6c99 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -22,21 +22,6 @@ internal sealed class DefaultCSharpCodeActionResolver( IClientConnection clientConnection, IRazorFormattingService razorFormattingService) : CSharpCodeActionResolver(clientConnection) { - // Usually when we need to format code, we utilize the formatting options provided - // by the platform. However, we aren't provided such options in the case of code actions - // so we use a default (and commonly used) configuration. - private static readonly FormattingOptions s_defaultFormattingOptions = new FormattingOptions() - { - TabSize = 4, - InsertSpaces = true, - OtherOptions = new Dictionary - { - { "trimTrailingWhitespace", true }, - { "insertFinalNewline", true }, - { "trimFinalNewlines", true }, - }, - }; - private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; @@ -83,7 +68,7 @@ public async override Task ResolveAsync( var formattedEdit = await _razorFormattingService.GetCSharpCodeActionEditAsync( documentContext, csharpTextEdits, - s_defaultFormattingOptions, + RazorFormattingOptions.Default, cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs index 15a36e487aa..ae238376ce3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/Razor/GenerateMethodCodeActionResolver.cs @@ -204,10 +204,11 @@ private async Task GenerateMethodInCodeBlockAsync( if (result is not null) { - var formattingOptions = new FormattingOptions() + var formattingOptions = new RazorFormattingOptions() { TabSize = _razorLSPOptionsMonitor.CurrentValue.TabSize, InsertSpaces = _razorLSPOptionsMonitor.CurrentValue.InsertSpaces, + CodeBlockBraceOnNextLine = _razorLSPOptionsMonitor.CurrentValue.CodeBlockBraceOnNextLine }; var formattedEdit = await _razorFormattingService.GetCSharpCodeActionEditAsync( diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index 4b4644be46e..df02fe2cfe3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -12,16 +12,19 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; +using static Nerdbank.Streams.MultiplexingStream; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; internal class DelegatedCompletionItemResolver( IDocumentContextFactory documentContextFactory, IRazorFormattingService formattingService, + RazorLSPOptionsMonitor optionsMonitor, IClientConnection clientConnection) : CompletionItemResolver { private readonly IDocumentContextFactory _documentContextFactory = documentContextFactory; private readonly IRazorFormattingService _formattingService = formattingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly IClientConnection _clientConnection = clientConnection; public override async Task ResolveAsync( @@ -111,6 +114,8 @@ private async Task PostProcessCompletionItemAsync( return resolvedCompletionItem; } + var options = RazorFormattingOptions.From(formattingOptions, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + if (resolvedCompletionItem.TextEdit is not null) { if (resolvedCompletionItem.TextEdit.Value.TryGetFirst(out var textEdit)) @@ -118,7 +123,7 @@ private async Task PostProcessCompletionItemAsync( var formattedTextEdit = await _formattingService.GetCSharpSnippetFormattingEditAsync( documentContext, [textEdit], - formattingOptions, + options, cancellationToken).ConfigureAwait(false); resolvedCompletionItem.TextEdit = formattedTextEdit; @@ -136,7 +141,7 @@ private async Task PostProcessCompletionItemAsync( var formattedTextEdit = await _formattingService.GetCSharpSnippetFormattingEditAsync( documentContext, resolvedCompletionItem.AdditionalTextEdits, - formattingOptions, + options, cancellationToken).ConfigureAwait(false); resolvedCompletionItem.AdditionalTextEdits = formattedTextEdit is null ? null : [formattedTextEdit]; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index b1888555f1c..90d8e8e368c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -68,7 +68,7 @@ public static void AddFormattingServices(this IServiceCollection services) services.AddSingleton(); services.AddSingleton(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs index 003ab22f198..fd61a194553 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentFormattingEndpoint.cs @@ -52,8 +52,10 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentFormattingParams return null; } + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + var htmlEdits = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); - var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range: null, request.Options, cancellationToken).ConfigureAwait(false); + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range: null, options, cancellationToken).ConfigureAwait(false); return edits; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 4279c550532..bd8903326a5 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -117,15 +117,17 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting Debug.Assert(request.Character.Length > 0); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + TextEdit[] formattedEdits; if (triggerCharacterKind == RazorLanguageKind.CSharp) { - formattedEdits = await _razorFormattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + formattedEdits = await _razorFormattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); } else if (triggerCharacterKind == RazorLanguageKind.Html) { var htmlEdits = await _htmlFormatter.GetOnTypeFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Position, request.Character, request.Options, cancellationToken).ConfigureAwait(false); - formattedEdits = await _razorFormattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, request.Options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); + formattedEdits = await _razorFormattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, options, hostDocumentIndex, request.Character[0], cancellationToken).ConfigureAwait(false); } else { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs index bd27ec5b8fc..0cd138bf0c7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentRangeFormattingEndpoint.cs @@ -52,8 +52,10 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentRangeFormattingP return null; } + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + var htmlEdits = await _htmlFormatter.GetDocumentFormattingEditsAsync(documentContext.Snapshot, documentContext.Uri, request.Options, cancellationToken).ConfigureAwait(false); - var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, request.Range, request.Options, cancellationToken).ConfigureAwait(false); + var edits = await _razorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, request.Range, options, cancellationToken).ConfigureAwait(false); return edits; } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspRazorFormattingPass.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspRazorFormattingPass.cs deleted file mode 100644 index 49731bf21a1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspRazorFormattingPass.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal sealed class LspRazorFormattingPass( - IDocumentMappingService documentMappingService, - RazorLSPOptionsMonitor optionsMonitor) - : RazorFormattingPassBase(documentMappingService) -{ - protected override bool CodeBlockBraceOnNextLine => optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine; -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 0993fac51f9..779cc1eb048 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -29,6 +29,7 @@ internal sealed class InlineCompletionEndpoint( IDocumentMappingService documentMappingService, IClientConnection clientConnection, IAdhocWorkspaceFactory adhocWorkspaceFactory, + RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { @@ -40,6 +41,7 @@ internal sealed class InlineCompletionEndpoint( private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); private readonly IAdhocWorkspaceFactory _adhocWorkspaceFactory = adhocWorkspaceFactory ?? throw new ArgumentNullException(nameof(adhocWorkspaceFactory)); + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; @@ -123,7 +125,9 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti continue; } - using var formattingContext = FormattingContext.Create(request.TextDocument.Uri, documentContext.Snapshot, codeDocument, request.Options, _adhocWorkspaceFactory); + var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); + + using var formattingContext = FormattingContext.Create(request.TextDocument.Uri, documentContext.Snapshot, codeDocument, options, _adhocWorkspaceFactory); if (!TryGetSnippetWithAdjustedIndentation(formattingContext, item.Text, hostDocumentIndex, out var newSnippetText)) { continue; @@ -148,7 +152,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti _logger.LogInformation($"Returning {items.Count} items."); return new VSInternalInlineCompletionList { - Items = items.ToArray() + Items = [.. items] }; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index e5329eccbc7..b4e5f825ade 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -28,7 +28,7 @@ internal sealed class FormattingContext : IDisposable private IReadOnlyList? _formattingSpans; private IReadOnlyDictionary? _indentations; - private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, + private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, RazorFormattingOptions options, bool isFormatOnType, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) { _workspaceFactory = workspaceFactory; @@ -47,7 +47,7 @@ private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDoc public Uri Uri { get; } public IDocumentSnapshot OriginalSnapshot { get; } public RazorCodeDocument CodeDocument { get; } - public FormattingOptions Options { get; } + public RazorFormattingOptions Options { get; } public bool IsFormatOnType { get; } public bool AutomaticallyAddUsings { get; } public int HostDocumentIndex { get; } @@ -86,7 +86,7 @@ public IReadOnlyDictionary GetIndentations() { if (_indentations is null) { - var sourceText = this.SourceText; + var sourceText = SourceText; var indentations = new Dictionary(); var previousIndentationLevel = 0; @@ -100,7 +100,7 @@ public IReadOnlyDictionary GetIndentations() // The existingIndentation above is measured in characters, and is used to create text edits // The below is measured in columns, so takes into account tab size. This is useful for creating // new indentation strings - var existingIndentationSize = line.GetIndentationSize(this.Options.TabSize); + var existingIndentationSize = line.GetIndentationSize(Options.TabSize); var emptyOrWhitespaceLine = false; if (nonWsPos is null) @@ -179,11 +179,6 @@ private IReadOnlyList GetFormattingSpans() private static IReadOnlyList GetFormattingSpans(RazorSyntaxTree syntaxTree, bool inGlobalNamespace) { - if (syntaxTree is null) - { - throw new ArgumentNullException(nameof(syntaxTree)); - } - var visitor = new FormattingVisitor(inGlobalNamespace: inGlobalNamespace); visitor.Visit(syntaxTree.Root); @@ -227,11 +222,10 @@ public bool TryGetIndentationLevel(int position, out int indentationLevel) public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out FormattingSpan? result) { result = null; - var formattingspans = GetFormattingSpans(); - for (var i = 0; i < formattingspans.Count; i++) + var formattingSpans = GetFormattingSpans(); + foreach (var formattingSpan in formattingSpans) { - var formattingspan = formattingspans[i]; - var span = formattingspan.Span; + var span = formattingSpan.Span; if (span.Start <= absoluteIndex && span.End >= absoluteIndex) { @@ -242,7 +236,7 @@ public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out Form continue; } - result = formattingspan; + result = formattingSpan; return true; } } @@ -261,11 +255,6 @@ public void Dispose() public async Task WithTextAsync(SourceText changedText) { - if (changedText is null) - { - throw new ArgumentNullException(nameof(changedText)); - } - var changedSnapshot = OriginalSnapshot.WithText(changedText); var codeDocument = await changedSnapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); @@ -308,7 +297,7 @@ public static FormattingContext CreateForOnTypeFormatting( Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, - FormattingOptions options, + RazorFormattingOptions options, IAdhocWorkspaceFactory workspaceFactory, bool automaticallyAddUsings, int hostDocumentIndex, @@ -321,7 +310,7 @@ public static FormattingContext Create( Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, - FormattingOptions options, + RazorFormattingOptions options, IAdhocWorkspaceFactory workspaceFactory) { return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: false, automaticallyAddUsings: false, hostDocumentIndex: 0, triggerCharacter: '\0'); @@ -331,42 +320,17 @@ private static FormattingContext CreateCore( Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, - FormattingOptions options, + RazorFormattingOptions options, IAdhocWorkspaceFactory workspaceFactory, bool isFormatOnType, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) { - if (uri is null) - { - throw new ArgumentNullException(nameof(uri)); - } - - if (originalSnapshot is null) - { - throw new ArgumentNullException(nameof(originalSnapshot)); - } - - if (codeDocument is null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (options is null) - { - throw new ArgumentNullException(nameof(options)); - } - - if (workspaceFactory is null) - { - throw new ArgumentNullException(nameof(workspaceFactory)); - } - // hostDocumentIndex, triggerCharacter and automaticallyAddUsings are only supported in on type formatting Debug.Assert(isFormatOnType || (hostDocumentIndex == 0 && triggerCharacter == '\0' && automaticallyAddUsings == false)); - var result = new FormattingContext( + return new FormattingContext( workspaceFactory, uri, originalSnapshot, @@ -377,7 +341,5 @@ private static FormattingContext CreateCore( hostDocumentIndex, triggerCharacter ); - - return result; } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingOptionsExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingOptionsExtensions.cs deleted file mode 100644 index 63fcae2af9d..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingOptionsExtensions.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.ExternalAccess.Razor; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.CodeAnalysis.Razor.Formatting; - -internal static class FormattingOptionsExtensions -{ - public static RazorIndentationOptions GetIndentationOptions(this FormattingOptions options) - => new( - UseTabs: !options.InsertSpaces, - TabSize: options.TabSize, - IndentationSize: options.TabSize); -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index 54bfba4f885..f2893792c98 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -14,20 +14,20 @@ Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, TextEdit[] htmlEdits, Range? range, - FormattingOptions options, + RazorFormattingOptions options, CancellationToken cancellationToken); Task GetHtmlOnTypeFormattingEditsAsync( DocumentContext documentContext, TextEdit[] htmlEdits, - FormattingOptions options, + RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken); Task GetCSharpOnTypeFormattingEditsAsync( DocumentContext documentContext, - FormattingOptions options, + RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken); @@ -35,18 +35,18 @@ Task GetCSharpOnTypeFormattingEditsAsync( Task GetSingleCSharpEditAsync( DocumentContext documentContext, TextEdit initialEdit, - FormattingOptions options, + RazorFormattingOptions options, CancellationToken cancellationToken); Task GetCSharpCodeActionEditAsync( DocumentContext documentContext, TextEdit[] formattedEdits, - FormattingOptions options, + RazorFormattingOptions options, CancellationToken cancellationToken); Task GetCSharpSnippetFormattingEditAsync( DocumentContext documentContext, TextEdit[] edits, - FormattingOptions options, + RazorFormattingOptions options, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs new file mode 100644 index 00000000000..f830202a3b4 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal sealed record RazorFormattingOptions +{ + public bool InsertSpaces { get; init; } + public int TabSize { get; init; } + public bool CodeBlockBraceOnNextLine { get; init; } + + public static RazorFormattingOptions Default => new RazorFormattingOptions() + { + InsertSpaces = true, + TabSize = 4, + CodeBlockBraceOnNextLine = false + }; + + public static RazorFormattingOptions From(FormattingOptions options, bool codeBlockBraceOnNextLine) + { + return new RazorFormattingOptions() + { + InsertSpaces = options.InsertSpaces, + TabSize = options.TabSize, + CodeBlockBraceOnNextLine = codeBlockBraceOnNextLine + }; + } + + public RazorIndentationOptions GetIndentationOptions() + => new( + UseTabs: !InsertSpaces, + TabSize: TabSize, + IndentationSize: TabSize); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs similarity index 99% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPassBase.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs index 883538508d2..f19aa153940 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs @@ -22,7 +22,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; using SyntaxNode = AspNetCore.Razor.Language.Syntax.SyntaxNode; -internal abstract class RazorFormattingPassBase( +internal sealed class RazorFormattingPass( IDocumentMappingService documentMappingService) : FormattingPassBase(documentMappingService) { @@ -66,8 +66,6 @@ public async override Task ExecuteAsync(FormattingContext cont return new FormattingResult(finalEdits); } - protected abstract bool CodeBlockBraceOnNextLine { get; } - private IEnumerable FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) { var edits = new List(); @@ -271,7 +269,7 @@ private void TryFormatCSharpBlockStructure(FormattingContext context, List GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, TextEdit[] htmlEdits, Range? range, - FormattingOptions options, + RazorFormattingOptions options, CancellationToken cancellationToken) { Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html"); @@ -79,25 +79,25 @@ public async Task GetDocumentFormattingEditsAsync( return originalText.NormalizeTextEdits(filteredEdits); } - public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [], options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.Html, htmlEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); - public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit edit, FormattingOptions options, CancellationToken cancellationToken) + public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit edit, RazorFormattingOptions options, CancellationToken cancellationToken) { var formattedEdits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [edit], options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); return formattedEdits.SingleOrDefault(); } - public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] initialEdits, FormattingOptions options, CancellationToken cancellationToken) + public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] initialEdits, RazorFormattingOptions options, CancellationToken cancellationToken) { var edits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, initialEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: true, automaticallyAddUsings: true, cancellationToken: cancellationToken).ConfigureAwait(false); return edits.SingleOrDefault(); } - public async Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) + public async Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, RazorFormattingOptions options, CancellationToken cancellationToken) { WrapCSharpSnippets(edits); @@ -122,7 +122,7 @@ private async Task ApplyFormattedEditsAsync( DocumentContext documentContext, RazorLanguageKind kind, TextEdit[] formattedEdits, - FormattingOptions options, + RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, bool bypassValidationPasses, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs deleted file mode 100644 index 500d610a99e..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; - -internal sealed class RemoteRazorFormattingPass( - IDocumentMappingService documentMappingService) - : RazorFormattingPassBase(documentMappingService) -{ - // TODO: properly plumb this through - protected override bool CodeBlockBraceOnNextLine => true; -} 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 index 3357fd1eb79..60cd914522e 100644 --- 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 @@ -57,4 +57,8 @@ + + + + diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs index 2d77fa619a3..b9fac28aead 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs @@ -39,7 +39,7 @@ protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, var path = "file:///path/to/document.razor"; var uri = new Uri(path); var codeDocument = CreateCodeDocument(source, uri.AbsolutePath, tagHelpers, fileKind: fileKind); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs index 4bd0ec70dfe..72219c5e5d4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionResolverTest.cs @@ -191,7 +191,7 @@ private static IRazorFormattingService CreateRazorFormattingService(Uri document rfs => rfs.GetCSharpCodeActionEditAsync( It.Is(c => c.Uri == documentUri), It.IsAny(), - It.IsAny(), + It.IsAny(), It.IsAny()) == Task.FromResult(s_defaultFormattedEdit), MockBehavior.Strict); return razorFormattingService; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs index c84c82b3b9a..463d5246c93 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Completion/Delegation/DelegatedCompletionItemResolverTest.NetFx.cs @@ -80,7 +80,8 @@ public async Task ResolveAsync_CanNotFindCompletionItem_Noops() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var notContainingCompletionList = new VSInternalCompletionList(); var originalRequestContext = new object(); @@ -98,7 +99,8 @@ public async Task ResolveAsync_UnknownRequestContext_Noops() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, } }; var originalRequestContext = new object(); @@ -116,7 +118,8 @@ public async Task ResolveAsync_UsesItemsData() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var expectedData = new object(); var item = new VSInternalCompletionItem() { @@ -138,7 +141,8 @@ public async Task ResolveAsync_InheritsOriginalCompletionListData() { // Arrange var server = TestDelegatedCompletionItemResolverServer.Create(); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, }, Data = new object() }; var expectedData = new object(); @@ -201,7 +205,8 @@ public async Task ResolveAsync_Html_Resolves() // Arrange var expectedResolvedItem = new VSInternalCompletionItem(); var server = TestDelegatedCompletionItemResolverServer.Create(expectedResolvedItem); - var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(_documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var item = new VSInternalCompletionItem(); var containingCompletionList = new VSInternalCompletionList() { Items = new[] { item, } }; var originalRequestContext = new DelegatedCompletionResolutionContext(_htmlCompletionParams, new object()); @@ -224,7 +229,8 @@ private async Task ResolveCompletionItemAsync(string c var server = TestDelegatedCompletionItemResolverServer.Create(csharpServer, DisposalToken); var documentContextFactory = new TestDocumentContextFactory("C:/path/to/file.razor", codeDocument, version: 123); - var resolver = new DelegatedCompletionItemResolver(documentContextFactory, _formattingService.GetValue(), server); + var optionsMonitor = TestRazorLSPOptionsMonitor.Create(); + var resolver = new DelegatedCompletionItemResolver(documentContextFactory, _formattingService.GetValue(), optionsMonitor, server); var (containingCompletionList, csharpCompletionParams) = await GetCompletionListAndOriginalParamsAsync( cursorPosition, codeDocument, csharpServer); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs index a497f70c2bd..0bb29ed5bba 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentRangeFormattingEndpointTest.cs @@ -28,7 +28,8 @@ public async Task Handle_FormattingEnabled_InvokesFormattingService() formattingService, htmlFormatter, optionsMonitor); var @params = new DocumentRangeFormattingParams() { - TextDocument = new TextDocumentIdentifier { Uri = uri, } + TextDocument = new TextDocumentIdentifier { Uri = uri, }, + Options = new FormattingOptions() }; var requestContext = CreateRazorRequestContext(documentContext); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index ba5973a36ef..76ef36b22fb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -126,7 +126,7 @@ private static FormattingContext CreateFormattingContext(SourceText source, int var path = "file:///path/to/document.razor"; var uri = new Uri(path); var (codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, fileKind: fileKind); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index 60adc04a1fc..9f6602f5bff 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -123,7 +123,7 @@ private static FormattingContext CreateFormattingContext(SourceText source, int var path = "file:///path/to/document.razor"; var uri = new Uri(path); var (codeDocument, documentSnapshot) = CreateCodeDocumentAndSnapshot(source, uri.AbsolutePath, fileKind: fileKind); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index e6771a34d08..843e4e07cd1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -37,33 +37,33 @@ internal class DummyRazorFormattingService : IRazorFormattingService { public bool Called { get; private set; } - public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext documentContext, TextEdit[] htmlEdits, Range? range, FormattingOptions options, CancellationToken cancellationToken) + public Task GetDocumentFormattingEditsAsync(VersionedDocumentContext documentContext, TextEdit[] htmlEdits, Range? range, RazorFormattingOptions options, CancellationToken cancellationToken) { Called = true; return SpecializedTasks.EmptyArray(); } - public Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] formattedEdits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] formattedEdits, RazorFormattingOptions options, CancellationToken cancellationToken) { throw new NotImplementedException(); } - public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) { throw new NotImplementedException(); } - public Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, FormattingOptions options, CancellationToken cancellationToken) + public Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, RazorFormattingOptions options, CancellationToken cancellationToken) { throw new NotImplementedException(); } - public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, FormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) + public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) { return Task.FromResult(htmlEdits); } - public Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit initialEdit, FormattingOptions options, CancellationToken cancellationToken) + public Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit initialEdit, RazorFormattingOptions options, CancellationToken cancellationToken) { throw new NotImplementedException(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 559eba75bfc..4dfaa96659e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -18,6 +18,7 @@ using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; @@ -77,6 +78,7 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab TabSize = tabSize, InsertSpaces = insertSpaces, }; + var razorOptions = RazorFormattingOptions.From(options, codeBlockBraceOnNextLine: razorLSPOptions?.CodeBlockBraceOnNextLine ?? false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); @@ -92,7 +94,7 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); // Act - var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range, options, DisposalToken); + var edits = await formattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits, range, razorOptions, DisposalToken); // Assert var edited = ApplyEdits(source, edits); @@ -138,13 +140,15 @@ private protected async Task RunOnTypeFormattingTestAsync( TabSize = tabSize, InsertSpaces = insertSpaces, }; + var razorOptions = RazorFormattingOptions.From(options, codeBlockBraceOnNextLine: razorLSPOptions?.CodeBlockBraceOnNextLine ?? false); + var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act TextEdit[] edits; if (languageKind == RazorLanguageKind.CSharp) { - edits = await formattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + edits = await formattingService.GetCSharpOnTypeFormattingEditsAsync(documentContext, razorOptions, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); } else { @@ -157,7 +161,7 @@ private protected async Task RunOnTypeFormattingTestAsync( var htmlFormatter = new HtmlFormatter(client, versionCache); var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); - edits = await formattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, options, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); + edits = await formattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, razorOptions, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); } // Assert @@ -218,11 +222,12 @@ protected async Task RunCodeActionFormattingTestAsync( } var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument); - var options = new FormattingOptions() + var options = new RazorFormattingOptions() { TabSize = tabSize, InsertSpaces = insertSpaces, }; + var documentContext = new VersionedDocumentContext(uri, documentSnapshot, projectContext: null, version: 1); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index c9efe60bea0..971d844206d 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -47,7 +47,7 @@ public static async Task CreateWithFullSupportAsync( new HtmlFormattingPass(mappingService, loggerFactory), new CSharpFormattingPass(mappingService, loggerFactory), new CSharpOnTypeFormattingPass(mappingService, loggerFactory), - new LspRazorFormattingPass(mappingService, optionsMonitor), + new RazorFormattingPass(mappingService), new FormattingDiagnosticValidationPass(mappingService, loggerFactory), new FormattingContentValidationPass(mappingService, loggerFactory), }; From 2165fcb0c4f373691780f9db6622830ca1296427 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 10:48:10 +1000 Subject: [PATCH 137/271] One last minor cleanup --- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index bd8903326a5..20488c36a11 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -29,9 +29,9 @@ internal class DocumentOnTypeFormattingEndpoint( ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IRazorFormattingService _razorFormattingService = razorFormattingService ?? throw new ArgumentNullException(nameof(razorFormattingService)); - private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor ?? throw new ArgumentNullException(nameof(optionsMonitor)); + private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); From d6357548f379aed64731b6001b8f549947e600aa Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 12:30:40 +1000 Subject: [PATCH 138/271] Be explicit about formatting passes Always felt like a huge potential bug farm. eg, if Html ended up not being first we'd have bugs, working out the Order property (which was weirdly backwards?) was a pain, and the entire formatting engine produces horrible results if the ordering changes anyway. --- .../IServiceCollectionExtensions.cs | 8 -- .../Formatting/CSharpFormattingPass.cs | 3 - .../Formatting/CSharpFormattingPassBase.cs | 2 - .../FormattingContentValidationPass.cs | 5 - .../FormattingDiagnosticValidationPass.cs | 5 - .../Formatting/FormattingPassBase.cs | 17 ---- .../Formatting/HtmlFormattingPass.cs | 5 - .../Formatting/IFormattingPass.cs | 4 - .../Formatting/RazorFormattingPass.cs | 5 - .../Formatting/RazorFormattingService.cs | 99 ++++++++++++++----- .../TestRazorFormattingService.cs | 15 +-- 11 files changed, 77 insertions(+), 91 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 90d8e8e368c..cd986718dc2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -62,14 +62,6 @@ public static void AddFormattingServices(this IServiceCollection services) services.AddSingleton(); services.AddSingleton(); - // Formatting Passes - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddSingleton(); - services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs index e061b305aaf..c8da773ee7f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs @@ -24,9 +24,6 @@ internal sealed class CSharpFormattingPass( { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // Run after the HTML and Razor formatter pass. - public override int Order => DefaultOrder - 3; - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { if (context.IsFormatOnType || result.Kind != RazorLanguageKind.Razor) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs index 27b38a0e31a..5077ba59f9b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs @@ -30,8 +30,6 @@ protected CSharpFormattingPassBase(IDocumentMappingService documentMappingServic protected CSharpFormatter CSharpFormatter { get; } - public override bool IsValidationPass => false; - protected async Task> AdjustIndentationAsync(FormattingContext context, CancellationToken cancellationToken, Range? range = null) { // In this method, the goal is to make final adjustments to the indentation of each line. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs index 7973e9d0df3..c4fdd30fa7f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs @@ -20,11 +20,6 @@ internal sealed class FormattingContentValidationPass( { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // We want this to run at the very end. - public override int Order => DefaultOrder + 1000; - - public override bool IsValidationPass => true; - // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs index 64bf765dd73..68485f670e1 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs @@ -22,11 +22,6 @@ internal sealed class FormattingDiagnosticValidationPass( { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // We want this to run at the very end. - public override int Order => DefaultOrder + 1000; - - public override bool IsValidationPass => true; - // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs index 535649ec766..b97e536428b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -13,28 +12,12 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal abstract class FormattingPassBase(IDocumentMappingService documentMappingService) : IFormattingPass { - protected static readonly int DefaultOrder = 1000; - - public abstract bool IsValidationPass { get; } - - public virtual int Order => DefaultOrder; - protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); protected TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits, RazorLanguageKind projectedKind) { - if (codeDocument is null) - { - throw new ArgumentNullException(nameof(codeDocument)); - } - - if (projectedTextEdits is null) - { - throw new ArgumentNullException(nameof(projectedTextEdits)); - } - if (projectedKind != RazorLanguageKind.CSharp) { // Non C# projections map directly to Razor. No need to remap. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs index 0bedcf7b3fd..bad83d33079 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs @@ -22,11 +22,6 @@ internal sealed class HtmlFormattingPass( { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - // We want this to run first because it uses the client HTML formatter. - public override int Order => DefaultOrder - 5; - - public override bool IsValidationPass => false; - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { var originalText = context.SourceText; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs index cebfed8ad87..074ccc19e7b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs @@ -8,9 +8,5 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal interface IFormattingPass { - int Order { get; } - - bool IsValidationPass { get; } - Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs index f19aa153940..273b072bbe5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs @@ -26,11 +26,6 @@ internal sealed class RazorFormattingPass( IDocumentMappingService documentMappingService) : FormattingPassBase(documentMappingService) { - // Run after the C# formatter pass. - public override int Order => DefaultOrder - 4; - - public override bool IsValidationPass => false; - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { if (context.IsFormatOnType) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index de664da131f..4e66595cea0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -3,12 +3,13 @@ using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; @@ -18,12 +19,32 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal class RazorFormattingService( - IEnumerable formattingPasses, - IAdhocWorkspaceFactory workspaceFactory) : IRazorFormattingService +internal class RazorFormattingService : IRazorFormattingService { - private readonly ImmutableArray _formattingPasses = formattingPasses.OrderByAsArray(f => f.Order); - private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory; + private readonly IAdhocWorkspaceFactory _workspaceFactory; + + private readonly ImmutableArray _documentFormattingPasses; + private readonly ImmutableArray _validationPasses; + private readonly CSharpOnTypeFormattingPass _csharpOnTypeFormattingPass; + private readonly HtmlFormattingPass _htmlFormattingPass; + + public RazorFormattingService( + IDocumentMappingService documentMappingService, + IAdhocWorkspaceFactory workspaceFactory, + ILoggerFactory loggerFactory) + { + _workspaceFactory = workspaceFactory; + + var cSharpFormattingPass = new CSharpFormattingPass(documentMappingService, loggerFactory); + var razorFormattingPass = new RazorFormattingPass(documentMappingService); + var diagnosticValidationPass = new FormattingDiagnosticValidationPass(documentMappingService, loggerFactory); + var contentValidationPass = new FormattingContentValidationPass(documentMappingService, loggerFactory); + + _htmlFormattingPass = new HtmlFormattingPass(documentMappingService, loggerFactory); + _csharpOnTypeFormattingPass = new CSharpOnTypeFormattingPass(documentMappingService, loggerFactory); + _validationPasses = [diagnosticValidationPass, contentValidationPass]; + _documentFormattingPasses = [_htmlFormattingPass, razorFormattingPass, cSharpFormattingPass, .. _validationPasses]; + } public async Task GetDocumentFormattingEditsAsync( VersionedDocumentContext documentContext, @@ -32,8 +53,6 @@ public async Task GetDocumentFormattingEditsAsync( RazorFormattingOptions options, CancellationToken cancellationToken) { - Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html"); - var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); // Range formatting happens on every paste, and if there are Razor diagnostics in the file @@ -66,7 +85,8 @@ public async Task GetDocumentFormattingEditsAsync( var originalText = context.SourceText; var result = new FormattingResult(htmlEdits); - foreach (var pass in _formattingPasses) + + foreach (var pass in _documentFormattingPasses) { cancellationToken.ThrowIfCancellationRequested(); result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); @@ -80,20 +100,60 @@ public async Task GetDocumentFormattingEditsAsync( } public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [], options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); + => ApplyFormattedEditsAsync( + documentContext, + RazorLanguageKind.CSharp, + formattedEdits: [], + options, + hostDocumentIndex, + triggerCharacter, + [_csharpOnTypeFormattingPass, .. _validationPasses], + collapseEdits: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken); public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) - => ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.Html, htmlEdits, options, hostDocumentIndex, triggerCharacter, bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); + => ApplyFormattedEditsAsync( + documentContext, + RazorLanguageKind.Html, + htmlEdits, + options, + hostDocumentIndex, + triggerCharacter, + [_htmlFormattingPass, .. _validationPasses], + collapseEdits: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken); public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit edit, RazorFormattingOptions options, CancellationToken cancellationToken) { - var formattedEdits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, [edit], options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: false, collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); + var formattedEdits = await ApplyFormattedEditsAsync( + documentContext, + RazorLanguageKind.CSharp, + [edit], + options, + hostDocumentIndex: 0, + triggerCharacter: '\0', + [_csharpOnTypeFormattingPass, .. _validationPasses], + collapseEdits: false, + automaticallyAddUsings: false, + cancellationToken: cancellationToken).ConfigureAwait(false); return formattedEdits.SingleOrDefault(); } public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] initialEdits, RazorFormattingOptions options, CancellationToken cancellationToken) { - var edits = await ApplyFormattedEditsAsync(documentContext, RazorLanguageKind.CSharp, initialEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', bypassValidationPasses: true, collapseEdits: true, automaticallyAddUsings: true, cancellationToken: cancellationToken).ConfigureAwait(false); + var edits = await ApplyFormattedEditsAsync( + documentContext, + RazorLanguageKind.CSharp, + initialEdits, + options, + hostDocumentIndex: 0, + triggerCharacter: '\0', + [_csharpOnTypeFormattingPass], + collapseEdits: true, + automaticallyAddUsings: true, + cancellationToken: cancellationToken).ConfigureAwait(false); return edits.SingleOrDefault(); } @@ -108,7 +168,7 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume options, hostDocumentIndex: 0, triggerCharacter: '\0', - bypassValidationPasses: true, + [_csharpOnTypeFormattingPass], collapseEdits: true, automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); @@ -125,13 +185,11 @@ private async Task ApplyFormattedEditsAsync( RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, - bool bypassValidationPasses, + ImmutableArray formattingPasses, bool collapseEdits, bool automaticallyAddUsings, CancellationToken cancellationToken) { - Debug.Assert(_formattingPasses[0] is HtmlFormattingPass, "Formatting requires the first pass to be Html"); - // If we only received a single edit, let's always return a single edit back. // Otherwise, merge only if explicitly asked. collapseEdits |= formattedEdits.Length == 1; @@ -142,13 +200,8 @@ private async Task ApplyFormattedEditsAsync( using var context = FormattingContext.CreateForOnTypeFormatting(uri, documentSnapshot, codeDocument, options, _workspaceFactory, automaticallyAddUsings: automaticallyAddUsings, hostDocumentIndex, triggerCharacter); var result = new FormattingResult(formattedEdits, kind); - foreach (var pass in _formattingPasses) + foreach (var pass in formattingPasses) { - if (pass.IsValidationPass && bypassValidationPasses) - { - continue; - } - cancellationToken.ThrowIfCancellationRequested(); result = await pass.ExecuteAsync(context, result, cancellationToken).ConfigureAwait(false); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 971d844206d..01152568edc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -1,18 +1,15 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.LanguageServer.Test; -using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.AspNetCore.Razor.Test.Common.Workspaces; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Moq; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -42,16 +39,6 @@ public static async Task CreateWithFullSupportAsync( await optionsMonitor.UpdateAsync(CancellationToken.None); } - var passes = new List() - { - new HtmlFormattingPass(mappingService, loggerFactory), - new CSharpFormattingPass(mappingService, loggerFactory), - new CSharpOnTypeFormattingPass(mappingService, loggerFactory), - new RazorFormattingPass(mappingService), - new FormattingDiagnosticValidationPass(mappingService, loggerFactory), - new FormattingContentValidationPass(mappingService, loggerFactory), - }; - - return new RazorFormattingService(passes, TestAdhocWorkspaceFactory.Instance); + return new RazorFormattingService(mappingService, TestAdhocWorkspaceFactory.Instance, loggerFactory); } } From 4e1211718ae3b0d522b66f60707e24012242b188 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 12:31:10 +1000 Subject: [PATCH 139/271] Move files to their own folder --- .../Formatting/{ => Passes}/CSharpFormattingPass.cs | 0 .../Formatting/{ => Passes}/CSharpFormattingPassBase.cs | 0 .../Formatting/{ => Passes}/CSharpOnTypeFormattingPass.cs | 0 .../Formatting/{ => Passes}/FormattingContentValidationPass.cs | 0 .../Formatting/{ => Passes}/FormattingDiagnosticValidationPass.cs | 0 .../Formatting/{ => Passes}/FormattingPassBase.cs | 0 .../Formatting/{ => Passes}/HtmlFormattingPass.cs | 0 .../Formatting/{ => Passes}/RazorFormattingPass.cs | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/CSharpFormattingPass.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/CSharpFormattingPassBase.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/CSharpOnTypeFormattingPass.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/FormattingContentValidationPass.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/FormattingDiagnosticValidationPass.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/FormattingPassBase.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/HtmlFormattingPass.cs (100%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/{ => Passes}/RazorFormattingPass.cs (100%) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPassBase.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpOnTypeFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingPassBase.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/HtmlFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs similarity index 100% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingPass.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs From 6f1c6ef3988cd6ed11ad9d5ee2f2ea09936a0b0d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 14:43:59 +1000 Subject: [PATCH 140/271] Remove unnecessary base class --- .../Passes/CSharpFormattingPassBase.cs | 11 +++--- .../Passes/CSharpOnTypeFormattingPass.cs | 18 ++++++++++ .../Passes/FormattingContentValidationPass.cs | 8 ++--- .../FormattingDiagnosticValidationPass.cs | 8 ++--- .../Formatting/Passes/FormattingPassBase.cs | 36 ------------------- .../Formatting/Passes/HtmlFormattingPass.cs | 8 ++--- .../Formatting/Passes/RazorFormattingPass.cs | 9 ++--- .../Formatting/RazorFormattingService.cs | 8 ++--- .../FormattingContentValidationPassTest.cs | 4 +-- .../FormattingDiagnosticValidationPassTest.cs | 4 +-- 10 files changed, 37 insertions(+), 77 deletions(-) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs index 5077ba59f9b..890a7a6e025 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs @@ -20,15 +20,12 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; -internal abstract class CSharpFormattingPassBase : FormattingPassBase +internal abstract class CSharpFormattingPassBase(IDocumentMappingService documentMappingService) : IFormattingPass { - protected CSharpFormattingPassBase(IDocumentMappingService documentMappingService) - : base(documentMappingService) - { - CSharpFormatter = new CSharpFormatter(documentMappingService); - } + protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; + protected CSharpFormatter CSharpFormatter { get; } = new CSharpFormatter(documentMappingService); - protected CSharpFormatter CSharpFormatter { get; } + public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); protected async Task> AdjustIndentationAsync(FormattingContext context, CancellationToken cancellationToken, Range? range = null) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index 1d965250575..a86b3ae490f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -205,6 +205,24 @@ public async override Task ExecuteAsync(FormattingContext cont return new FormattingResult(finalEdits); } + private TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits, RazorLanguageKind projectedKind) + { + if (projectedKind != RazorLanguageKind.CSharp) + { + // Non C# projections map directly to Razor. No need to remap. + return projectedTextEdits; + } + + if (codeDocument.IsUnsupported()) + { + return []; + } + + var edits = DocumentMappingService.GetHostDocumentEdits(codeDocument.GetCSharpDocument(), projectedTextEdits); + + return edits; + } + private static async Task AddUsingStatementEditsIfNecessaryAsync(FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) { if (context.AutomaticallyAddUsings) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs index c4fdd30fa7f..76bd0e286fa 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs @@ -5,7 +5,6 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; @@ -13,17 +12,14 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class FormattingContentValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) +internal sealed class FormattingContentValidationPass(ILoggerFactory loggerFactory) : IFormattingPass { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; - public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { if (result.Kind != RazorLanguageKind.Razor) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs index 68485f670e1..a7824ea711a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs @@ -8,24 +8,20 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class FormattingDiagnosticValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) +internal sealed class FormattingDiagnosticValidationPass(ILoggerFactory loggerFactory) : IFormattingPass { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { if (result.Kind != RazorLanguageKind.Razor) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs deleted file mode 100644 index b97e536428b..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingPassBase.cs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.CodeAnalysis.Razor.Formatting; - -internal abstract class FormattingPassBase(IDocumentMappingService documentMappingService) : IFormattingPass -{ - protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; - - public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); - - protected TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits, RazorLanguageKind projectedKind) - { - if (projectedKind != RazorLanguageKind.CSharp) - { - // Non C# projections map directly to Razor. No need to remap. - return projectedTextEdits; - } - - if (codeDocument.IsUnsupported()) - { - return []; - } - - var edits = DocumentMappingService.GetHostDocumentEdits(codeDocument.GetCSharpDocument(), projectedTextEdits); - - return edits; - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs index bad83d33079..e8ec8227a93 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs @@ -7,7 +7,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; @@ -15,14 +14,11 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class HtmlFormattingPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingPassBase(documentMappingService) +internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : IFormattingPass { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { var originalText = context.SourceText; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 273b072bbe5..7e16f093975 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -11,7 +11,6 @@ using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -22,11 +21,9 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; using SyntaxNode = AspNetCore.Razor.Language.Syntax.SyntaxNode; -internal sealed class RazorFormattingPass( - IDocumentMappingService documentMappingService) - : FormattingPassBase(documentMappingService) +internal sealed class RazorFormattingPass : IFormattingPass { - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { if (context.IsFormatOnType) { @@ -244,7 +241,7 @@ private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatCSharpBlockStructure(FormattingContext context, List edits, RazorSourceDocument source, SyntaxNode node) { // We're looking for a code block like this: // diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 4e66595cea0..fb56921a883 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -36,11 +36,11 @@ public RazorFormattingService( _workspaceFactory = workspaceFactory; var cSharpFormattingPass = new CSharpFormattingPass(documentMappingService, loggerFactory); - var razorFormattingPass = new RazorFormattingPass(documentMappingService); - var diagnosticValidationPass = new FormattingDiagnosticValidationPass(documentMappingService, loggerFactory); - var contentValidationPass = new FormattingContentValidationPass(documentMappingService, loggerFactory); + var razorFormattingPass = new RazorFormattingPass(); + var diagnosticValidationPass = new FormattingDiagnosticValidationPass(loggerFactory); + var contentValidationPass = new FormattingContentValidationPass(loggerFactory); - _htmlFormattingPass = new HtmlFormattingPass(documentMappingService, loggerFactory); + _htmlFormattingPass = new HtmlFormattingPass(loggerFactory); _csharpOnTypeFormattingPass = new CSharpOnTypeFormattingPass(documentMappingService, loggerFactory); _validationPasses = [diagnosticValidationPass, contentValidationPass]; _documentFormattingPasses = [_htmlFormattingPass, razorFormattingPass, cSharpFormattingPass, .. _validationPasses]; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index 76ef36b22fb..42688f3992f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -111,9 +111,7 @@ public class Foo { } private FormattingContentValidationPass GetPass() { - var mappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); - - var pass = new FormattingContentValidationPass(mappingService, LoggerFactory) + var pass = new FormattingContentValidationPass(LoggerFactory) { DebugAssertsEnabled = false }; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index 9f6602f5bff..28655554161 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -108,9 +108,7 @@ public class Foo { } private FormattingDiagnosticValidationPass GetPass() { - var mappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); - - var pass = new FormattingDiagnosticValidationPass(mappingService, LoggerFactory) + var pass = new FormattingDiagnosticValidationPass(LoggerFactory) { DebugAssertsEnabled = false }; From f74150db382c95a676bd4ca1b21246eede907304 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 15:12:12 +1000 Subject: [PATCH 141/271] Separate html formatting passes, so we can remove the IsFormatOnType flag --- .../Formatting/CSharpFormatter.cs | 21 ---------- .../Formatting/FormattingContext.cs | 42 +++++++------------ .../Formatting/Passes/CSharpFormattingPass.cs | 12 +++--- .../Passes/CSharpFormattingPassBase.cs | 22 +++++----- .../Passes/CSharpOnTypeFormattingPass.cs | 8 +--- .../Formatting/Passes/HtmlFormattingPass.cs | 34 +++++++++------ .../Formatting/Passes/RazorFormattingPass.cs | 42 ++++++++----------- .../Formatting/RazorFormattingService.cs | 25 ++++++----- 8 files changed, 87 insertions(+), 119 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs index fbef2ed9e2a..defa18e3461 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; using System.Collections.Generic; using System.Linq; using System.Threading; @@ -27,16 +26,6 @@ internal sealed class CSharpFormatter(IDocumentMappingService documentMappingSer public async Task FormatAsync(FormattingContext context, Range rangeToFormat, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (rangeToFormat is null) - { - throw new ArgumentNullException(nameof(rangeToFormat)); - } - if (!_documentMappingService.TryMapToGeneratedDocumentRange(context.CodeDocument.GetCSharpDocument(), rangeToFormat, out var projectedRange)) { return []; @@ -52,16 +41,6 @@ public static async Task> GetCSharpIndentationAsyn IReadOnlyCollection projectedDocumentLocations, CancellationToken cancellationToken) { - if (context is null) - { - throw new ArgumentNullException(nameof(context)); - } - - if (projectedDocumentLocations is null) - { - throw new ArgumentNullException(nameof(projectedDocumentLocations)); - } - // Sorting ensures we count the marker offsets correctly. // We also want to ensure there are no duplicates to avoid duplicate markers. var filteredLocations = projectedDocumentLocations.Distinct().OrderBy(l => l).ToList(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index b4e5f825ade..328bfada28f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -29,14 +29,13 @@ internal sealed class FormattingContext : IDisposable private IReadOnlyDictionary? _indentations; private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, RazorFormattingOptions options, - bool isFormatOnType, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) + bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) { _workspaceFactory = workspaceFactory; Uri = uri; OriginalSnapshot = originalSnapshot; CodeDocument = codeDocument; Options = options; - IsFormatOnType = isFormatOnType; AutomaticallyAddUsings = automaticallyAddUsings; HostDocumentIndex = hostDocumentIndex; TriggerCharacter = triggerCharacter; @@ -48,7 +47,6 @@ private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDoc public IDocumentSnapshot OriginalSnapshot { get; } public RazorCodeDocument CodeDocument { get; } public RazorFormattingOptions Options { get; } - public bool IsFormatOnType { get; } public bool AutomaticallyAddUsings { get; } public int HostDocumentIndex { get; } public char TriggerCharacter { get; } @@ -267,7 +265,6 @@ public async Task WithTextAsync(SourceText changedText) OriginalSnapshot, codeDocument, Options, - IsFormatOnType, AutomaticallyAddUsings, HostDocumentIndex, TriggerCharacter); @@ -303,7 +300,16 @@ public static FormattingContext CreateForOnTypeFormatting( int hostDocumentIndex, char triggerCharacter) { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: true, automaticallyAddUsings, hostDocumentIndex, triggerCharacter); + return new FormattingContext( + workspaceFactory, + uri, + originalSnapshot, + codeDocument, + options, + automaticallyAddUsings, + hostDocumentIndex, + triggerCharacter + ); } public static FormattingContext Create( @@ -313,33 +319,15 @@ public static FormattingContext Create( RazorFormattingOptions options, IAdhocWorkspaceFactory workspaceFactory) { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: false, automaticallyAddUsings: false, hostDocumentIndex: 0, triggerCharacter: '\0'); - } - - private static FormattingContext CreateCore( - Uri uri, - IDocumentSnapshot originalSnapshot, - RazorCodeDocument codeDocument, - RazorFormattingOptions options, - IAdhocWorkspaceFactory workspaceFactory, - bool isFormatOnType, - bool automaticallyAddUsings, - int hostDocumentIndex, - char triggerCharacter) - { - // hostDocumentIndex, triggerCharacter and automaticallyAddUsings are only supported in on type formatting - Debug.Assert(isFormatOnType || (hostDocumentIndex == 0 && triggerCharacter == '\0' && automaticallyAddUsings == false)); - return new FormattingContext( workspaceFactory, uri, originalSnapshot, codeDocument, options, - isFormatOnType, - automaticallyAddUsings, - hostDocumentIndex, - triggerCharacter - ); + automaticallyAddUsings: false, + hostDocumentIndex: 0, + triggerCharacter: '\0' + ); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs index c8da773ee7f..03f4f3b79a3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -20,17 +21,14 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class CSharpFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) - : CSharpFormattingPassBase(documentMappingService) + : CSharpFormattingPassBase(documentMappingService, isFormatOnType: false) { + private readonly CSharpFormatter _csharpFormatter = new CSharpFormatter(documentMappingService); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - if (context.IsFormatOnType || result.Kind != RazorLanguageKind.Razor) - { - // We don't want to handle OnTypeFormatting here. - return result; - } + Debug.Assert(result.Kind == RazorLanguageKind.Razor); // Apply previous edits if any. var originalText = context.SourceText; @@ -91,7 +89,7 @@ private async Task> FormatCSharpAsync(FormattingContext // These should already be remapped. var range = sourceText.GetRange(span); - var edits = await CSharpFormatter.FormatAsync(context, range, cancellationToken).ConfigureAwait(false); + var edits = await _csharpFormatter.FormatAsync(context, range, cancellationToken).ConfigureAwait(false); csharpEdits.AddRange(edits.Where(e => range.Contains(e.Range))); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs index 890a7a6e025..6941dbf4933 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs @@ -15,15 +15,15 @@ using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; namespace Microsoft.CodeAnalysis.Razor.Formatting; -using SyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; - -internal abstract class CSharpFormattingPassBase(IDocumentMappingService documentMappingService) : IFormattingPass +internal abstract class CSharpFormattingPassBase(IDocumentMappingService documentMappingService, bool isFormatOnType) : IFormattingPass { + private readonly bool _isFormatOnType = isFormatOnType; + protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; - protected CSharpFormatter CSharpFormatter { get; } = new CSharpFormatter(documentMappingService); public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); @@ -250,7 +250,7 @@ protected async Task> AdjustIndentationAsync(FormattingContext if (indentations[i].StartsInHtmlContext) { // This is a non-C# line. - if (context.IsFormatOnType) + if (_isFormatOnType) { // HTML formatter doesn't run in the case of format on type. // Let's stick with our syntax understanding of HTML to figure out the desired indentation. @@ -291,13 +291,13 @@ protected async Task> AdjustIndentationAsync(FormattingContext protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) => ShouldFormat(context, mappingSpan, allowImplicitStatements, out _); - protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements, out SyntaxNode? foundOwner) + protected static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements, out RazorSyntaxNode? foundOwner) => ShouldFormat(context, mappingSpan, new ShouldFormatOptions(allowImplicitStatements, isLineRequest: false), out foundOwner); private static bool ShouldFormatLine(FormattingContext context, TextSpan mappingSpan, bool allowImplicitStatements) => ShouldFormat(context, mappingSpan, new ShouldFormatOptions(allowImplicitStatements, isLineRequest: true), out _); - private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, ShouldFormatOptions options, out SyntaxNode? foundOwner) + private static bool ShouldFormat(FormattingContext context, TextSpan mappingSpan, ShouldFormatOptions options, out RazorSyntaxNode? foundOwner) { // We should be called with the range of various C# SourceMappings. @@ -437,10 +437,10 @@ bool IsInBoundComponentAttributeName() return owner is MarkupTextLiteralSyntax { - Parent: MarkupTagHelperAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupMinimizedTagHelperAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } or - MarkupMinimizedTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo: { Bound: true } } + Parent: MarkupTagHelperAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupMinimizedTagHelperAttributeSyntax { TagHelperAttributeInfo.Bound: true } or + MarkupMinimizedTagHelperDirectiveAttributeSyntax { TagHelperAttributeInfo.Bound: true } } && !options.IsLineRequest; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index a86b3ae490f..77d319406d0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -26,17 +26,13 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class CSharpOnTypeFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) - : CSharpFormattingPassBase(documentMappingService) + : CSharpFormattingPassBase(documentMappingService, isFormatOnType: true) { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - if (!context.IsFormatOnType || result.Kind != RazorLanguageKind.CSharp) - { - // We don't want to handle regular formatting or non-C# on type formatting here. - return result; - } + Debug.Assert(result.Kind == RazorLanguageKind.CSharp); // Normalize and re-map the C# edits. var codeDocument = context.CodeDocument; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs index e8ec8227a93..c65fc754f1c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -14,20 +15,34 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : IFormattingPass +internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) { - private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); +} - public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) +internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) +{ + public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - var originalText = context.SourceText; + Debug.Assert(result.Kind == RazorLanguageKind.Html); - if (context.IsFormatOnType && result.Kind != RazorLanguageKind.Html) + if (result.Edits.Length == 0) { - // We don't want to handle on type formatting requests for other languages - return result; + // There are no HTML edits for us to apply. No op. + return Task.FromResult(new FormattingResult([])); } + return base.ExecuteAsync(context, result, cancellationToken); + } +} + +internal abstract class HtmlFormattingPassBase(ILogger logger) : IFormattingPass +{ + private readonly ILogger _logger = logger; + + public virtual async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + { + var originalText = context.SourceText; + var htmlEdits = result.Edits; var changedText = originalText; @@ -44,11 +59,6 @@ public async Task ExecuteAsync(FormattingContext context, Form _logger.LogTestOnly($"After normalizedEdits:\r\n{changedText}"); } - else if (context.IsFormatOnType) - { - // There are no HTML edits for us to apply. No op. - return new FormattingResult(htmlEdits); - } var indentationChanges = AdjustRazorIndentation(changedContext); if (indentationChanges.Count > 0) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 7e16f093975..520a720ee75 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -13,24 +13,16 @@ using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; - using RazorRazorSyntaxNodeList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; using RazorSyntaxNodeList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; namespace Microsoft.CodeAnalysis.Razor.Formatting; -using SyntaxNode = AspNetCore.Razor.Language.Syntax.SyntaxNode; - internal sealed class RazorFormattingPass : IFormattingPass { public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - if (context.IsFormatOnType) - { - // We don't want to handle OnTypeFormatting here. - return result; - } - // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; @@ -58,7 +50,7 @@ public async Task ExecuteAsync(FormattingContext context, Form return new FormattingResult(finalEdits); } - private IEnumerable FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) + private static IEnumerable FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) { var edits = new List(); var source = syntaxTree.Source; @@ -75,7 +67,7 @@ private IEnumerable FormatRazor(FormattingContext context, RazorSyntax return edits; } - private static void TryFormatBlocks(FormattingContext context, List edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatBlocks(FormattingContext context, List edits, RazorSourceDocument source, RazorSyntaxNode node) { // We only want to run one of these _ = TryFormatFunctionsBlock(context, edits, source, node) || @@ -85,7 +77,7 @@ private static void TryFormatBlocks(FormattingContext context, List ed TryFormatSectionBlock(context, edits, source, node); } - private static bool TryFormatSectionBlock(FormattingContext context, List edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatSectionBlock(FormattingContext context, List edits, RazorSourceDocument source, RazorSyntaxNode node) { // @section Goo { // } @@ -142,7 +134,7 @@ children[2] is UnclassifiedTextLiteralSyntax after && } } - private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) { // @functions // { @@ -180,7 +172,7 @@ private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatCSharpExplicitTransition(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -201,7 +193,7 @@ private static bool TryFormatCSharpExplicitTransition(FormattingContext context, return false; } - private static bool TryFormatComplexCSharpBlock(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatComplexCSharpBlock(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) { // complex situations like // @{ @@ -223,7 +215,7 @@ csharpRazorBlock.Parent is CSharpCodeBlockSyntax innerCodeBlock && return false; } - private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) { // void Method() // { @@ -241,7 +233,7 @@ private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatCSharpBlockStructure(FormattingContext context, List edits, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -301,7 +293,7 @@ children[0] is UnclassifiedTextLiteralSyntax literal && } } - private static void TryFormatSingleLineDirective(List edits, RazorSourceDocument source, SyntaxNode node) + private static void TryFormatSingleLineDirective(List edits, RazorSourceDocument source, RazorSyntaxNode node) { // Looking for single line directives like // @@ -322,7 +314,7 @@ private static void TryFormatSingleLineDirective(List edits, RazorSour } } - static bool IsSingleLineDirective(SyntaxNode node, out RazorSyntaxNodeList children) + static bool IsSingleLineDirective(RazorSyntaxNode node, out RazorSyntaxNodeList children) { if (node is CSharpCodeBlockSyntax content && node.Parent?.Parent is RazorDirectiveSyntax directive && @@ -337,7 +329,7 @@ static bool IsSingleLineDirective(SyntaxNode node, out RazorSyntaxNodeList child } } - private static void FormatWhitespaceBetweenDirectiveAndBrace(SyntaxNode node, RazorDirectiveSyntax directive, List edits, RazorSourceDocument source, FormattingContext context, bool forceNewLine) + private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, List edits, RazorSourceDocument source, FormattingContext context, bool forceNewLine) { if (node.ContainsOnlyWhitespace(includingNewLines: false) && !forceNewLine) { @@ -356,7 +348,7 @@ private static void FormatWhitespaceBetweenDirectiveAndBrace(SyntaxNode node, Ra } } - private static void ShrinkToSingleSpace(SyntaxNode node, List edits, RazorSourceDocument source) + private static void ShrinkToSingleSpace(RazorSyntaxNode node, List edits, RazorSourceDocument source) { // If there is anything other than one single space then we replace with one space between directive and brace. // @@ -365,7 +357,7 @@ private static void ShrinkToSingleSpace(SyntaxNode node, List edits, R edits.Add(edit); } - private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, SyntaxNode? directiveNode, SyntaxNode openBraceNode, SyntaxNode codeNode, SyntaxNode closeBraceNode, IList edits) + private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, IList edits) { var didFormat = false; @@ -426,7 +418,7 @@ static bool RangeHasBeenModified(IList edits, Range range) return hasBeenModified; } - static int GetAdditionalIndentationLevel(FormattingContext context, Range range, SyntaxNode openBraceNode, SyntaxNode codeNode) + static int GetAdditionalIndentationLevel(FormattingContext context, Range range, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode) { if (!context.TryGetIndentationLevel(codeNode.Position, out var desiredIndentationLevel)) { @@ -441,7 +433,7 @@ static int GetAdditionalIndentationLevel(FormattingContext context, Range range, return desiredIndentationOffset - currentIndentationOffset; - static int GetLeadingWhitespaceLength(SyntaxNode node, FormattingContext context) + static int GetLeadingWhitespaceLength(RazorSyntaxNode node, FormattingContext context) { var tokens = node.GetTokens(); var whitespaceLength = 0; @@ -473,7 +465,7 @@ static int GetLeadingWhitespaceLength(SyntaxNode node, FormattingContext context return whitespaceLength; } - static int GetTrailingWhitespaceLength(SyntaxNode node, FormattingContext context) + static int GetTrailingWhitespaceLength(RazorSyntaxNode node, FormattingContext context) { var tokens = node.GetTokens(); var whitespaceLength = 0; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index fb56921a883..a8f5e2542b6 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -26,7 +26,7 @@ internal class RazorFormattingService : IRazorFormattingService private readonly ImmutableArray _documentFormattingPasses; private readonly ImmutableArray _validationPasses; private readonly CSharpOnTypeFormattingPass _csharpOnTypeFormattingPass; - private readonly HtmlFormattingPass _htmlFormattingPass; + private readonly HtmlOnTypeFormattingPass _htmlOnTypeFormattingPass; public RazorFormattingService( IDocumentMappingService documentMappingService, @@ -35,15 +35,20 @@ public RazorFormattingService( { _workspaceFactory = workspaceFactory; - var cSharpFormattingPass = new CSharpFormattingPass(documentMappingService, loggerFactory); - var razorFormattingPass = new RazorFormattingPass(); - var diagnosticValidationPass = new FormattingDiagnosticValidationPass(loggerFactory); - var contentValidationPass = new FormattingContentValidationPass(loggerFactory); - - _htmlFormattingPass = new HtmlFormattingPass(loggerFactory); + _htmlOnTypeFormattingPass = new HtmlOnTypeFormattingPass(loggerFactory); _csharpOnTypeFormattingPass = new CSharpOnTypeFormattingPass(documentMappingService, loggerFactory); - _validationPasses = [diagnosticValidationPass, contentValidationPass]; - _documentFormattingPasses = [_htmlFormattingPass, razorFormattingPass, cSharpFormattingPass, .. _validationPasses]; + _validationPasses = + [ + new FormattingDiagnosticValidationPass(loggerFactory), + new FormattingContentValidationPass(loggerFactory) + ]; + _documentFormattingPasses = + [ + new HtmlFormattingPass(loggerFactory), + new RazorFormattingPass(), + new CSharpFormattingPass(documentMappingService, loggerFactory), + .. _validationPasses + ]; } public async Task GetDocumentFormattingEditsAsync( @@ -120,7 +125,7 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume options, hostDocumentIndex, triggerCharacter, - [_htmlFormattingPass, .. _validationPasses], + [_htmlOnTypeFormattingPass, .. _validationPasses], collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken); From ef44f4fe61d22c31e3ceea649d51ed76b60187bf Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 15:12:55 +1000 Subject: [PATCH 142/271] Separate out the files in the Html formatter passes. Doing this separately, and purely mechanically, so make review easier --- .../Formatting/Passes/HtmlFormattingPass.cs | 201 ------------------ .../Passes/HtmlFormattingPassBase.cs | 189 ++++++++++++++++ .../Passes/HtmlOnTypeFormattingPass.cs | 26 +++ 3 files changed, 215 insertions(+), 201 deletions(-) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs index c65fc754f1c..0a7800d8164 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs @@ -1,211 +1,10 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) { } - -internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) -{ - public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) - { - Debug.Assert(result.Kind == RazorLanguageKind.Html); - - if (result.Edits.Length == 0) - { - // There are no HTML edits for us to apply. No op. - return Task.FromResult(new FormattingResult([])); - } - - return base.ExecuteAsync(context, result, cancellationToken); - } -} - -internal abstract class HtmlFormattingPassBase(ILogger logger) : IFormattingPass -{ - private readonly ILogger _logger = logger; - - public virtual async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) - { - var originalText = context.SourceText; - - var htmlEdits = result.Edits; - - var changedText = originalText; - var changedContext = context; - - _logger.LogTestOnly($"Before HTML formatter:\r\n{changedText}"); - - if (htmlEdits.Length > 0) - { - var changes = htmlEdits.Select(originalText.GetTextChange); - changedText = originalText.WithChanges(changes); - // Create a new formatting context for the changed razor document. - changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); - - _logger.LogTestOnly($"After normalizedEdits:\r\n{changedText}"); - } - - var indentationChanges = AdjustRazorIndentation(changedContext); - if (indentationChanges.Count > 0) - { - // Apply the edits that adjust indentation. - changedText = changedText.WithChanges(indentationChanges); - _logger.LogTestOnly($"After AdjustRazorIndentation:\r\n{changedText}"); - } - - var finalChanges = changedText.GetTextChanges(originalText); - var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - - return new FormattingResult(finalEdits); - } - - private static List AdjustRazorIndentation(FormattingContext context) - { - // Assume HTML formatter has already run at this point and HTML is relatively indented correctly. - // But HTML doesn't know about Razor blocks. - // Our goal here is to indent each line according to the surrounding Razor blocks. - var sourceText = context.SourceText; - var editsToApply = new List(); - var indentations = context.GetIndentations(); - - for (var i = 0; i < sourceText.Lines.Count; i++) - { - var line = sourceText.Lines[i]; - if (line.Span.Length == 0) - { - // Empty line. - continue; - } - - if (indentations[i].StartsInCSharpContext) - { - // Normally we don't do HTML things in C# contexts but there is one - // edge case when including render fragments in a C# code block, eg: - // - // @code { - // void Foo() - // { - // Render(@); - // { - // } - // - // This is popular in some libraries, like bUnit. The issue here is that - // the HTML formatter sees ~~~~~ and puts a newline before - // the tag, but obviously that breaks things. - // - // It's straight forward enough to just check for this situation and special case - // it by removing the newline again. - - // There needs to be at least one more line, and the current line needs to end with - // an @ sign, and have an open angle bracket at the start of the next line. - if (sourceText.Lines.Count >= i + 1 && - line.Text?.Length > 1 && - line.Text?[line.End - 1] == '@') - { - var nextLine = sourceText.Lines[i + 1]; - var firstChar = nextLine.GetFirstNonWhitespaceOffset().GetValueOrDefault(); - - // When the HTML formatter inserts the newline in this scenario, it doesn't - // indent the component tag, so we use that as another signal that this is - // the scenario we think it is. - if (firstChar == 0 && - nextLine.Text?[nextLine.Start] == '<') - { - var lineBreakLength = line.EndIncludingLineBreak - line.End; - var spanToReplace = new TextSpan(line.End, lineBreakLength); - var change = new TextChange(spanToReplace, string.Empty); - editsToApply.Add(change); - - // Skip the next line because we've essentially just removed it. - i++; - } - } - - continue; - } - - var razorDesiredIndentationLevel = indentations[i].RazorIndentationLevel; - if (razorDesiredIndentationLevel == 0) - { - // This line isn't under any Razor specific constructs. Trust the HTML formatter. - continue; - } - - var htmlDesiredIndentationLevel = indentations[i].HtmlIndentationLevel; - if (htmlDesiredIndentationLevel == 0 && !IsPartOfHtmlTag(context, indentations[i].FirstSpan.Span.Start)) - { - // This line is under some Razor specific constructs but not under any HTML tag. - // E.g, - // @{ - // @* comment *@ <---- - // } - // - // In this case, the HTML formatter wouldn't touch it but we should format it correctly. - // So, let's use our syntax understanding to rewrite the indentation. - // Note: This case doesn't apply for HTML tags (HTML formatter will touch it even if it is in the root). - // Hence the second part of the if condition. - // - var desiredIndentationLevel = indentations[i].IndentationLevel; - var desiredIndentationString = context.GetIndentationLevelString(desiredIndentationLevel); - var spanToReplace = new TextSpan(line.Start, indentations[i].ExistingIndentation); - var change = new TextChange(spanToReplace, desiredIndentationString); - editsToApply.Add(change); - } - else - { - // This line is under some Razor specific constructs and HTML tags. - // E.g, - // @{ - //
<---- - //
- // } - // - // In this case, the HTML formatter would've formatted it correctly. Let's not use our syntax understanding. - // Instead, we should just add to the existing indentation. - // - var razorDesiredIndentationString = context.GetIndentationLevelString(razorDesiredIndentationLevel); - var existingIndentationString = FormattingUtilities.GetIndentationString(indentations[i].ExistingIndentationSize, context.Options.InsertSpaces, context.Options.TabSize); - var desiredIndentationString = existingIndentationString + razorDesiredIndentationString; - var spanToReplace = new TextSpan(line.Start, indentations[i].ExistingIndentation); - var change = new TextChange(spanToReplace, desiredIndentationString); - editsToApply.Add(change); - } - } - - return editsToApply; - } - - private static bool IsPartOfHtmlTag(FormattingContext context, int position) - { - var syntaxTree = context.CodeDocument.GetSyntaxTree(); - var owner = syntaxTree.Root.FindInnermostNode(position, includeWhitespace: true); - if (owner is null) - { - // Can't determine owner of this position. - return false; - } - - // E.g, (| is position) - // - // `

` - true - // - return owner.AncestorsAndSelf().Any( - n => n is MarkupStartTagSyntax || n is MarkupTagHelperStartTagSyntax || n is MarkupEndTagSyntax || n is MarkupTagHelperEndTagSyntax); - } -} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs new file mode 100644 index 00000000000..f08b23a0e2e --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs @@ -0,0 +1,189 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal abstract class HtmlFormattingPassBase(ILogger logger) : IFormattingPass +{ + private readonly ILogger _logger = logger; + + public virtual async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + { + var originalText = context.SourceText; + + var htmlEdits = result.Edits; + + var changedText = originalText; + var changedContext = context; + + _logger.LogTestOnly($"Before HTML formatter:\r\n{changedText}"); + + if (htmlEdits.Length > 0) + { + var changes = htmlEdits.Select(originalText.GetTextChange); + changedText = originalText.WithChanges(changes); + // Create a new formatting context for the changed razor document. + changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); + + _logger.LogTestOnly($"After normalizedEdits:\r\n{changedText}"); + } + + var indentationChanges = AdjustRazorIndentation(changedContext); + if (indentationChanges.Count > 0) + { + // Apply the edits that adjust indentation. + changedText = changedText.WithChanges(indentationChanges); + _logger.LogTestOnly($"After AdjustRazorIndentation:\r\n{changedText}"); + } + + var finalChanges = changedText.GetTextChanges(originalText); + var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); + + return new FormattingResult(finalEdits); + } + + private static List AdjustRazorIndentation(FormattingContext context) + { + // Assume HTML formatter has already run at this point and HTML is relatively indented correctly. + // But HTML doesn't know about Razor blocks. + // Our goal here is to indent each line according to the surrounding Razor blocks. + var sourceText = context.SourceText; + var editsToApply = new List(); + var indentations = context.GetIndentations(); + + for (var i = 0; i < sourceText.Lines.Count; i++) + { + var line = sourceText.Lines[i]; + if (line.Span.Length == 0) + { + // Empty line. + continue; + } + + if (indentations[i].StartsInCSharpContext) + { + // Normally we don't do HTML things in C# contexts but there is one + // edge case when including render fragments in a C# code block, eg: + // + // @code { + // void Foo() + // { + // Render(@); + // { + // } + // + // This is popular in some libraries, like bUnit. The issue here is that + // the HTML formatter sees ~~~~~ and puts a newline before + // the tag, but obviously that breaks things. + // + // It's straight forward enough to just check for this situation and special case + // it by removing the newline again. + + // There needs to be at least one more line, and the current line needs to end with + // an @ sign, and have an open angle bracket at the start of the next line. + if (sourceText.Lines.Count >= i + 1 && + line.Text?.Length > 1 && + line.Text?[line.End - 1] == '@') + { + var nextLine = sourceText.Lines[i + 1]; + var firstChar = nextLine.GetFirstNonWhitespaceOffset().GetValueOrDefault(); + + // When the HTML formatter inserts the newline in this scenario, it doesn't + // indent the component tag, so we use that as another signal that this is + // the scenario we think it is. + if (firstChar == 0 && + nextLine.Text?[nextLine.Start] == '<') + { + var lineBreakLength = line.EndIncludingLineBreak - line.End; + var spanToReplace = new TextSpan(line.End, lineBreakLength); + var change = new TextChange(spanToReplace, string.Empty); + editsToApply.Add(change); + + // Skip the next line because we've essentially just removed it. + i++; + } + } + + continue; + } + + var razorDesiredIndentationLevel = indentations[i].RazorIndentationLevel; + if (razorDesiredIndentationLevel == 0) + { + // This line isn't under any Razor specific constructs. Trust the HTML formatter. + continue; + } + + var htmlDesiredIndentationLevel = indentations[i].HtmlIndentationLevel; + if (htmlDesiredIndentationLevel == 0 && !IsPartOfHtmlTag(context, indentations[i].FirstSpan.Span.Start)) + { + // This line is under some Razor specific constructs but not under any HTML tag. + // E.g, + // @{ + // @* comment *@ <---- + // } + // + // In this case, the HTML formatter wouldn't touch it but we should format it correctly. + // So, let's use our syntax understanding to rewrite the indentation. + // Note: This case doesn't apply for HTML tags (HTML formatter will touch it even if it is in the root). + // Hence the second part of the if condition. + // + var desiredIndentationLevel = indentations[i].IndentationLevel; + var desiredIndentationString = context.GetIndentationLevelString(desiredIndentationLevel); + var spanToReplace = new TextSpan(line.Start, indentations[i].ExistingIndentation); + var change = new TextChange(spanToReplace, desiredIndentationString); + editsToApply.Add(change); + } + else + { + // This line is under some Razor specific constructs and HTML tags. + // E.g, + // @{ + //

<---- + //
+ // } + // + // In this case, the HTML formatter would've formatted it correctly. Let's not use our syntax understanding. + // Instead, we should just add to the existing indentation. + // + var razorDesiredIndentationString = context.GetIndentationLevelString(razorDesiredIndentationLevel); + var existingIndentationString = FormattingUtilities.GetIndentationString(indentations[i].ExistingIndentationSize, context.Options.InsertSpaces, context.Options.TabSize); + var desiredIndentationString = existingIndentationString + razorDesiredIndentationString; + var spanToReplace = new TextSpan(line.Start, indentations[i].ExistingIndentation); + var change = new TextChange(spanToReplace, desiredIndentationString); + editsToApply.Add(change); + } + } + + return editsToApply; + } + + private static bool IsPartOfHtmlTag(FormattingContext context, int position) + { + var syntaxTree = context.CodeDocument.GetSyntaxTree(); + var owner = syntaxTree.Root.FindInnermostNode(position, includeWhitespace: true); + if (owner is null) + { + // Can't determine owner of this position. + return false; + } + + // E.g, (| is position) + // + // `

` - true + // + return owner.AncestorsAndSelf().Any( + n => n is MarkupStartTagSyntax || n is MarkupTagHelperStartTagSyntax || n is MarkupEndTagSyntax || n is MarkupTagHelperEndTagSyntax); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs new file mode 100644 index 00000000000..fd5d5193cf6 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) +{ + public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + { + Debug.Assert(result.Kind == RazorLanguageKind.Html); + + if (result.Edits.Length == 0) + { + // There are no HTML edits for us to apply. No op. + return Task.FromResult(new FormattingResult([])); + } + + return base.ExecuteAsync(context, result, cancellationToken); + } +} From 45b8495ac80dd0d31cb35f360f3eb5b87fc9df3c Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 16:13:45 +1000 Subject: [PATCH 143/271] List -> PooledArrayBuilder --- .../Formatting/Passes/RazorFormattingPass.cs | 70 ++++++++++--------- 1 file changed, 36 insertions(+), 34 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 520a720ee75..64fa3046b54 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; @@ -11,6 +12,7 @@ using Microsoft.AspNetCore.Razor.Language.Components; using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using RazorRazorSyntaxNodeList = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxList; @@ -50,34 +52,34 @@ public async Task ExecuteAsync(FormattingContext context, Form return new FormattingResult(finalEdits); } - private static IEnumerable FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) + private static ImmutableArray FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) { - var edits = new List(); + using var edits = new PooledArrayBuilder(); var source = syntaxTree.Source; foreach (var node in syntaxTree.Root.DescendantNodes()) { // Disclaimer: CSharpCodeBlockSyntax is used a _lot_ in razor so these methods are probably // being overly careful to only try to format syntax forms they care about. - TryFormatCSharpBlockStructure(context, edits, source, node); // TODO - TryFormatSingleLineDirective(edits, source, node); - TryFormatBlocks(context, edits, source, node); + TryFormatCSharpBlockStructure(context, ref edits.AsRef(), source, node); // TODO + TryFormatSingleLineDirective(ref edits.AsRef(), source, node); + TryFormatBlocks(context, ref edits.AsRef(), source, node); } - return edits; + return edits.ToImmutable(); } - private static void TryFormatBlocks(FormattingContext context, List edits, RazorSourceDocument source, RazorSyntaxNode node) + private static void TryFormatBlocks(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // We only want to run one of these - _ = TryFormatFunctionsBlock(context, edits, source, node) || - TryFormatCSharpExplicitTransition(context, edits, source, node) || - TryFormatHtmlInCSharp(context, edits, source, node) || - TryFormatComplexCSharpBlock(context, edits, source, node) || - TryFormatSectionBlock(context, edits, source, node); + _ = TryFormatFunctionsBlock(context, ref edits, source, node) || + TryFormatCSharpExplicitTransition(context, ref edits, source, node) || + TryFormatHtmlInCSharp(context, ref edits, source, node) || + TryFormatComplexCSharpBlock(context, ref edits, source, node) || + TryFormatSectionBlock(context, ref edits, source, node); } - private static bool TryFormatSectionBlock(FormattingContext context, List edits, RazorSourceDocument source, RazorSyntaxNode node) + private static bool TryFormatSectionBlock(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // @section Goo { // } @@ -96,8 +98,8 @@ directiveCode.Children is [RazorDirectiveSyntax directive] && if (TryGetWhitespace(children, out var whitespaceBeforeSectionName, out var whitespaceAfterSectionName)) { // For whitespace we normalize it differently depending on if its multi-line or not - FormatWhitespaceBetweenDirectiveAndBrace(whitespaceBeforeSectionName, directive, edits, source, context, forceNewLine: false); - FormatWhitespaceBetweenDirectiveAndBrace(whitespaceAfterSectionName, directive, edits, source, context, forceNewLine: false); + FormatWhitespaceBetweenDirectiveAndBrace(whitespaceBeforeSectionName, directive, ref edits, source, context, forceNewLine: false); + FormatWhitespaceBetweenDirectiveAndBrace(whitespaceAfterSectionName, directive, ref edits, source, context, forceNewLine: false); return true; } @@ -134,7 +136,7 @@ children[2] is UnclassifiedTextLiteralSyntax after && } } - private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) + private static bool TryFormatFunctionsBlock(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // @functions // { @@ -166,13 +168,13 @@ private static bool TryFormatFunctionsBlock(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) + private static bool TryFormatCSharpExplicitTransition(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -187,13 +189,13 @@ private static bool TryFormatCSharpExplicitTransition(FormattingContext context, var codeNode = csharpStatementBody.CSharpCode; var closeBraceNode = csharpStatementBody.CloseBrace; - return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, edits); + return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, ref edits); } return false; } - private static bool TryFormatComplexCSharpBlock(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) + private static bool TryFormatComplexCSharpBlock(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // complex situations like // @{ @@ -209,13 +211,13 @@ csharpRazorBlock.Parent is CSharpCodeBlockSyntax innerCodeBlock && var openBraceNode = outerCodeBlock.Children.PreviousSiblingOrSelf(innerCodeBlock); var closeBraceNode = outerCodeBlock.Children.NextSiblingOrSelf(innerCodeBlock); - return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, edits); + return FormatBlock(context, source, directiveNode: null, openBraceNode, codeNode, closeBraceNode, ref edits); } return false; } - private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) + private static bool TryFormatHtmlInCSharp(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // void Method() // { @@ -227,13 +229,13 @@ private static bool TryFormatHtmlInCSharp(FormattingContext context, IList edits, RazorSourceDocument source, RazorSyntaxNode node) + private static void TryFormatCSharpBlockStructure(FormattingContext context, ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // We're looking for a code block like this: // @@ -261,7 +263,7 @@ private static void TryFormatCSharpBlockStructure(FormattingContext context, Lis if (TryGetLeadingWhitespace(children, out var whitespace)) { // For whitespace we normalize it differently depending on if its multi-line or not - FormatWhitespaceBetweenDirectiveAndBrace(whitespace, directive, edits, source, context, forceNewLine); + FormatWhitespaceBetweenDirectiveAndBrace(whitespace, directive, ref edits, source, context, forceNewLine); } else if (children.TryGetOpenBraceToken(out var brace)) { @@ -293,7 +295,7 @@ children[0] is UnclassifiedTextLiteralSyntax literal && } } - private static void TryFormatSingleLineDirective(List edits, RazorSourceDocument source, RazorSyntaxNode node) + private static void TryFormatSingleLineDirective(ref PooledArrayBuilder edits, RazorSourceDocument source, RazorSyntaxNode node) { // Looking for single line directives like // @@ -309,7 +311,7 @@ private static void TryFormatSingleLineDirective(List edits, RazorSour { if (child.ContainsOnlyWhitespace(includingNewLines: false)) { - ShrinkToSingleSpace(child, edits, source); + ShrinkToSingleSpace(child, ref edits, source); } } } @@ -329,11 +331,11 @@ static bool IsSingleLineDirective(RazorSyntaxNode node, out RazorSyntaxNodeList } } - private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, List edits, RazorSourceDocument source, FormattingContext context, bool forceNewLine) + private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode node, RazorDirectiveSyntax directive, ref PooledArrayBuilder edits, RazorSourceDocument source, FormattingContext context, bool forceNewLine) { if (node.ContainsOnlyWhitespace(includingNewLines: false) && !forceNewLine) { - ShrinkToSingleSpace(node, edits, source); + ShrinkToSingleSpace(node, ref edits, source); } else { @@ -348,7 +350,7 @@ private static void FormatWhitespaceBetweenDirectiveAndBrace(RazorSyntaxNode nod } } - private static void ShrinkToSingleSpace(RazorSyntaxNode node, List edits, RazorSourceDocument source) + private static void ShrinkToSingleSpace(RazorSyntaxNode node, ref PooledArrayBuilder edits, RazorSourceDocument source) { // If there is anything other than one single space then we replace with one space between directive and brace. // @@ -357,7 +359,7 @@ private static void ShrinkToSingleSpace(RazorSyntaxNode node, List edi edits.Add(edit); } - private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, IList edits) + private static bool FormatBlock(FormattingContext context, RazorSourceDocument source, RazorSyntaxNode? directiveNode, RazorSyntaxNode openBraceNode, RazorSyntaxNode codeNode, RazorSyntaxNode closeBraceNode, ref PooledArrayBuilder edits) { var didFormat = false; @@ -367,7 +369,7 @@ private static bool FormatBlock(FormattingContext context, RazorSourceDocument s if (openBraceRange is not null && codeRange is not null && openBraceRange.End.Line == codeRange.Start.Line && - !RangeHasBeenModified(edits, codeRange)) + !RangeHasBeenModified(ref edits, codeRange)) { var additionalIndentationLevel = GetAdditionalIndentationLevel(context, openBraceRange, openBraceNode, codeNode); var newText = context.NewLineString; @@ -384,7 +386,7 @@ codeRange is not null && var closeBraceRange = closeBraceNode.GetRangeWithoutWhitespace(source); if (codeRange is not null && closeBraceRange is not null && - !RangeHasBeenModified(edits, codeRange)) + !RangeHasBeenModified(ref edits, codeRange)) { if (directiveNode is not null && directiveNode.GetRange(source).Start.Character < closeBraceRange.Start.Character) @@ -409,7 +411,7 @@ closeBraceRange is not null && return didFormat; - static bool RangeHasBeenModified(IList edits, Range range) + static bool RangeHasBeenModified(ref PooledArrayBuilder edits, Range range) { // Because we don't always know what kind of Razor object we're operating on we have to do this to avoid duplicate edits. // The other way to accomplish this would be to apply the edits after every node and function, but that's not in scope for my current work. From 5caa48f8e36900c3f9fd26fd2c563e466dcf0189 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 16:44:17 +1000 Subject: [PATCH 144/271] Remove Kind property from FormattingResult This was only used for validation as edits pass through the pipeline, but since we now tightly control the pipeline its unnecessary --- .../Formatting/FormattingResult.cs | 20 +----- .../Formatting/IRazorFormattingService.cs | 6 +- .../Formatting/Passes/CSharpFormattingPass.cs | 7 +-- .../Passes/CSharpOnTypeFormattingPass.cs | 18 ++---- .../Passes/FormattingContentValidationPass.cs | 7 --- .../FormattingDiagnosticValidationPass.cs | 7 --- .../Formatting/Passes/HtmlFormattingPass.cs | 3 + .../Passes/HtmlOnTypeFormattingPass.cs | 7 +-- .../Formatting/RazorFormattingService.cs | 61 ++++++++----------- .../FormattingContentValidationPassTest.cs | 45 +------------- .../FormattingDiagnosticValidationPassTest.cs | 47 +------------- 11 files changed, 50 insertions(+), 178 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs index e8db79e5204..a5a24271773 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs @@ -1,26 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal readonly struct FormattingResult -{ - public FormattingResult(TextEdit[] edits, RazorLanguageKind kind = RazorLanguageKind.Razor) - { - if (edits is null) - { - throw new ArgumentNullException(nameof(edits)); - } - - Edits = edits; - Kind = kind; - } - - public TextEdit[] Edits { get; } - - public RazorLanguageKind Kind { get; } -} +internal readonly record struct FormattingResult(TextEdit[] Edits); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index f2893792c98..63f4bef48f6 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -34,19 +34,19 @@ Task GetCSharpOnTypeFormattingEditsAsync( Task GetSingleCSharpEditAsync( DocumentContext documentContext, - TextEdit initialEdit, + TextEdit csharpEdit, RazorFormattingOptions options, CancellationToken cancellationToken); Task GetCSharpCodeActionEditAsync( DocumentContext documentContext, - TextEdit[] formattedEdits, + TextEdit[] csharpEdits, RazorFormattingOptions options, CancellationToken cancellationToken); Task GetCSharpSnippetFormattingEditAsync( DocumentContext documentContext, - TextEdit[] edits, + TextEdit[] csharpEdits, RazorFormattingOptions options, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs index 03f4f3b79a3..56740124049 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Collections.Immutable; -using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,12 +11,14 @@ using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; +///

+/// Gets edits in Razor files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class CSharpFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) @@ -28,8 +29,6 @@ internal sealed class CSharpFormattingPass( public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - Debug.Assert(result.Kind == RazorLanguageKind.Razor); - // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index 77d319406d0..c5fef080813 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -16,13 +16,15 @@ using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; namespace Microsoft.CodeAnalysis.Razor.Formatting; +/// +/// Gets edits in C# files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class CSharpOnTypeFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) @@ -32,8 +34,6 @@ internal sealed class CSharpOnTypeFormattingPass( public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - Debug.Assert(result.Kind == RazorLanguageKind.CSharp); - // Normalize and re-map the C# edits. var codeDocument = context.CodeDocument; var csharpText = codeDocument.GetCSharpSourceText(); @@ -85,9 +85,9 @@ public async override Task ExecuteAsync(FormattingContext cont return result; } } - + var normalizedEdits = csharpText.NormalizeTextEdits(textEdits, out var originalTextWithChanges); - var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits, result.Kind); + var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits); var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); if (filteredEdits.Length == 0) { @@ -201,14 +201,8 @@ public async override Task ExecuteAsync(FormattingContext cont return new FormattingResult(finalEdits); } - private TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits, RazorLanguageKind projectedKind) + private TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits) { - if (projectedKind != RazorLanguageKind.CSharp) - { - // Non C# projections map directly to Razor. No need to remap. - return projectedTextEdits; - } - if (codeDocument.IsUnsupported()) { return []; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs index 76bd0e286fa..733c6d05bf4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs @@ -6,7 +6,6 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -21,12 +20,6 @@ internal sealed class FormattingContentValidationPass(ILoggerFactory loggerFacto public Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - if (result.Kind != RazorLanguageKind.Razor) - { - // We don't care about changes to projected documents here. - return Task.FromResult(result); - } - var text = context.SourceText; var edits = result.Edits; var changes = edits.Select(text.GetTextChange); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs index a7824ea711a..dbc058f4d1c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; @@ -23,12 +22,6 @@ internal sealed class FormattingDiagnosticValidationPass(ILoggerFactory loggerFa public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - if (result.Kind != RazorLanguageKind.Razor) - { - // We don't care about changes to projected documents here. - return result; - } - var originalDiagnostics = context.CodeDocument.GetSyntaxTree().Diagnostics; var text = context.SourceText; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs index 0a7800d8164..4cb84022a63 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPass.cs @@ -5,6 +5,9 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; +/// +/// Gets edits in Razor files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class HtmlFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) { } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs index fd5d5193cf6..5f138ca9c18 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs @@ -1,20 +1,19 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Diagnostics; using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; +/// +/// Gets edits in Html files, and returns edits to Razor files, with nicely formatted Html +/// internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) { public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) { - Debug.Assert(result.Kind == RazorLanguageKind.Html); - if (result.Edits.Length == 0) { // There are no HTML edits for us to apply. No op. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index a8f5e2542b6..497c9c3f82d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -11,7 +11,6 @@ using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -107,8 +106,7 @@ public async Task GetDocumentFormattingEditsAsync( public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync( documentContext, - RazorLanguageKind.CSharp, - formattedEdits: [], + generatedDocumentEdits: [], options, hostDocumentIndex, triggerCharacter, @@ -120,7 +118,6 @@ public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext docu public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext documentContext, TextEdit[] htmlEdits, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) => ApplyFormattedEditsAsync( documentContext, - RazorLanguageKind.Html, htmlEdits, options, hostDocumentIndex, @@ -130,12 +127,11 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume automaticallyAddUsings: false, cancellationToken: cancellationToken); - public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit edit, RazorFormattingOptions options, CancellationToken cancellationToken) + public async Task GetSingleCSharpEditAsync(DocumentContext documentContext, TextEdit csharpEdit, RazorFormattingOptions options, CancellationToken cancellationToken) { - var formattedEdits = await ApplyFormattedEditsAsync( + var razorEdits = await ApplyFormattedEditsAsync( documentContext, - RazorLanguageKind.CSharp, - [edit], + [csharpEdit], options, hostDocumentIndex: 0, triggerCharacter: '\0', @@ -143,15 +139,14 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume collapseEdits: false, automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); - return formattedEdits.SingleOrDefault(); + return razorEdits.SingleOrDefault(); } - public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] initialEdits, RazorFormattingOptions options, CancellationToken cancellationToken) + public async Task GetCSharpCodeActionEditAsync(DocumentContext documentContext, TextEdit[] csharpEdits, RazorFormattingOptions options, CancellationToken cancellationToken) { - var edits = await ApplyFormattedEditsAsync( + var razorEdits = await ApplyFormattedEditsAsync( documentContext, - RazorLanguageKind.CSharp, - initialEdits, + csharpEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', @@ -159,17 +154,16 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume collapseEdits: true, automaticallyAddUsings: true, cancellationToken: cancellationToken).ConfigureAwait(false); - return edits.SingleOrDefault(); + return razorEdits.SingleOrDefault(); } - public async Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] edits, RazorFormattingOptions options, CancellationToken cancellationToken) + public async Task GetCSharpSnippetFormattingEditAsync(DocumentContext documentContext, TextEdit[] csharpEdits, RazorFormattingOptions options, CancellationToken cancellationToken) { - WrapCSharpSnippets(edits); + WrapCSharpSnippets(csharpEdits); - var formattedEdits = await ApplyFormattedEditsAsync( + var razorEdits = await ApplyFormattedEditsAsync( documentContext, - RazorLanguageKind.CSharp, - edits, + csharpEdits, options, hostDocumentIndex: 0, triggerCharacter: '\0', @@ -178,15 +172,14 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume automaticallyAddUsings: false, cancellationToken: cancellationToken).ConfigureAwait(false); - UnwrapCSharpSnippets(formattedEdits); + UnwrapCSharpSnippets(razorEdits); - return formattedEdits.SingleOrDefault(); + return razorEdits.SingleOrDefault(); } private async Task ApplyFormattedEditsAsync( DocumentContext documentContext, - RazorLanguageKind kind, - TextEdit[] formattedEdits, + TextEdit[] generatedDocumentEdits, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, @@ -197,13 +190,13 @@ private async Task ApplyFormattedEditsAsync( { // If we only received a single edit, let's always return a single edit back. // Otherwise, merge only if explicitly asked. - collapseEdits |= formattedEdits.Length == 1; + collapseEdits |= generatedDocumentEdits.Length == 1; var documentSnapshot = documentContext.Snapshot; var uri = documentContext.Uri; var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); using var context = FormattingContext.CreateForOnTypeFormatting(uri, documentSnapshot, codeDocument, options, _workspaceFactory, automaticallyAddUsings: automaticallyAddUsings, hostDocumentIndex, triggerCharacter); - var result = new FormattingResult(formattedEdits, kind); + var result = new FormattingResult(generatedDocumentEdits); foreach (var pass in formattingPasses) { @@ -212,11 +205,11 @@ private async Task ApplyFormattedEditsAsync( } var originalText = context.SourceText; - var edits = originalText.NormalizeTextEdits(result.Edits); + var razorEdits = originalText.NormalizeTextEdits(result.Edits); if (collapseEdits) { - var collapsedEdit = MergeEdits(edits, originalText); + var collapsedEdit = MergeEdits(razorEdits, originalText); if (collapsedEdit.NewText.Length == 0 && collapsedEdit.Range.IsZeroWidth()) { @@ -226,7 +219,7 @@ private async Task ApplyFormattedEditsAsync( return [collapsedEdit]; } - return edits; + return razorEdits; } // Internal for testing @@ -248,25 +241,25 @@ internal static TextEdit MergeEdits(TextEdit[] edits, SourceText sourceText) return sourceText.GetTextEdit(encompassingChange); } - private static void WrapCSharpSnippets(TextEdit[] snippetEdits) + private static void WrapCSharpSnippets(TextEdit[] csharpEdits) { // Currently this method only supports wrapping `$0`, any additional markers aren't formatted properly. - foreach (var snippetEdit in snippetEdits) + foreach (var edit in csharpEdits) { // Formatting doesn't work with syntax errors caused by the cursor marker ($0). // So, let's avoid the error by wrapping the cursor marker in a comment. - snippetEdit.NewText = snippetEdit.NewText.Replace("$0", "/*$0*/"); + edit.NewText = edit.NewText.Replace("$0", "/*$0*/"); } } - private static void UnwrapCSharpSnippets(TextEdit[] snippetEdits) + private static void UnwrapCSharpSnippets(TextEdit[] razorEdits) { - foreach (var snippetEdit in snippetEdits) + foreach (var edit in razorEdits) { // Formatting doesn't work with syntax errors caused by the cursor marker ($0). // So, let's avoid the error by wrapping the cursor marker in a comment. - snippetEdit.NewText = snippetEdit.NewText.Replace("/*$0*/", "$0"); + edit.NewText = edit.NewText.Replace("/*$0*/", "$0"); } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index 42688f3992f..becc4807f3f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -10,7 +10,6 @@ using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Moq; @@ -21,46 +20,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class FormattingContentValidationPassTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - [Fact] - public async Task Execute_LanguageKindCSharp_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var input = new FormattingResult([], RazorLanguageKind.CSharp); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - - [Fact] - public async Task Execute_LanguageKindHtml_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var input = new FormattingResult([], RazorLanguageKind.Html); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - [Fact] public async Task Execute_NonDestructiveEdit_Allowed() { @@ -75,7 +34,7 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, " ") }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + var input = new FormattingResult(edits); var pass = GetPass(); // Act @@ -99,7 +58,7 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, 3, 0, " ") // Nukes a line }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + var input = new FormattingResult(edits); var pass = GetPass(); // Act diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index 28655554161..82f92cfe499 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -9,7 +9,6 @@ using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; @@ -19,48 +18,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class FormattingDiagnosticValidationPassTest(ITestOutputHelper testOutput) : LanguageServerTestBase(testOutput) { - [Fact] - public async Task ExecuteAsync_LanguageKindCSharp_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); - var input = new FormattingResult([badEdit], RazorLanguageKind.CSharp); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - - [Fact] - public async Task ExecuteAsync_LanguageKindHtml_Noops() - { - // Arrange - var source = SourceText.From(@" -@code { - public class Foo { } -} -"); - using var context = CreateFormattingContext(source); - var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); - var input = new FormattingResult([badEdit], RazorLanguageKind.Html); - var pass = GetPass(); - - // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); - - // Assert - Assert.Equal(input, result); - } - [Fact] public async Task ExecuteAsync_NonDestructiveEdit_Allowed() { @@ -75,7 +32,7 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, " ") }; - var input = new FormattingResult(edits, RazorLanguageKind.Razor); + var input = new FormattingResult(edits); var pass = GetPass(); // Act @@ -96,7 +53,7 @@ public class Foo { } "); using var context = CreateFormattingContext(source); var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); // Creates a diagnostic - var input = new FormattingResult([badEdit], RazorLanguageKind.Razor); + var input = new FormattingResult([badEdit]); var pass = GetPass(); // Act From fa4e8efb54bb2c6f4bdaf3e64e64e26faf764c86 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 17:02:20 +1000 Subject: [PATCH 145/271] Remove FormattingResult since it's now useless --- .../Formatting/FormattingResult.cs | 8 ------ .../Formatting/IFormattingPass.cs | 3 ++- .../Formatting/Passes/CSharpFormattingPass.cs | 8 +++--- .../Passes/CSharpFormattingPassBase.cs | 2 +- .../Passes/CSharpOnTypeFormattingPass.cs | 27 +++++++++---------- .../Passes/FormattingContentValidationPass.cs | 7 +++-- .../FormattingDiagnosticValidationPass.cs | 7 +++-- .../Passes/HtmlFormattingPassBase.cs | 10 +++---- .../Passes/HtmlOnTypeFormattingPass.cs | 9 ++++--- .../Formatting/Passes/RazorFormattingPass.cs | 12 ++++----- .../Formatting/RazorFormattingService.cs | 11 ++++---- .../FormattingContentValidationPassTest.cs | 10 +++---- .../FormattingDiagnosticValidationPassTest.cs | 9 +++---- 13 files changed, 55 insertions(+), 68 deletions(-) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs deleted file mode 100644 index a5a24271773..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingResult.cs +++ /dev/null @@ -1,8 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.CodeAnalysis.Razor.Formatting; - -internal readonly record struct FormattingResult(TextEdit[] Edits); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs index 074ccc19e7b..18e774ed89e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingPass.cs @@ -3,10 +3,11 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; internal interface IFormattingPass { - Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); + Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs index 56740124049..d1d5505c83b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPass.cs @@ -27,15 +27,15 @@ internal sealed class CSharpFormattingPass( private readonly CSharpFormatter _csharpFormatter = new CSharpFormatter(documentMappingService); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async override Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; var changedContext = context; - if (result.Edits.Length > 0) + if (edits.Length > 0) { - var changes = result.Edits.Select(originalText.GetTextChange).ToArray(); + var changes = edits.Select(originalText.GetTextChange); changedText = changedText.WithChanges(changes); changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); } @@ -69,7 +69,7 @@ public async override Task ExecuteAsync(FormattingContext cont var finalChanges = changedText.GetTextChanges(originalText); var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - return new FormattingResult(finalEdits); + return finalEdits; } private async Task> FormatCSharpAsync(FormattingContext context, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs index 6941dbf4933..4387ce3d7e6 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs @@ -25,7 +25,7 @@ internal abstract class CSharpFormattingPassBase(IDocumentMappingService documen protected IDocumentMappingService DocumentMappingService { get; } = documentMappingService; - public abstract Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken); + public abstract Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken); protected async Task> AdjustIndentationAsync(FormattingContext context, CancellationToken cancellationToken, Range? range = null) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index c5fef080813..077aa630c83 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -32,19 +32,18 @@ internal sealed class CSharpOnTypeFormattingPass( { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async override Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { // Normalize and re-map the C# edits. var codeDocument = context.CodeDocument; var csharpText = codeDocument.GetCSharpSourceText(); - var textEdits = result.Edits; - if (textEdits.Length == 0) + if (edits.Length == 0) { if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), context.HostDocumentIndex, out _, out var projectedIndex)) { _logger.LogWarning($"Failed to map to projected position for document {context.Uri}."); - return result; + return edits; } // Ask C# for formatting changes. @@ -63,18 +62,18 @@ public async override Task ExecuteAsync(FormattingContext cont if (formattingChanges.IsEmpty) { _logger.LogInformation($"Received no results."); - return result; + return edits; } - textEdits = formattingChanges.Select(csharpText.GetTextEdit).ToArray(); - _logger.LogInformation($"Received {textEdits.Length} results from C#."); + edits = formattingChanges.Select(csharpText.GetTextEdit).ToArray(); + _logger.LogInformation($"Received {edits.Length} results from C#."); } // Sometimes the C# document is out of sync with our document, so Roslyn can return edits to us that will throw when we try // to normalize them. Instead of having this flow up and log a NFW, we just capture it here. Since this only happens when typing // very quickly, it is a safe assumption that we'll get another chance to do on type formatting, since we know the user is typing. // The proper fix for this is https://github.com/dotnet/razor-tooling/issues/6650 at which point this can be removed - foreach (var edit in textEdits) + foreach (var edit in edits) { var startLine = edit.Range.Start.Line; var endLine = edit.Range.End.Line; @@ -82,11 +81,11 @@ public async override Task ExecuteAsync(FormattingContext cont if (startLine >= count || endLine >= count) { _logger.LogWarning($"Got a bad edit that couldn't be applied. Edit is {startLine}-{endLine} but there are only {count} lines in C#."); - return result; + return edits; } } - var normalizedEdits = csharpText.NormalizeTextEdits(textEdits, out var originalTextWithChanges); + var normalizedEdits = csharpText.NormalizeTextEdits((TextEdit[])edits, out var originalTextWithChanges); var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits); var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); if (filteredEdits.Length == 0) @@ -96,9 +95,9 @@ public async override Task ExecuteAsync(FormattingContext cont // // If there aren't any edits that are likely to contain using statement changes, this call will no-op. - filteredEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, textEdits, originalTextWithChanges, filteredEdits, cancellationToken).ConfigureAwait(false); + filteredEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, edits, originalTextWithChanges, filteredEdits, cancellationToken).ConfigureAwait(false); - return new FormattingResult(filteredEdits); + return filteredEdits; } // Find the lines that were affected by these edits. @@ -196,9 +195,9 @@ public async override Task ExecuteAsync(FormattingContext cont var finalChanges = cleanedText.GetTextChanges(originalText); var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - finalEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, textEdits, originalTextWithChanges, finalEdits, cancellationToken).ConfigureAwait(false); + finalEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, edits, originalTextWithChanges, finalEdits, cancellationToken).ConfigureAwait(false); - return new FormattingResult(finalEdits); + return finalEdits; } private TextEdit[] RemapTextEdits(RazorCodeDocument codeDocument, TextEdit[] projectedTextEdits) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs index 733c6d05bf4..938dc9dd91f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingContentValidationPass.cs @@ -18,10 +18,9 @@ internal sealed class FormattingContentValidationPass(ILoggerFactory loggerFacto // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; - public Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { var text = context.SourceText; - var edits = result.Edits; var changes = edits.Select(text.GetTextChange); var changedText = text.WithChanges(changes); @@ -49,9 +48,9 @@ public Task ExecuteAsync(FormattingContext context, Formatting Debug.Fail("A formatting result was rejected because it was going to change non-whitespace content in the document."); } - return Task.FromResult(new FormattingResult([])); + return Task.FromResult([]); } - return Task.FromResult(result); + return Task.FromResult(edits); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs index dbc058f4d1c..c223878de25 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs @@ -20,12 +20,11 @@ internal sealed class FormattingDiagnosticValidationPass(ILoggerFactory loggerFa // Internal for testing. internal bool DebugAssertsEnabled { get; set; } = true; - public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { var originalDiagnostics = context.CodeDocument.GetSyntaxTree().Diagnostics; var text = context.SourceText; - var edits = result.Edits; var changes = edits.Select(text.GetTextChange); var changedText = text.WithChanges(changes); var changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); @@ -56,10 +55,10 @@ public async Task ExecuteAsync(FormattingContext context, Form Debug.Fail("A formatting result was rejected because the formatted text produced different diagnostics compared to the original text."); } - return new FormattingResult([]); + return []; } - return result; + return edits; } private class LocationIgnoringDiagnosticComparer : IEqualityComparer diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs index f08b23a0e2e..a6b073acc22 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlFormattingPassBase.cs @@ -17,20 +17,18 @@ internal abstract class HtmlFormattingPassBase(ILogger logger) : IFormattingPass { private readonly ILogger _logger = logger; - public virtual async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public virtual async Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { var originalText = context.SourceText; - var htmlEdits = result.Edits; - var changedText = originalText; var changedContext = context; _logger.LogTestOnly($"Before HTML formatter:\r\n{changedText}"); - if (htmlEdits.Length > 0) + if (edits.Length > 0) { - var changes = htmlEdits.Select(originalText.GetTextChange); + var changes = edits.Select(originalText.GetTextChange); changedText = originalText.WithChanges(changes); // Create a new formatting context for the changed razor document. changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); @@ -49,7 +47,7 @@ public virtual async Task ExecuteAsync(FormattingContext conte var finalChanges = changedText.GetTextChanges(originalText); var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - return new FormattingResult(finalEdits); + return finalEdits; } private static List AdjustRazorIndentation(FormattingContext context) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs index 5f138ca9c18..e7cbf216806 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/HtmlOnTypeFormattingPass.cs @@ -4,6 +4,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; @@ -12,14 +13,14 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; ///
internal sealed class HtmlOnTypeFormattingPass(ILoggerFactory loggerFactory) : HtmlFormattingPassBase(loggerFactory.GetOrCreateLogger()) { - public override Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public override Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { - if (result.Edits.Length == 0) + if (edits.Length == 0) { // There are no HTML edits for us to apply. No op. - return Task.FromResult(new FormattingResult([])); + return Task.FromResult([]); } - return base.ExecuteAsync(context, result, cancellationToken); + return base.ExecuteAsync(context, edits, cancellationToken); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 64fa3046b54..66025be578d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -23,15 +23,15 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class RazorFormattingPass : IFormattingPass { - public async Task ExecuteAsync(FormattingContext context, FormattingResult result, CancellationToken cancellationToken) + public async Task ExecuteAsync(FormattingContext context, TextEdit[] edits, CancellationToken cancellationToken) { // Apply previous edits if any. var originalText = context.SourceText; var changedText = originalText; var changedContext = context; - if (result.Edits.Length > 0) + if (edits.Length > 0) { - var changes = result.Edits.Select(originalText.GetTextChange).ToArray(); + var changes = edits.Select(originalText.GetTextChange); changedText = changedText.WithChanges(changes); changedContext = await context.WithTextAsync(changedText).ConfigureAwait(false); @@ -40,16 +40,16 @@ public async Task ExecuteAsync(FormattingContext context, Form // Format the razor bits of the file var syntaxTree = changedContext.CodeDocument.GetSyntaxTree(); - var edits = FormatRazor(changedContext, syntaxTree); + var razorEdits = FormatRazor(changedContext, syntaxTree); // Compute the final combined set of edits - var formattingChanges = edits.Select(changedText.GetTextChange); + var formattingChanges = razorEdits.Select(changedText.GetTextChange); changedText = changedText.WithChanges(formattingChanges); var finalChanges = changedText.GetTextChanges(originalText); var finalEdits = finalChanges.Select(originalText.GetTextEdit).ToArray(); - return new FormattingResult(finalEdits); + return finalEdits; } private static ImmutableArray FormatRazor(FormattingContext context, RazorSyntaxTree syntaxTree) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 497c9c3f82d..1808203447f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -88,8 +88,7 @@ public async Task GetDocumentFormattingEditsAsync( using var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, _workspaceFactory); var originalText = context.SourceText; - var result = new FormattingResult(htmlEdits); - + var result = htmlEdits; foreach (var pass in _documentFormattingPasses) { cancellationToken.ThrowIfCancellationRequested(); @@ -97,8 +96,8 @@ public async Task GetDocumentFormattingEditsAsync( } var filteredEdits = range is null - ? result.Edits - : result.Edits.Where(e => range.LineOverlapsWith(e.Range)).ToArray(); + ? result + : result.Where(e => range.LineOverlapsWith(e.Range)).ToArray(); return originalText.NormalizeTextEdits(filteredEdits); } @@ -196,7 +195,7 @@ private async Task ApplyFormattedEditsAsync( var uri = documentContext.Uri; var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); using var context = FormattingContext.CreateForOnTypeFormatting(uri, documentSnapshot, codeDocument, options, _workspaceFactory, automaticallyAddUsings: automaticallyAddUsings, hostDocumentIndex, triggerCharacter); - var result = new FormattingResult(generatedDocumentEdits); + var result = generatedDocumentEdits; foreach (var pass in formattingPasses) { @@ -205,7 +204,7 @@ private async Task ApplyFormattedEditsAsync( } var originalText = context.SourceText; - var razorEdits = originalText.NormalizeTextEdits(result.Edits); + var razorEdits = originalText.NormalizeTextEdits(result); if (collapseEdits) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index becc4807f3f..9b46be8526e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -34,14 +34,14 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, " ") }; - var input = new FormattingResult(edits); + var input = edits; var pass = GetPass(); // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); + var result = await pass.ExecuteAsync(context, edits, DisposalToken); // Assert - Assert.Equal(input, result); + Assert.Same(input, result); } [Fact] @@ -58,14 +58,14 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, 3, 0, " ") // Nukes a line }; - var input = new FormattingResult(edits); + var input = edits; var pass = GetPass(); // Act var result = await pass.ExecuteAsync(context, input, DisposalToken); // Assert - Assert.Empty(result.Edits); + Assert.Empty(result); } private FormattingContentValidationPass GetPass() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index 82f92cfe499..b255405f917 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -32,14 +32,14 @@ public class Foo { } { VsLspFactory.CreateTextEdit(2, 0, " ") }; - var input = new FormattingResult(edits); + var input = edits; var pass = GetPass(); // Act var result = await pass.ExecuteAsync(context, input, DisposalToken); // Assert - Assert.Equal(input, result); + Assert.Same(input, result); } [Fact] @@ -53,14 +53,13 @@ public class Foo { } "); using var context = CreateFormattingContext(source); var badEdit = VsLspFactory.CreateTextEdit(position: (0, 0), "@ "); // Creates a diagnostic - var input = new FormattingResult([badEdit]); var pass = GetPass(); // Act - var result = await pass.ExecuteAsync(context, input, DisposalToken); + var result = await pass.ExecuteAsync(context, [badEdit], DisposalToken); // Assert - Assert.Empty(result.Edits); + Assert.Empty(result); } private FormattingDiagnosticValidationPass GetPass() From 3b2ba30db196cd18d18fe7130a8dc66a3e00ac2d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 22 Aug 2024 22:18:39 +1000 Subject: [PATCH 146/271] We can't tell the client which version we're applying edits for, because only we understand our version numbers --- .../CSharp/DefaultCSharpCodeActionResolver.cs | 5 +---- .../UnformattedRemappingCSharpCodeActionResolver.cs | 1 - .../AbstractTextDocumentPresentationEndpointBase.cs | 1 - .../DocumentMapping/AbstractEditMappingService.cs | 1 - .../LanguageClient/Endpoints/RazorCustomMessageTarget.cs | 4 +++- .../Endpoints/RazorCustomMessageTarget_CodeActions.cs | 9 ++------- .../Html/DefaultHtmlCodeActionProviderTest.cs | 2 -- .../Html/DefaultHtmlCodeActionResolverTest.cs | 2 -- 8 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 13c1f533431..d6d329ee899 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -89,12 +89,9 @@ public async override Task ResolveAsync( cancellationToken.ThrowIfCancellationRequested(); - var documentVersion = documentContext.Snapshot.Version; - var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { - Uri = csharpParams.RazorFileIdentifier.Uri, - Version = documentVersion, + Uri = csharpParams.RazorFileIdentifier.Uri }; resolvedCodeAction.Edit = new WorkspaceEdit() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs index 7e0e29d5499..170b4cd3417 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/UnformattedRemappingCSharpCodeActionResolver.cs @@ -87,7 +87,6 @@ public async override Task ResolveAsync( var codeDocumentIdentifier = new OptionalVersionedTextDocumentIdentifier() { Uri = csharpParams.RazorFileIdentifier.Uri, - Version = documentContext.Snapshot.Version, }; resolvedCodeAction.Edit = new WorkspaceEdit() { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs index 330dd3201d3..08e735ca3bd 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs @@ -176,7 +176,6 @@ private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, TextDocument = new OptionalVersionedTextDocumentIdentifier() { Uri = razorDocumentUri, - Version = hostDocumentVersion }, Edits = [.. remappedEdits] }); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs index a06a6ec3d52..7296deae4ec 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/DocumentMapping/AbstractEditMappingService.cs @@ -144,7 +144,6 @@ private async Task RemapTextDocumentEditsAsync(IDocumentSnap TextDocument = new OptionalVersionedTextDocumentIdentifier() { Uri = razorDocumentUri, - Version = documentContext.Snapshot.Version }, Edits = remappedEdits }); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs index 854c9fe04a6..406fbc3df4e 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget.cs @@ -153,7 +153,9 @@ private async Task> TrySynchronizeV if (!_languageServerFeatureOptions.IncludeProjectKeyInGeneratedFilePath || typeof(TVirtualDocumentSnapshot) == typeof(HtmlVirtualDocumentSnapshot)) { - return await _documentSynchronizer.TrySynchronizeVirtualDocumentAsync(requiredHostDocumentVersion, hostDocument.Uri, cancellationToken).ConfigureAwait(false); + var htmlResult = await _documentSynchronizer.TrySynchronizeVirtualDocumentAsync(requiredHostDocumentVersion, hostDocument.Uri, cancellationToken).ConfigureAwait(false); + _logger.LogDebug($"{(htmlResult.Synchronized ? "Did" : "Did NOT")} synchronize for {caller}: Version {requiredHostDocumentVersion} for {htmlResult.VirtualSnapshot?.Uri}"); + return htmlResult; } var virtualDocument = FindVirtualDocument(hostDocument.Uri, hostDocument.GetProjectContext()); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_CodeActions.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_CodeActions.cs index 60384baa0af..e8f5cd0af35 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_CodeActions.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_CodeActions.cs @@ -21,11 +21,6 @@ internal partial class RazorCustomMessageTarget [JsonRpcMethod(CustomMessageNames.RazorProvideCodeActionsEndpoint, UseSingleObjectParameterDeserialization = true)] public async Task?> ProvideCodeActionsAsync(DelegatedCodeActionParams codeActionParams, CancellationToken cancellationToken) { - if (codeActionParams is null) - { - throw new ArgumentNullException(nameof(codeActionParams)); - } - bool synchronized; VirtualDocumentSnapshot virtualDocumentSnapshot; string languageServerName; @@ -35,7 +30,7 @@ internal partial class RazorCustomMessageTarget codeActionParams.HostDocumentVersion, codeActionParams.CodeActionParams.TextDocument, cancellationToken).ConfigureAwait(false); - languageServerName = RazorLSPConstants.RazorCSharpLanguageServerName; + languageServerName = RazorLSPConstants.HtmlLanguageServerName; } else if (codeActionParams.LanguageKind == RazorLanguageKind.CSharp) { @@ -43,7 +38,7 @@ internal partial class RazorCustomMessageTarget codeActionParams.HostDocumentVersion, codeActionParams.CodeActionParams.TextDocument, cancellationToken).ConfigureAwait(false); - languageServerName = RazorLSPConstants.HtmlLanguageServerName; + languageServerName = RazorLSPConstants.RazorCSharpLanguageServerName; } else { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs index bddb160495e..631b6c927e3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs @@ -84,7 +84,6 @@ public async Task ProvideAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri(documentPath), - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(context.SourceText.GetRange(span), "Goo ~~~~~~~~~~~~~~~ Bar")] } @@ -111,7 +110,6 @@ public async Task ProvideAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri("c:/Test.razor.html"), - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Goo")] } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs index 480c4c9c633..09cc6992e1b 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionResolverTest.cs @@ -43,7 +43,6 @@ public async Task ResolveAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = documentUri, - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(sourceText.GetRange(span), "Goo ~~~~~~~~~~~~~~~ Bar")] } @@ -74,7 +73,6 @@ public async Task ResolveAsync_RemapsAndFixesEdits() TextDocument = new OptionalVersionedTextDocumentIdentifier { Uri = new Uri("c:/Test.razor.html"), - Version = 1 }, Edits = [VsLspFactory.CreateTextEdit(position: (0, 0), "Goo")] } From ec191f808a610273dbf89ce9787f688b396fbef8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 22 Aug 2024 12:43:45 +0000 Subject: [PATCH 147/271] Update dependencies from https://github.com/dotnet/arcade build 20240821.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24421.2 -> To Version 9.0.0-beta.24421.7 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 164590a0e40..32d95429dc7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 9b24668b7196b9639e60770465683cf81465d89a + c28c6307d0600513219bcd9ab028c0fedbe591ec - + https://github.com/dotnet/arcade - 9b24668b7196b9639e60770465683cf81465d89a + c28c6307d0600513219bcd9ab028c0fedbe591ec diff --git a/eng/Versions.props b/eng/Versions.props index bd3e90635a5..ae4b9220723 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24421.2 + 9.0.0-beta.24421.7 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 6ecd23f1777..e4b28452bbf 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.7", "Microsoft.Build.NoTargets": "3.7.0" } } From 6970dee51836818774930601fd2ace96fd8be7f0 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Thu, 22 Aug 2024 13:05:55 +0000 Subject: [PATCH 148/271] Update dependencies from https://github.com/dotnet/arcade build 20240821.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24413.2 -> To Version 8.0.0-beta.24421.4 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- eng/common/templates/steps/telemetry-start.yml | 2 +- global.json | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 228c071e3f0..a674ac10379 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 51321b7e150a2f426cb9e1334687bdfab68ec323 + 4460b755f3c7c89e9660d9580ff79afc4218dd85 - + https://github.com/dotnet/arcade - 51321b7e150a2f426cb9e1334687bdfab68ec323 + 4460b755f3c7c89e9660d9580ff79afc4218dd85 diff --git a/eng/Versions.props b/eng/Versions.props index 085902e05e4..76c5f9ea272 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24413.2 + 8.0.0-beta.24421.4 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index 32c01ef0b55..6abbcb33a67 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -8,7 +8,7 @@ parameters: steps: - ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: - - task: AzureKeyVault@1 + - task: AzureKeyVault@2 inputs: azureSubscription: 'HelixProd_KeyVault' KeyVaultName: HelixProdKV diff --git a/global.json b/global.json index 1734d1724cc..bbd507f30dc 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24413.2", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24421.4", "Microsoft.Build.NoTargets": "3.7.0" } } From 4124ce437058b8a8cc0e13d038114682266da860 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 23 Aug 2024 07:05:50 +1000 Subject: [PATCH 149/271] Remove unused parameter --- .../AbstractTextDocumentPresentationEndpointBase.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs index 08e735ca3bd..f3800209380 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/DocumentPresentation/AbstractTextDocumentPresentationEndpointBase.cs @@ -115,7 +115,7 @@ internal abstract class AbstractTextDocumentPresentationEndpointBase( // The responses we get back will be for virtual documents, so we have to map them back to the real // document, and in the case of C#, map the returned ranges too - var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument, documentContext.Snapshot.Version); + var edit = MapWorkspaceEdit(response, mapRanges: languageKind == RazorLanguageKind.CSharp, codeDocument); return edit; } @@ -149,7 +149,7 @@ private Dictionary MapChanges(Dictionary return remappedChanges; } - private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, bool mapRanges, RazorCodeDocument codeDocument, int hostDocumentVersion) + private TextDocumentEdit[] MapDocumentChanges(TextDocumentEdit[] documentEdits, bool mapRanges, RazorCodeDocument codeDocument) { using var remappedDocumentEdits = new PooledArrayBuilder(documentEdits.Length); foreach (var entry in documentEdits) @@ -206,12 +206,12 @@ private TextEdit[] MapTextEdits(bool mapRanges, RazorCodeDocument codeDocument, return mappedEdits.ToArray(); } - private WorkspaceEdit? MapWorkspaceEdit(WorkspaceEdit workspaceEdit, bool mapRanges, RazorCodeDocument codeDocument, int hostDocumentVersion) + private WorkspaceEdit? MapWorkspaceEdit(WorkspaceEdit workspaceEdit, bool mapRanges, RazorCodeDocument codeDocument) { if (workspaceEdit.TryGetTextDocumentEdits(out var documentEdits)) { // The LSP spec says, we should prefer `DocumentChanges` property over `Changes` if available. - var remappedEdits = MapDocumentChanges(documentEdits, mapRanges, codeDocument, hostDocumentVersion); + var remappedEdits = MapDocumentChanges(documentEdits, mapRanges, codeDocument); return new WorkspaceEdit() { DocumentChanges = remappedEdits From 587e72a2f2d172b1f7b44dd64842913686d5f956 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 23 Aug 2024 13:41:24 +1000 Subject: [PATCH 150/271] Simple PR feedback --- .../RazorCSharpFormattingBenchmark.cs | 2 +- .../DelegatedCompletionItemResolver.cs | 2 -- .../Formatting/HtmlFormatter.cs | 2 +- .../Formatting/CSharpFormatter.cs | 4 ++-- .../Passes/CSharpOnTypeFormattingPass.cs | 11 +++++------ .../Formatting/Passes/RazorFormattingPass.cs | 2 +- .../Formatting/RazorFormattingOptions.cs | 19 +++++++++---------- ...Microsoft.CodeAnalysis.Remote.Razor.csproj | 4 ---- .../FormattingDiagnosticValidationPassTest.cs | 2 +- 9 files changed, 20 insertions(+), 28 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 571eeb689ca..0b687fc006d 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -112,7 +112,7 @@ public async Task RazorCSharpFormattingAsync() { var documentContext = new VersionedDocumentContext(DocumentUri, DocumentSnapshot, projectContext: null, version: 1); - var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, [], range: null, RazorFormattingOptions.Default, CancellationToken.None); + var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits: [], range: null, RazorFormattingOptions.Default, CancellationToken.None); #if DEBUG // For debugging purposes only. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs index df02fe2cfe3..8fd531ccae4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Completion/Delegation/DelegatedCompletionItemResolver.cs @@ -6,13 +6,11 @@ using System.Linq; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; -using static Nerdbank.Streams.MultiplexingStream; namespace Microsoft.AspNetCore.Razor.LanguageServer.Completion.Delegation; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index 0522c8360ff..a20dde45416 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -89,7 +89,7 @@ public async Task GetOnTypeFormattingEditsAsync( public static TextEdit[] FixHtmlTextEdits(SourceText htmlSourceText, TextEdit[] edits) { // Avoid computing a minimal diff if we don't need to - if (!edits.Any(e => e.NewText.Contains("~"))) + if (!edits.Any(static e => e.NewText.Contains("~"))) return edits; return htmlSourceText.NormalizeTextEdits(edits); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs index defa18e3461..e0bd5a87211 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormatter.cs @@ -63,7 +63,7 @@ private static async Task GetFormattingEditsAsync(FormattingContext var root = await context.CSharpWorkspaceDocument.GetSyntaxRootAsync(cancellationToken).ConfigureAwait(false); Assumes.NotNull(root); - var changes = RazorCSharpFormattingInteractionService.GetFormattedTextChanges(context.CSharpWorkspace.Services, root, spanToFormat, context.Options.GetIndentationOptions(), cancellationToken); + var changes = RazorCSharpFormattingInteractionService.GetFormattedTextChanges(context.CSharpWorkspace.Services, root, spanToFormat, context.Options.ToIndentationOptions(), cancellationToken); var edits = changes.Select(csharpSourceText.GetTextEdit).ToArray(); return edits; @@ -85,7 +85,7 @@ private static async Task> GetCSharpIndentationCoreAsync(Fo // At this point, we have added all the necessary markers and attached annotations. // Let's invoke the C# formatter and hope for the best. - var formattedRoot = RazorCSharpFormattingInteractionService.Format(context.CSharpWorkspace.Services, root, context.Options.GetIndentationOptions(), cancellationToken); + var formattedRoot = RazorCSharpFormattingInteractionService.Format(context.CSharpWorkspace.Services, root, context.Options.ToIndentationOptions(), cancellationToken); var formattedText = formattedRoot.GetText(); var desiredIndentationMap = new Dictionary(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index 077aa630c83..5ce1e2b13bc 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -54,7 +54,7 @@ public async override Task ExecuteAsync(FormattingContext context, T context.CSharpWorkspaceDocument, typedChar: context.TriggerCharacter, projectedIndex, - context.Options.GetIndentationOptions(), + context.Options.ToIndentationOptions(), autoFormattingOptions, indentStyle: CodeAnalysis.Formatting.FormattingOptions.IndentStyle.Smart, cancellationToken).ConfigureAwait(false); @@ -84,7 +84,7 @@ public async override Task ExecuteAsync(FormattingContext context, T return edits; } } - + var normalizedEdits = csharpText.NormalizeTextEdits((TextEdit[])edits, out var originalTextWithChanges); var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits); var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); @@ -94,7 +94,6 @@ public async override Task ExecuteAsync(FormattingContext context, T // because they are non mappable, but might be the only thing changed (eg from the Add Using code action) // // If there aren't any edits that are likely to contain using statement changes, this call will no-op. - filteredEdits = await AddUsingStatementEditsIfNecessaryAsync(context, codeDocument, csharpText, edits, originalTextWithChanges, filteredEdits, cancellationToken).ConfigureAwait(false); return filteredEdits; @@ -217,7 +216,7 @@ private static async Task AddUsingStatementEditsIfNecessaryAsync(For if (context.AutomaticallyAddUsings) { // Because we need to parse the C# code twice for this operation, lets do a quick check to see if its even necessary - if (textEdits.Any(e => e.NewText.IndexOf("using") != -1)) + if (textEdits.Any(static e => e.NewText.IndexOf("using") != -1)) { var usingStatementEdits = await AddUsingsHelper.GetUsingStatementEditsAsync(codeDocument, csharpText, originalTextWithChanges, cancellationToken).ConfigureAwait(false); finalEdits = [.. usingStatementEdits, .. finalEdits]; @@ -340,7 +339,7 @@ private static void CleanupSourceMappingStart(FormattingContext context, Range s if (owner is CSharpStatementLiteralSyntax && owner.TryGetPreviousSibling(out var prevNode) && - prevNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + prevNode.FirstAncestorOrSelf(static a => a is CSharpTemplateBlockSyntax) is { } template && owner.SpanStart == template.Span.End && IsOnSingleLine(template, text)) { @@ -494,7 +493,7 @@ private static void CleanupSourceMappingEnd(FormattingContext context, Range sou if (owner is CSharpStatementLiteralSyntax && owner.NextSpan() is { } nextNode && - nextNode.FirstAncestorOrSelf(a => a is CSharpTemplateBlockSyntax) is { } template && + nextNode.FirstAncestorOrSelf(static a => a is CSharpTemplateBlockSyntax) is { } template && template.SpanStart == owner.Span.End && IsOnSingleLine(template, text)) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs index 66025be578d..82224f34c16 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/RazorFormattingPass.cs @@ -411,7 +411,7 @@ closeBraceRange is not null && return didFormat; - static bool RangeHasBeenModified(ref PooledArrayBuilder edits, Range range) + static bool RangeHasBeenModified(ref readonly PooledArrayBuilder edits, Range range) { // Because we don't always know what kind of Razor object we're operating on we have to do this to avoid duplicate edits. // The other way to accomplish this would be to apply the edits after every node and function, but that's not in scope for my current work. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs index f830202a3b4..fd7125c6205 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -6,18 +6,17 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed record RazorFormattingOptions +internal record struct RazorFormattingOptions { - public bool InsertSpaces { get; init; } - public int TabSize { get; init; } - public bool CodeBlockBraceOnNextLine { get; init; } + public static readonly RazorFormattingOptions Default = new(); - public static RazorFormattingOptions Default => new RazorFormattingOptions() + public bool InsertSpaces { get; init; } = true; + public int TabSize { get; init; } = 4; + public bool CodeBlockBraceOnNextLine { get; init; } = false; + + public RazorFormattingOptions() { - InsertSpaces = true, - TabSize = 4, - CodeBlockBraceOnNextLine = false - }; + } public static RazorFormattingOptions From(FormattingOptions options, bool codeBlockBraceOnNextLine) { @@ -29,7 +28,7 @@ public static RazorFormattingOptions From(FormattingOptions options, bool codeBl }; } - public RazorIndentationOptions GetIndentationOptions() + public RazorIndentationOptions ToIndentationOptions() => new( UseTabs: !InsertSpaces, TabSize: TabSize, 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 index 60cd914522e..3357fd1eb79 100644 --- 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 @@ -57,8 +57,4 @@ - - - - diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index b255405f917..d232aeffdb7 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -95,7 +95,7 @@ private static (RazorCodeDocument, IDocumentSnapshot) CreateCodeDocumentAndSnaps var projectEngine = RazorProjectEngine.Create(builder => builder.SetRootNamespace("Test")); var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, importSources: default, tagHelpers); - var documentSnapshot = FormattingTestBase.CreateDocumentSnapshot(path, tagHelpers, fileKind, [], [], projectEngine, codeDocument); + var documentSnapshot = FormattingTestBase.CreateDocumentSnapshot(path, tagHelpers, fileKind, importsDocuments: [], imports: [], projectEngine, codeDocument); return (codeDocument, documentSnapshot); } From 6622a0f979bea9aaa739a68b0dfa113cfe8a0895 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 23 Aug 2024 13:53:55 +1000 Subject: [PATCH 151/271] Missed the readonly bit --- .../Formatting/RazorFormattingOptions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs index fd7125c6205..a0397ec80f5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -6,7 +6,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal record struct RazorFormattingOptions +internal readonly record struct RazorFormattingOptions { public static readonly RazorFormattingOptions Default = new(); From 2157169d4d1d7d514503a8616a28745d589c4a9b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 23 Aug 2024 16:24:43 +1000 Subject: [PATCH 152/271] More PR feedback --- .../DocumentOnTypeFormattingEndpoint.cs | 26 ++++++++++----- .../InlineCompletionEndPoint.cs | 5 +-- .../Formatting/FormattingContext.cs | 2 +- .../DocumentOnTypeFormattingEndpointTest.cs | 32 +++++++++++++++++++ .../FormattingLanguageServerTestBase.cs | 1 + 5 files changed, 55 insertions(+), 11 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 20488c36a11..e72d79f83ce 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Frozen; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics; using System.Linq; using System.Threading; @@ -35,9 +36,11 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - private static readonly FrozenSet s_csharpTriggerCharacters = FrozenSet.ToFrozenSet(["}", ";"]); - private static readonly FrozenSet s_htmlTriggerCharacters = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"]); - private static readonly FrozenSet s_allTriggerCharacters = FrozenSet.ToFrozenSet(s_csharpTriggerCharacters.Concat(s_htmlTriggerCharacters)); + private static readonly ImmutableArray s_allTriggerCharacters = ["}", ";", "\n", "{"]; + + private static readonly FrozenSet s_csharpTriggerCharacterSet = FrozenSet.ToFrozenSet(["}", ";"], StringComparer.Ordinal); + private static readonly FrozenSet s_htmlTriggerCharacterSet = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"], StringComparer.Ordinal); + private static readonly FrozenSet s_allTriggerCharacterSet = s_allTriggerCharacters.ToFrozenSet(StringComparer.Ordinal); public bool MutatesSolutionState => false; @@ -45,8 +48,8 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V { serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { - FirstTriggerCharacter = s_allTriggerCharacters.First(), - MoreTriggerCharacter = s_allTriggerCharacters.Skip(1).ToArray(), + FirstTriggerCharacter = s_allTriggerCharacters[0], + MoreTriggerCharacter = s_allTriggerCharacters.AsSpan()[1..].ToArray(), }; } @@ -71,7 +74,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting return null; } - if (!s_allTriggerCharacters.Contains(request.Character, StringComparer.Ordinal)) + if (!s_allTriggerCharacterSet.Contains(request.Character)) { _logger.LogWarning($"Unexpected trigger character '{request.Character}'."); return null; @@ -149,14 +152,21 @@ private static bool IsApplicableTriggerCharacter(string triggerCharacter, RazorL { if (languageKind == RazorLanguageKind.CSharp) { - return s_csharpTriggerCharacters.Contains(triggerCharacter); + return s_csharpTriggerCharacterSet.Contains(triggerCharacter); } else if (languageKind == RazorLanguageKind.Html) { - return s_htmlTriggerCharacters.Contains(triggerCharacter); + return s_htmlTriggerCharacterSet.Contains(triggerCharacter); } // Unknown trigger character. return false; } + + internal static class TestAccessor + { + public static ImmutableArray GetAllTriggerCharacters() => s_allTriggerCharacters; + public static FrozenSet GetCSharpTriggerCharacterSet() => s_csharpTriggerCharacterSet; + public static FrozenSet GetHtmlTriggerCharacterSet() => s_htmlTriggerCharacterSet; + } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 779cc1eb048..1efda4e511d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -13,6 +13,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; @@ -113,7 +114,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti return null; } - var items = new List(); + using var items = new PooledArrayBuilder(list.Items.Length); foreach (var item in list.Items) { var containsSnippet = item.TextFormat == InsertTextFormat.Snippet; @@ -152,7 +153,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti _logger.LogInformation($"Returning {items.Count} items."); return new VSInternalInlineCompletionList { - Items = [.. items] + Items = items.ToArray() }; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index 328bfada28f..39d2bba962c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -221,7 +221,7 @@ public bool TryGetFormattingSpan(int absoluteIndex, [NotNullWhen(true)] out Form { result = null; var formattingSpans = GetFormattingSpans(); - foreach (var formattingSpan in formattingSpans) + foreach (var formattingSpan in formattingSpans.AsEnumerable()) { var span = formattingSpan.Span; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 0dd606e64b0..a84829c38ce 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -18,6 +19,37 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput) : FormattingLanguageServerTestBase(testOutput) { + [Fact] + public void AllTriggerCharacters_IncludesCSharpTriggerCharacters() + { + var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); + + foreach (var character in DocumentOnTypeFormattingEndpoint.TestAccessor.GetCSharpTriggerCharacterSet()) + { + Assert.Contains(character, allChars); + } + } + + [Fact] + public void AllTriggerCharacters_IncludesHtmlTriggerCharacters() + { + var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); + + foreach (var character in DocumentOnTypeFormattingEndpoint.TestAccessor.GetHtmlTriggerCharacterSet()) + { + Assert.Contains(character, allChars); + } + } + + [Fact] + public void AllTriggerCharacters_ContainsUniqueCharacters() + { + var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); + var distinctChars = allChars.Distinct().ToArray(); + + Assert.Equal(distinctChars, allChars); + } + [Fact] public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index 0fdf80733dd..4d9f3991a0f 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; From 79d0c3ca94f3f2c65748fe76ba754035353056e8 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Fri, 23 Aug 2024 12:13:16 +0000 Subject: [PATCH 153/271] Failed to perform coherency update for one or more dependencies. From e841c0e5eedbd2c2bdfff009281f73b7d2d52a6f Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sat, 24 Aug 2024 12:41:50 +0000 Subject: [PATCH 154/271] Update dependencies from https://github.com/dotnet/arcade build 20240823.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24421.7 -> To Version 9.0.0-beta.24423.2 --- eng/Version.Details.xml | 8 +- eng/Versions.props | 2 +- eng/common/core-templates/job/job.yml | 5 -- eng/common/internal/Tools.csproj | 1 + eng/common/templates-official/job/job.yml | 14 ++++ eng/common/templates/job/job.yml | 96 +++++++++++------------ global.json | 2 +- 7 files changed, 65 insertions(+), 63 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 32d95429dc7..0e7d73da173 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + 91599268652b51969b8d8088d4f2f2ba7b3ebb19 - + https://github.com/dotnet/arcade - c28c6307d0600513219bcd9ab028c0fedbe591ec + 91599268652b51969b8d8088d4f2f2ba7b3ebb19 diff --git a/eng/Versions.props b/eng/Versions.props index ae4b9220723..1f645fc437c 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24421.7 + 9.0.0-beta.24423.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/eng/common/core-templates/job/job.yml b/eng/common/core-templates/job/job.yml index c732bee9f4a..ba53ebfbd51 100644 --- a/eng/common/core-templates/job/job.yml +++ b/eng/common/core-templates/job/job.yml @@ -33,11 +33,6 @@ parameters: artifactPublishSteps: [] runAsPublic: false -# Sbom related params - enableSbom: true - PackageVersion: 9.0.0 - BuildDropPath: '$(Build.SourcesDirectory)/artifacts' - # 1es specific parameters is1ESPipeline: '' diff --git a/eng/common/internal/Tools.csproj b/eng/common/internal/Tools.csproj index e925952d566..32f79dfb340 100644 --- a/eng/common/internal/Tools.csproj +++ b/eng/common/internal/Tools.csproj @@ -4,6 +4,7 @@ net472 false + false diff --git a/eng/common/templates-official/job/job.yml b/eng/common/templates-official/job/job.yml index 0c2928d5c79..3d16b41c78c 100644 --- a/eng/common/templates-official/job/job.yml +++ b/eng/common/templates-official/job/job.yml @@ -1,8 +1,22 @@ +parameters: +# Sbom related params + enableSbom: true + PackageVersion: 9.0.0 + BuildDropPath: '$(Build.SourcesDirectory)/artifacts' + jobs: - template: /eng/common/core-templates/job/job.yml parameters: is1ESPipeline: true + componentGovernanceSteps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: + - template: /eng/common/templates/steps/generate-sbom.yml + parameters: + PackageVersion: ${{ parameters.packageVersion }} + BuildDropPath: ${{ parameters.buildDropPath }} + publishArtifacts: false + # publish artifacts # for 1ES managed templates, use the templateContext.output to handle multiple outputs. templateContext: diff --git a/eng/common/templates/job/job.yml b/eng/common/templates/job/job.yml index 8da477dd69f..07d317bf8f9 100644 --- a/eng/common/templates/job/job.yml +++ b/eng/common/templates/job/job.yml @@ -19,71 +19,63 @@ jobs: steps: - ${{ each step in parameters.steps }}: - ${{ step }} - + componentGovernanceSteps: - - template: /eng/common/templates/steps/component-governance.yml - parameters: - ${{ if eq(parameters.disableComponentGovernance, '') }}: - ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: - disableComponentGovernance: false - ${{ else }}: - disableComponentGovernance: true + - template: /eng/common/templates/steps/component-governance.yml + parameters: + ${{ if eq(parameters.disableComponentGovernance, '') }}: + ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.runAsPublic, 'false'), or(startsWith(variables['Build.SourceBranch'], 'refs/heads/release/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/dotnet/'), startsWith(variables['Build.SourceBranch'], 'refs/heads/microsoft/'), eq(variables['Build.SourceBranch'], 'refs/heads/main'))) }}: + disableComponentGovernance: false ${{ else }}: - disableComponentGovernance: ${{ parameters.disableComponentGovernance }} - componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} - - - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest'), eq(parameters.enableSbom, 'true')) }}: - - template: /eng/common/templates/steps/generate-sbom.yml - parameters: - PackageVersion: ${{ parameters.packageVersion }} - BuildDropPath: ${{ parameters.buildDropPath }} - publishArtifacts: false - + disableComponentGovernance: true + ${{ else }}: + disableComponentGovernance: ${{ parameters.disableComponentGovernance }} + componentGovernanceIgnoreDirectories: ${{ parameters.componentGovernanceIgnoreDirectories }} artifactPublishSteps: - - ${{ if ne(parameters.artifacts.publish, '') }}: - - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - - template: /eng/common/core-templates/steps/publish-build-artifacts.yml - parameters: - is1ESPipeline: false - args: - displayName: Publish pipeline artifacts - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' - publishLocation: Container - artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} - continueOnError: true - condition: always() - - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml - parameters: - is1ESPipeline: false - args: - targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' - artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} - displayName: 'Publish logs' - continueOnError: true - condition: always() - sbomEnabled: false # we don't need SBOM for logs - - - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - ${{ if ne(parameters.artifacts.publish, '') }}: + - ${{ if and(ne(parameters.artifacts.publish.artifacts, 'false'), ne(parameters.artifacts.publish.artifacts, '')) }}: - template: /eng/common/core-templates/steps/publish-build-artifacts.yml parameters: is1ESPipeline: false args: - displayName: Publish Logs - pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + displayName: Publish pipeline artifacts + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts' publishLocation: Container - artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + artifactName: ${{ coalesce(parameters.artifacts.publish.artifacts.name , 'Artifacts_$(Agent.Os)_$(_BuildConfig)') }} continueOnError: true condition: always() - - - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - ${{ if and(ne(parameters.artifacts.publish.logs, 'false'), ne(parameters.artifacts.publish.logs, '')) }}: - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml parameters: is1ESPipeline: false args: - targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' - artifactName: 'BuildConfiguration' - displayName: 'Publish build retry configuration' + targetPath: '$(Build.ArtifactStagingDirectory)/artifacts/log' + artifactName: ${{ coalesce(parameters.artifacts.publish.logs.name, 'Logs_Build_$(Agent.Os)_$(_BuildConfig)') }} + displayName: 'Publish logs' continueOnError: true - sbomEnabled: false # we don't need SBOM for BuildConfiguration + condition: always() + sbomEnabled: false # we don't need SBOM for logs + + - ${{ if ne(parameters.enablePublishBuildArtifacts, 'false') }}: + - template: /eng/common/core-templates/steps/publish-build-artifacts.yml + parameters: + is1ESPipeline: false + args: + displayName: Publish Logs + pathToPublish: '$(Build.ArtifactStagingDirectory)/artifacts/log/$(_BuildConfig)' + publishLocation: Container + artifactName: ${{ coalesce(parameters.enablePublishBuildArtifacts.artifactName, '$(Agent.Os)_$(Agent.JobName)' ) }} + continueOnError: true + condition: always() + + - ${{ if eq(parameters.enableBuildRetry, 'true') }}: + - template: /eng/common/core-templates/steps/publish-pipeline-artifacts.yml + parameters: + is1ESPipeline: false + args: + targetPath: '$(Build.SourcesDirectory)\eng\common\BuildConfiguration' + artifactName: 'BuildConfiguration' + displayName: 'Publish build retry configuration' + continueOnError: true + sbomEnabled: false # we don't need SBOM for BuildConfiguration diff --git a/global.json b/global.json index e4b28452bbf..865ef90d330 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24421.7", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24423.2", "Microsoft.Build.NoTargets": "3.7.0" } } From 286b3e180f37046d47e4df65d134c7638453e3b1 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Sun, 25 Aug 2024 12:03:40 +0000 Subject: [PATCH 155/271] Failed to perform coherency update for one or more dependencies. From aeca1e4a279306b46127daa417edb2544a07604c Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 26 Aug 2024 12:59:41 +1000 Subject: [PATCH 156/271] Don't crash because another team has a bad assumption --- .../VisualStudioLogging.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs index 6172ec66877..d9cea544a10 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs @@ -89,7 +89,14 @@ private static void FeedbackLoggerInternal(string filePath, params string[] expe var files = new List(); foreach (var feedbackFileProvider in feedbackFileProviders) { - files.AddRange(feedbackFileProvider.GetFiles()); + try + { + files.AddRange(feedbackFileProvider.GetFiles()); + } + catch + { + // If one of the providers has issues, we don't want it causing us to not be able to report our stuff properly + } } _ = CollectFeedbackItemsAsync(files, filePath, expectedFileParts); From cdcef8e7305782b646e93600a706451ca1694485 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 26 Aug 2024 12:59:55 +1000 Subject: [PATCH 157/271] Force "Insert Spaces" to be true for Razor documents --- .../AbstractRazorEditorTest.cs | 3 +++ .../InProcess/ShellInProcess.cs | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs index 54c9c11d2c6..a2017ae8d96 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs @@ -44,6 +44,9 @@ public override async Task InitializeAsync() VisualStudioLogging.AddCustomLoggers(); + // Our expected test results have spaces not tabs + await TestServices.Shell.SetInsertSpacesAsync(ControlledHangMitigatingCancellationToken); + _projectFilePath = await CreateAndOpenBlazorProjectAsync(ControlledHangMitigatingCancellationToken); await TestServices.SolutionExplorer.RestoreNuGetPackagesAsync(ControlledHangMitigatingCancellationToken); diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs index efdf2a1b200..c7867c4a50f 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs @@ -4,7 +4,10 @@ using System.IO; using System.Threading; using System.Threading.Tasks; +using Microsoft.VisualStudio.Razor; using Microsoft.VisualStudio.Shell.Interop; +using Microsoft.VisualStudio.TextManager.Interop; +using Xunit; namespace Microsoft.VisualStudio.Extensibility.Testing; @@ -22,4 +25,16 @@ public async Task GetActiveDocumentFileNameAsync(CancellationToken cance var documentPath = (string)documentPathObj; return Path.GetFileName(documentPath); } + + public async Task SetInsertSpacesAsync(CancellationToken cancellationToken) + { + var textManager = await GetRequiredGlobalServiceAsync(cancellationToken); + + var langPrefs3 = new LANGPREFERENCES3[] { new LANGPREFERENCES3() { guidLang = RazorConstants.RazorLanguageServiceGuid } }; + Assert.Equal(VSConstants.S_OK, textManager.GetUserPreferences4(null, langPrefs3, null)); + + langPrefs3[0].fInsertTabs = 0; + + Assert.Equal(VSConstants.S_OK, textManager.SetUserPreferences4(null, langPrefs3, null)); + } } From 5ca996484489cc4c457852ea082ad19514e8a009 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 26 Aug 2024 12:52:05 +0000 Subject: [PATCH 158/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240821.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24419.1 -> To Version 10.0.0-alpha.1.24421.1 --- NuGet.config | 2 +- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/NuGet.config b/NuGet.config index ad74bb028db..7a818f5f188 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,4 +1,4 @@ - + diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index e555ce85160..6eecf640008 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - c818c3cf018e7aa9fd31f6aed5d14e9b59f03e4f + bdd698774daa248301c236f09b97015610ca2842 diff --git a/eng/Versions.props b/eng/Versions.props index b2e0c582bcf..29508bb3e05 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 10.0.0-alpha.1.24419.1 + 10.0.0-alpha.1.24421.1 9.0.0-beta.24352.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From aa024eb33f3c92f3466167118451f300a4669832 Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Mon, 26 Aug 2024 10:14:26 -0700 Subject: [PATCH 159/271] [FUSE] Provide intellisense for @inject directives (#10771) * When @Inject is missing the member name, generate a syntactically valid c# identifier so we get intellisense * Emit an empty section when there is no typename * Add tests and update baselines --- .../CodeGenerationIntegrationTest.cs | 24 +++++++++ .../IncompleteDirectives_DesignTime.ir.txt | 3 ++ .../IncompleteDirectives_Runtime.codegen.cs | 40 +++++++++------ ...completeDirectives_Runtime.diagnostics.txt | 12 ++--- .../IncompleteDirectives_Runtime.ir.txt | 51 +++++++------------ .../IncompleteDirectives_Runtime.mappings.txt | 15 ++++++ .../IncompleteDirectives_DesignTime.ir.txt | 3 ++ .../IncompleteDirectives_Runtime.codegen.cs | 16 ++++++ .../IncompleteDirectives_Runtime.ir.txt | 3 ++ .../IncompleteDirectives_DesignTime.ir.txt | 3 ++ .../IncompleteDirectives_Runtime.codegen.cs | 23 +++++++++ .../IncompleteDirectives_Runtime.ir.txt | 3 ++ .../ComponentDirectiveIntegrationTest.cs | 17 +++++++ .../ComponentInjectDirectivePass.cs | 36 ++++++++----- .../ComponentInjectIntermediateNode.cs | 38 ++++++++++---- .../DefaultTagHelperTargetExtension.cs | 19 ++++--- .../src/Language/SourceSpan.cs | 5 ++ .../src/Mvc.Version1_X/InjectDirective.cs | 36 ++++++++----- .../Mvc.Version1_X/InjectIntermediateNode.cs | 3 ++ .../Mvc.Version1_X/InjectTargetExtension.cs | 16 ++++-- .../src/Mvc.Version2_X/InjectDirective.cs | 36 ++++++++----- .../Mvc.Version2_X/InjectIntermediateNode.cs | 3 ++ .../Mvc.Version2_X/InjectTargetExtension.cs | 16 ++++-- .../src/Mvc/InjectDirective.cs | 36 ++++++++----- .../src/Mvc/InjectIntermediateNode.cs | 3 ++ .../src/Mvc/InjectTargetExtension.cs | 16 ++++-- .../RazorIntegrationTestBase.cs | 12 +++++ 27 files changed, 355 insertions(+), 133 deletions(-) create mode 100644 src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs index 0e1e4627bb0..88bd6ed87e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/IntegrationTests/CodeGenerationIntegrationTest.cs @@ -69,6 +69,30 @@ public class MyService Assert.NotEmpty(compiled.CodeDocument.GetCSharpDocument().Diagnostics); } + [Fact] + public void IncompleteDirectives_Runtime() + { + // Arrange + AddCSharpSyntaxTree(@" +public class MyService +{ + public string Html { get; set; } +}"); + + var projectItem = CreateProjectItemFromFile(); + + // Act + var compiled = CompileToCSharp(projectItem, designTime: false); + + // Assert + AssertDocumentNodeMatchesBaseline(compiled.CodeDocument.GetDocumentIntermediateNode()); + AssertCSharpDocumentMatchesBaseline(compiled.CodeDocument.GetCSharpDocument()); + AssertSourceMappingsMatchBaseline(compiled.CodeDocument); + + // We expect this test to generate a bunch of errors. + Assert.True(compiled.CodeDocument.GetCSharpDocument().Diagnostics.Length > 0); + } + [Fact] public void InheritsViewModel_DesignTime() { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index 253d706c049..df783862963 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -60,3 +60,6 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index c87e4aaf402..470f2a28c4d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,9 +1,10 @@ -#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "844eb91b909a14b78feddd5e6866563b5a75e021" +#pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c83d1c26cf039a87fc6aedc860fd9d28a34d96dfb2e405e6af3918602ca27755" // #pragma warning disable 1591 +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] namespace AspNetCore { - #line hidden + #line default using System; using System.Collections.Generic; using System.Linq; @@ -11,31 +12,38 @@ namespace AspNetCore using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Rendering; using Microsoft.AspNetCore.Mvc.ViewFeatures; - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + #line default + #line hidden + [global::Microsoft.AspNetCore.Razor.Hosting.RazorSourceChecksumAttribute(@"Sha256", @"c83d1c26cf039a87fc6aedc860fd9d28a34d96dfb2e405e6af3918602ca27755", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] + public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage { #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { - BeginContext(83, 4, true); - WriteLiteral("\r\n\r\n"); - EndContext(); - BeginContext(93, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(102, 4, true); + WriteLiteral("\r\n"); WriteLiteral("\r\n\r\n"); - EndContext(); - BeginContext(113, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(123, 2, true); WriteLiteral("\r\n"); - EndContext(); - BeginContext(150, 2, true); WriteLiteral("\r\n"); - EndContext(); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#line (8,9)-(8,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden + Member_test { get; private set; } +#line (7,9)-(7,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#line (6,8)-(6,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt index 34210018b66..d70ab96ce6e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.diagnostics.txt @@ -1,6 +1,6 @@ -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ9999: The 'model' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ9999: The 'model' directive may only occur once per document. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ9999: The 'model' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ9999: The 'inject' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ9999: The 'inject' directive expects a type name. -TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ9999: The 'inject' directive expects an identifier. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(3,7): Error RZ1013: The 'model' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,1): Error RZ2001: The 'model' directive may only occur once per document. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(4,8): Error RZ1013: The 'model' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(6,8): Error RZ1013: The 'inject' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(7,9): Error RZ1013: The 'inject' directive expects a type name. +TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml(8,26): Error RZ1015: The 'inject' directive expects an identifier. diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index e1132db9c42..88b3a491c57 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,4 +1,5 @@ Document - + RazorCompiledItemAttribute - NamespaceDeclaration - - AspNetCore UsingDirective - (1:0,1 [14] ) - System UsingDirective - (16:1,1 [34] ) - System.Collections.Generic @@ -7,50 +8,36 @@ UsingDirective - (102:4,1 [32] ) - Microsoft.AspNetCore.Mvc UsingDirective - (135:5,1 [42] ) - Microsoft.AspNetCore.Mvc.Rendering UsingDirective - (178:6,1 [45] ) - Microsoft.AspNetCore.Mvc.ViewFeatures - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives_cshtml - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + RazorSourceChecksumAttribute - + ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync - CSharpCode - - IntermediateToken - - CSharp - BeginContext(83, 4, true); - HtmlContent - (83:0,83 [4] IncompleteDirectives.cshtml) - IntermediateToken - (83:0,83 [4] IncompleteDirectives.cshtml) - Html - \n\n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) + LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (87:2,0 [6] IncompleteDirectives.cshtml) - model - CSharpCode - - IntermediateToken - - CSharp - BeginContext(93, 2, true); + CSharpCode - (93:2,6 [0] IncompleteDirectives.cshtml) + LazyIntermediateToken - (93:2,6 [0] IncompleteDirectives.cshtml) - CSharp - HtmlContent - (93:2,6 [2] IncompleteDirectives.cshtml) - IntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (93:2,6 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (95:3,0 [7] IncompleteDirectives.cshtml) - model - CSharpCode - - IntermediateToken - - CSharp - BeginContext(102, 4, true); + DirectiveToken - (102:3,7 [0] IncompleteDirectives.cshtml) - HtmlContent - (102:3,7 [4] IncompleteDirectives.cshtml) - IntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (102:3,7 [4] IncompleteDirectives.cshtml) - Html - \n\n MalformedDirective - (106:5,0 [7] IncompleteDirectives.cshtml) - inject - CSharpCode - - IntermediateToken - - CSharp - BeginContext(113, 2, true); + CSharpCode - (113:5,7 [0] IncompleteDirectives.cshtml) + LazyIntermediateToken - (113:5,7 [0] IncompleteDirectives.cshtml) - CSharp - HtmlContent - (113:5,7 [2] IncompleteDirectives.cshtml) - IntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (113:5,7 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (115:6,0 [8] IncompleteDirectives.cshtml) - inject - CSharpCode - - IntermediateToken - - CSharp - BeginContext(123, 2, true); + DirectiveToken - (123:6,8 [0] IncompleteDirectives.cshtml) - HtmlContent - (123:6,8 [2] IncompleteDirectives.cshtml) - IntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (123:6,8 [2] IncompleteDirectives.cshtml) - Html - \n MalformedDirective - (125:7,0 [25] IncompleteDirectives.cshtml) - inject DirectiveToken - (133:7,8 [17] IncompleteDirectives.cshtml) - MyService - CSharpCode - - IntermediateToken - - CSharp - BeginContext(150, 2, true); HtmlContent - (150:7,25 [2] IncompleteDirectives.cshtml) - IntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n - CSharpCode - - IntermediateToken - - CSharp - EndContext(); + LazyIntermediateToken - (150:7,25 [2] IncompleteDirectives.cshtml) - Html - \n + Inject - + Inject - + Inject - Inject - Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt new file mode 100644 index 00000000000..61ba7c7637a --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt @@ -0,0 +1,15 @@ +Source Location: (133:7,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|MyService| +Generated Location: (1895:33,0 [9] ) +|MyService| + +Source Location: (123:6,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|| +Generated Location: (2096:39,0 [0] ) +|| + +Source Location: (113:5,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) +|| +Generated Location: (2233:43,0 [0] ) +|| + diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index dd224f999b7..8831c20bbbc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -76,6 +76,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 7c3e56d4eb1..4044c13d2f1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -50,6 +50,22 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete EndContext(); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#line (12,9)-(12,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden + Member_test { get; private set; } +#line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#line (10,8)-(10,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index e19bd0c0c47..6216dbe0d33 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -91,6 +91,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - public global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData; CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index 1c2c8770560..61e677a4eb7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -78,6 +78,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - #nullable restore\npublic global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData!;\n#nullable disable CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 7ec2b156f5d..641f07ac3e4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -35,6 +35,29 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete WriteLiteral("\r\n"); } #pragma warning restore 1998 + [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] + public +#nullable restore +#line (12,9)-(12,18) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" +MyService + +#line default +#line hidden +#nullable disable + Member_test { get; private set; } + = default!; +#nullable restore +#line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#nullable disable +#nullable restore +#line (10,8)-(10,8) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" + +#line default +#line hidden +#nullable disable #nullable restore [global::Microsoft.AspNetCore.Mvc.Razor.Internal.RazorInjectAttribute] public global::Microsoft.AspNetCore.Mvc.ViewFeatures.IModelExpressionProvider ModelExpressionProvider { get; private set; } = default!; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index 3ebf9018448..11e2588b30a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -55,6 +55,9 @@ Inject - Inject - Inject - + Inject - + Inject - + Inject - CSharpCode - IntermediateToken - - CSharp - #nullable restore\npublic global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary ViewData => (global::Microsoft.AspNetCore.Mvc.ViewFeatures.ViewDataDictionary)PageContext?.ViewData!;\n#nullable disable CSharpCode - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs index 703bf8dffb7..3c9f0249c0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentDirectiveIntegrationTest.cs @@ -100,6 +100,23 @@ public void SupportsInjectDirective() s => AssertEx.Equal("private TestNamespace.IMyService2 Test.TestComponent.MyService2 { get; set; }", s.ToTestDisplayString())); } + [Fact] + public void SupportsIncompleteInjectDirectives() + { + var component = CompileToComponent(""" + @inject + @inject DateTime + @inject DateTime Value + """); + + // Assert 1: Compiled type has correct properties + var injectableProperties = component.GetMembers().OfType() + .Where(p => p.GetAttributes().Any(a => a.AttributeClass.Name == "InjectAttribute")); + Assert.Collection(injectableProperties.OrderBy(p => p.Name), + s => AssertEx.Equal("private System.DateTime Test.TestComponent.Member___UniqueIdSuppressedForTesting__ { get; set; }", s.ToTestDisplayString()), + s => AssertEx.Equal("private System.DateTime Test.TestComponent.Value { get; set; }", s.ToTestDisplayString())); + } + private const string AdditionalCode = """ using Microsoft.AspNetCore.Components; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs index b5e7a0afb1f..0cbf25785f7 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectDirectivePass.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -25,30 +26,31 @@ protected override void ExecuteCore( for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } - classNode.Children.Add(new ComponentInjectIntermediateNode(typeName, memberName, typeSpan, memberSpan)); + classNode.Children.Add(new ComponentInjectIntermediateNode(typeName, memberName, typeSpan, memberSpan, isMalformed)); } } private class Visitor : IntermediateNodeWalker { - public IList Directives { get; } - = new List(); + public IList Directives { get; } = []; public override void VisitDirective(DirectiveIntermediateNode node) { @@ -57,5 +59,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == ComponentInjectDirective.Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs index 13812ccf59c..3642e635ce1 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentInjectIntermediateNode.cs @@ -6,6 +6,7 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; using Microsoft.AspNetCore.Razor.Language.Intermediate; namespace Microsoft.AspNetCore.Razor.Language.Components; @@ -18,13 +19,14 @@ internal class ComponentInjectIntermediateNode : ExtensionIntermediateNode "private" // Encapsulation is the default }; - public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan) + public ComponentInjectIntermediateNode(string typeName, string memberName, SourceSpan? typeSpan, SourceSpan? memberSpan, bool isMalformed) { TypeName = typeName; MemberName = memberName; TypeSpan = typeSpan; MemberSpan = memberSpan; - } + IsMalformed = isMalformed; + } public string TypeName { get; } @@ -34,8 +36,9 @@ public ComponentInjectIntermediateNode(string typeName, string memberName, Sourc public SourceSpan? MemberSpan { get; } - public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; + public bool IsMalformed { get; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) { @@ -59,13 +62,26 @@ public override void WriteNode(CodeTarget target, CodeRenderingContext context) throw new ArgumentNullException(nameof(context)); } - context.CodeWriter.WriteAutoPropertyDeclaration( - _injectedPropertyModifiers, - TypeName, - MemberName, - TypeSpan, - MemberSpan, - context, - defaultValue: true); + if (TypeName == string.Empty && TypeSpan.HasValue && !context.Options.DesignTime) + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(TypeSpan.Value, context).Dispose(); + } + else + { + var memberName = MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + + if (!context.Options.DesignTime || !IsMalformed) + { + context.CodeWriter.WriteAutoPropertyDeclaration( + _injectedPropertyModifiers, + TypeName, + memberName, + TypeSpan, + MemberSpan, + context, + defaultValue: true); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs index 381812e40f4..2df263902ae 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Extensions/DefaultTagHelperTargetExtension.cs @@ -101,12 +101,8 @@ public void WriteTagHelperBody(CodeRenderingContext context, DefaultTagHelperBod // Assign a unique ID for this instance of the source HTML tag. This must be unique // per call site, e.g. if the tag is on the view twice, there should be two IDs. - var uniqueId = context.Options.SuppressUniqueIds; - if (uniqueId == null) - { - uniqueId = GetDeterministicId(context); - } - + var uniqueId = GetDeterministicId(context); + context.CodeWriter.WriteStringLiteral(node.TagName) .WriteParameterSeparator() .Write(TagModeTypeName) @@ -650,10 +646,13 @@ private string GetContent(HtmlContentIntermediateNode node) // Internal for testing internal static string GetDeterministicId(CodeRenderingContext context) { - // Use the file checksum along with the absolute position in the generated code to create a unique id for each tag helper call site. - var checksum = ChecksumUtilities.BytesToString(context.SourceDocument.Text.GetChecksum()); - var uniqueId = checksum + context.CodeWriter.Location.AbsoluteIndex; - + var uniqueId = context.Options.SuppressUniqueIds; + if (uniqueId is null) + { + // Use the file checksum along with the absolute position in the generated code to create a unique id for each tag helper call site. + var checksum = ChecksumUtilities.BytesToString(context.SourceDocument.Text.GetChecksum()); + uniqueId = checksum + context.CodeWriter.Location.AbsoluteIndex; + } return uniqueId; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs index 919e5fbc4b2..4686220fafa 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/SourceSpan.cs @@ -108,6 +108,11 @@ internal SourceSpan With(int length, int endCharacterIndex) endCharacterIndex); } + internal readonly SourceSpan GetZeroWidthEndSpan() + { + return new SourceSpan(FilePath, AbsoluteIndex + EndCharacterIndex, LineIndex, characterIndex: EndCharacterIndex, length: 0, lineCount: 0, EndCharacterIndex); + } + public static bool operator ==(SourceSpan left, SourceSpan right) { return left.Equals(right); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectDirective.cs index f7527b9016f..9d803064c1f 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectDirective.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectDirective.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -55,18 +56,20 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } @@ -86,7 +89,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte TypeName = typeName, MemberName = memberName, TypeSource = typeSpan, - MemberSource = memberSpan + MemberSource = memberSpan, + IsMalformed = isMalformed }; visitor.Class.Children.Add(injectNode); @@ -98,7 +102,7 @@ private class Visitor : IntermediateNodeWalker { public ClassDeclarationIntermediateNode Class { get; private set; } - public IList Directives { get; } = new List(); + public IList Directives { get; } = []; public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { @@ -117,5 +121,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectIntermediateNode.cs index 21eda2d7933..72bda5a3dd5 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectIntermediateNode.cs @@ -20,6 +20,8 @@ public class InjectIntermediateNode : ExtensionIntermediateNode public SourceSpan? MemberSource { get; set; } + public bool IsMalformed { get; set; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) @@ -60,5 +62,6 @@ public override void FormatNode(IntermediateNodeFormatter formatter) formatter.WriteProperty(nameof(MemberName), MemberName); formatter.WriteProperty(nameof(TypeName), TypeName); + formatter.WriteProperty(nameof(IsMalformed), IsMalformed.ToString()); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectTargetExtension.cs index fb26d69904a..dd2af30c9cc 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version1_X/InjectTargetExtension.cs @@ -5,6 +5,7 @@ using System; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X; @@ -26,10 +27,19 @@ public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediate if (!context.Options.DesignTime && !string.IsNullOrWhiteSpace(node.TypeSource?.FilePath)) { - context.CodeWriter.WriteLine(RazorInjectAttribute); - context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, node.MemberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + if (node.TypeName == "") + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(node.TypeSource.Value, context).Dispose(); + } + else + { + context.CodeWriter.WriteLine(RazorInjectAttribute); + var memberName = node.MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, memberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + } } - else + else if (!node.IsMalformed) { var property = $"public {node.TypeName} {node.MemberName} {{ get; private set; }}"; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs index 1ad821bc8a6..951e955bcf2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectDirective.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -55,18 +56,20 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } @@ -86,7 +89,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte TypeName = typeName, MemberName = memberName, TypeSource = typeSpan, - MemberSource = memberSpan + MemberSource = memberSpan, + IsMalformed = isMalformed }; visitor.Class.Children.Add(injectNode); @@ -98,7 +102,7 @@ private class Visitor : IntermediateNodeWalker { public ClassDeclarationIntermediateNode Class { get; private set; } - public IList Directives { get; } = new List(); + public IList Directives { get; } = []; public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { @@ -117,5 +121,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs index 9cab9ce14e5..d9b3d960ed8 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectIntermediateNode.cs @@ -20,6 +20,8 @@ public class InjectIntermediateNode : ExtensionIntermediateNode public SourceSpan? MemberSource { get; set; } + public bool IsMalformed { get; set; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) @@ -60,5 +62,6 @@ public override void FormatNode(IntermediateNodeFormatter formatter) formatter.WriteProperty(nameof(MemberName), MemberName); formatter.WriteProperty(nameof(TypeName), TypeName); + formatter.WriteProperty(nameof(IsMalformed), IsMalformed.ToString()); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs index 64475550420..865ba972e12 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc.Version2_X/InjectTargetExtension.cs @@ -5,6 +5,7 @@ using System; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; namespace Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X; @@ -26,10 +27,19 @@ public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediate if (!context.Options.DesignTime && !string.IsNullOrWhiteSpace(node.TypeSource?.FilePath)) { - context.CodeWriter.WriteLine(RazorInjectAttribute); - context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, node.MemberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + if (node.TypeName == "") + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(node.TypeSource.Value, context).Dispose(); + } + else + { + context.CodeWriter.WriteLine(RazorInjectAttribute); + var memberName = node.MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, memberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + } } - else + else if(!node.IsMalformed) { var property = $"public {node.TypeName} {node.MemberName} {{ get; private set; }}"; diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs index 569a83748bf..15ed4fc0327 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectDirective.cs @@ -5,6 +5,7 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.Linq; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Intermediate; @@ -62,18 +63,20 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte for (var i = visitor.Directives.Count - 1; i >= 0; i--) { var directive = visitor.Directives[i]; - var tokens = directive.Tokens.ToArray(); - if (tokens.Length < 2) - { - continue; - } + var tokens = directive.Children.OfType().ToArray(); + var isMalformed = directive is MalformedDirectiveIntermediateNode; - var typeName = tokens[0].Content; - var typeSpan = tokens[0].Source; - var memberName = tokens[1].Content; - var memberSpan = tokens[1].Source; + var hasType = tokens.Length > 0 && !string.IsNullOrWhiteSpace(tokens[0].Content); + Debug.Assert(hasType || isMalformed); + var typeName = hasType ? tokens[0].Content : string.Empty; + var typeSpan = hasType ? tokens[0].Source : directive.Source?.GetZeroWidthEndSpan(); - if (!properties.Add(memberName)) + var hasMemberName = tokens.Length > 1 && !string.IsNullOrWhiteSpace(tokens[1].Content); + Debug.Assert(hasMemberName || isMalformed); + var memberName = hasMemberName ? tokens[1].Content : null; + var memberSpan = hasMemberName ? tokens[1].Source : null; + + if (hasMemberName && !properties.Add(memberName)) { continue; } @@ -93,7 +96,8 @@ protected override void ExecuteCore(RazorCodeDocument codeDocument, DocumentInte TypeName = typeName, MemberName = memberName, TypeSource = typeSpan, - MemberSource = memberSpan + MemberSource = memberSpan, + IsMalformed = isMalformed }; visitor.Class.Children.Add(injectNode); @@ -105,7 +109,7 @@ private class Visitor : IntermediateNodeWalker { public ClassDeclarationIntermediateNode Class { get; private set; } - public IList Directives { get; } = new List(); + public IList Directives { get; } = []; public override void VisitClassDeclaration(ClassDeclarationIntermediateNode node) { @@ -124,5 +128,13 @@ public override void VisitDirective(DirectiveIntermediateNode node) Directives.Add(node); } } + + public override void VisitMalformedDirective(MalformedDirectiveIntermediateNode node) + { + if (node.Directive == Directive) + { + Directives.Add(node); + } + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs index de9c29ebeac..8ef9bbbe3cc 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectIntermediateNode.cs @@ -20,6 +20,8 @@ public class InjectIntermediateNode : ExtensionIntermediateNode public SourceSpan? MemberSource { get; set; } + public bool IsMalformed { get; set; } + public override IntermediateNodeCollection Children => IntermediateNodeCollection.ReadOnly; public override void Accept(IntermediateNodeVisitor visitor) @@ -60,5 +62,6 @@ public override void FormatNode(IntermediateNodeFormatter formatter) formatter.WriteProperty(nameof(MemberName), MemberName); formatter.WriteProperty(nameof(TypeName), TypeName); + formatter.WriteProperty(nameof(IsMalformed), IsMalformed.ToString()); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs index 506483f6a84..46e83e4cae9 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Mvc/InjectTargetExtension.cs @@ -5,6 +5,7 @@ using System; using Microsoft.AspNetCore.Razor.Language.CodeGeneration; +using Microsoft.AspNetCore.Razor.Language.Extensions; namespace Microsoft.AspNetCore.Mvc.Razor.Extensions; @@ -26,10 +27,19 @@ public void WriteInjectProperty(CodeRenderingContext context, InjectIntermediate if (!context.Options.DesignTime && !string.IsNullOrWhiteSpace(node.TypeSource?.FilePath)) { - context.CodeWriter.WriteLine(RazorInjectAttribute); - context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, node.MemberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + if (node.TypeName == "") + { + // if we don't even have a type name, just emit an empty mapped region so that intellisense still works + context.CodeWriter.BuildEnhancedLinePragma(node.TypeSource.Value, context).Dispose(); + } + else + { + context.CodeWriter.WriteLine(RazorInjectAttribute); + var memberName = node.MemberName ?? "Member_" + DefaultTagHelperTargetExtension.GetDeterministicId(context); + context.CodeWriter.WriteAutoPropertyDeclaration(["public"], node.TypeName, memberName, node.TypeSource, node.MemberSource, context, privateSetter: true, defaultValue: true); + } } - else + else if (!node.IsMalformed) { var property = $"public {node.TypeName} {node.MemberName} {{ get; private set; }}"; if (!context.Options.SuppressNullabilityEnforcement) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs index 384a9c9bb92..2e0fa3b8772 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/IntegrationTests/RazorIntegrationTestBase.cs @@ -122,6 +122,8 @@ private RazorProjectEngine CreateProjectEngine(RazorConfiguration configuration, b.Features.Add(new SetNewLineOptionFeature(LineEnding)); } + b.Features.Add(new SuppressUniqueIdsPhase()); + b.Features.Add(new CompilationTagHelperFeature()); b.Features.Add(new DefaultMetadataReferenceFeature() { @@ -497,6 +499,16 @@ public void Configure(RazorCodeGenerationOptionsBuilder options) } } + private sealed class SuppressUniqueIdsPhase : RazorEngineFeatureBase, IConfigureRazorCodeGenerationOptionsFeature + { + public int Order { get; } + + public void Configure(RazorCodeGenerationOptionsBuilder options) + { + options.SuppressUniqueIds = "__UniqueIdSuppressedForTesting__"; + } + } + private class TestImportProjectFeature : IImportProjectFeature { private readonly List _imports; From 038f7fc41614894df8d7d72876fe7c63522b5c2a Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 26 Aug 2024 10:29:28 -0700 Subject: [PATCH 160/271] Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2524412 --- .../Resources/xlf/SR.cs.xlf | 14 +++++++------- .../Resources/xlf/SR.de.xlf | 14 +++++++------- .../Resources/xlf/SR.es.xlf | 14 +++++++------- .../Resources/xlf/SR.fr.xlf | 14 +++++++------- .../Resources/xlf/SR.it.xlf | 14 +++++++------- .../Resources/xlf/SR.ja.xlf | 14 +++++++------- .../Resources/xlf/SR.ko.xlf | 14 +++++++------- .../Resources/xlf/SR.pl.xlf | 14 +++++++------- .../Resources/xlf/SR.pt-BR.xlf | 14 +++++++------- .../Resources/xlf/SR.ru.xlf | 14 +++++++------- .../Resources/xlf/SR.tr.xlf | 14 +++++++------- 11 files changed, 77 insertions(+), 77 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf index 462c200ab35..150cb3ff499 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.cs.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnostika po: Diagnostics before: - Diagnostics before: + Diagnostika před: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Úprava na {0} přidá neprázdný obsah {1}. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Úprava na {0} odstraní neprázdný obsah {1}. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Operace formátování je ukončována, protože by zavedla nebo odebrala jednu z více diagnostik. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Operace formátování je ukončována, protože by přidala nebo odstranila neprázdný obsah. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Služby jazyka Razor nejsou správně nakonfigurované, chybí služba jazyka {0}. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf index 3a727a4f3dc..61aee78762f 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.de.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnose nach: Diagnostics before: - Diagnostics before: + Diagnose vor: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Das Bearbeiten bei {0} fügt den Nicht-Leerraum-Inhalt "{1}" hinzu. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Das Bearbeiten bei {0} löscht den Nicht-Leerraum-Inhalt "{1}". A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Ein Formatierungsvorgang wird abgebrochen, weil er eine oder mehrere Diagnosen einführen oder entfernen würde. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Ein Formatierungsvorgang wird abgebrochen, da er Nicht-Leerraum-Inhalte hinzufügen oder löschen würde. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Razor-Sprachdienste sind nicht ordnungsgemäß konfiguriert, der Sprachdienst "{0}" fehlt. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf index 007ccba3f61..dbfc1397a26 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.es.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnósticos después de: Diagnostics before: - Diagnostics before: + Diagnósticos antes de: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Editar en {0}agregar el contenido que no es un espacio en blanco "{1}" . Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Editar en {0} eliminar el contenido que no es un espacio en blanco "{1}" . A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Se está abandonando una operación de formato porque introduciría o quitaría uno de más diagnósticos. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Se está abandonando una operación de formato porque agregaría o eliminaría contenido que no es un espacio en blanco. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Los servicios de lenguaje Razor no están configurados correctamente; falta el servicio de idioma "{0}". diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf index 33866cc0cc5..919895dbf7c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.fr.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnostics après : Diagnostics before: - Diagnostics before: + Diagnostics avant : @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Modifier à {0} ajoute le contenu autre qu’un espace « {1} ». Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Modifier à {0} supprime le contenu autre qu’un espace « {1} ». A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Une opération de formatage est en cours d’abandon, car elle introduit ou supprime un ou plusieurs diagnostics. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Une opération de formatage est en cours d’abandon, car elle ajouterait ou supprimerait du contenu qui n’est pas un espace blanc. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Les services de langage Razor ne sont pas configurés correctement, le service de langage «{0}» manquant. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf index a5db731142a..e03729ccb1d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.it.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnostica dopo: Diagnostics before: - Diagnostics before: + Diagnostica prima di: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + La modifica in {0} aggiunge contenuti diversi da spazi vuoti '{1}'. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + La modifica in {0} elimina contenuti diversi da spazi vuoti '{1}'. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + È in corso l'abbandono di un'operazione di formato perché comporterebbe l'introduzione o la rimozione di una o più operazioni di diagnostica. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + È in corso l'abbandono di un'operazione di formattazione perché aggiungerebbe o eliminerebbe contenuto diverso da spazi vuoti. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + I servizi di linguaggio Razor non sono configurati correttamente. Manca il servizio di linguaggio '{0}'. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf index 57aec54f7e8..472ca328ed2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ja.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + 次の時間が経過した後の診断: Diagnostics before: - Diagnostics before: + 次の時間以前の診断: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + {0} で編集すると空白以外のスペース '{1}' が追加されます。 Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + {0} で削除すると空白以外のスペース '{1}' が追加されます。 A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + 書式設定操作は、さらに診断の 1 つを導入または削除するため、破棄されています。 A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + 書式設定操作は、空白以外のコンテンツを追加または削除するため、破棄されています。 @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Razor 言語サービスが正しく構成されていません。言語サービス '{0}' がありません。 diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf index c81294f8ae2..4542bd59c0d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ko.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + 다음 이후 진단: Diagnostics before: - Diagnostics before: + 다음 이전 진단: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + {0}에서 편집은 공백이 아닌 콘텐츠 '{1}'을(를) 추가합니다. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + {0}에서 편집은 공백이 아닌 콘텐츠 '{1}'을(를) 삭제합니다. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + 서식 작업이 중단되는 이유는 진단 중 하나를 더 도입하거나 제거할 수 있기 때문입니다. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + 공백이 아닌 콘텐츠를 추가하거나 삭제하기 때문에 형식 작업이 중단됩니다. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Razor 언어 서비스가 제대로 구성되지 않았습니다. 언어 서비스 '{0}'이(가) 없습니다. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf index 70b8f7c8f5a..f7b1a69b107 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pl.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnostyka po: Diagnostics before: - Diagnostics before: + Diagnostyka przed: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Edycja na stronie {0} dodaje zawartość bez białych znaków „{1}”. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Edycja na stronie {0} usuwa zawartość bez białych znaków „{1}”. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Operacja formatowania jest porzucana, ponieważ spowodowałaby wprowadzenie lub usunięcie jednej z większej liczby diagnostyki. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Operacja formatowania jest porzucana, ponieważ doda lub usunie zawartość bez białych znaków. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Usługi języka dla składni Razor nie zostały prawidłowo skonfigurowane — brak usługi językowej "{0}". diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf index f16f7b45466..746a4efee2b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.pt-BR.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Diagnóstico após: Diagnostics before: - Diagnostics before: + Diagnóstico antes: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Editar em {0} adiciona o conteúdo que não é espaço em branco ''{1}''. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Editar em {0} exclui o conteúdo que não é espaço em branco ''{1}''. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Uma operação de formato está sendo abandonada porque introduziria ou removeria um ou mais diagnósticos. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Uma operação de formato está sendo abandonada porque adicionaria ou excluiria conteúdo que não é espaço em branco. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Serviços de Linguagem Razor não configurados corretamente, serviço de linguagem '{0}' ausente. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf index f328aeb5dcd..9e17ac79fc4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.ru.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Диагностика после: Diagnostics before: - Diagnostics before: + Диагностика до: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + Редактирование {0} добавляет содержимое, не являющееся пробелами "{1}". Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + Редактирование {0} удаляет содержимое, не являющееся пробелами "{1}". A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Операция форматирования отменяется, поскольку она вводит или удаляет одну или несколько диагностик. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Операция форматирования отменяется, поскольку она может добавить или удалить содержимое, отличное от пробелов. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Языковые службы Razor настроены неправильно, отсутствует языковая служба "{0}". diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf index 238b1750f89..1b1846db9e8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.tr.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + Şundan sonraki tanılama: Diagnostics before: - Diagnostics before: + Şundan önceki tanılama: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + {0} konumunda düzenleme, '{1}' boşluk dışı içeriğini ekler. Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + {0} konumunda düzenleme, '{1}' boşluk dışı içeriğini siler. A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + Bir veya daha fazla tanılamayı ortaya çıkarabileceği veya kaldırabileceği için biçimlendirme işlemi bırakılıyor. A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + Boşluk dışı içeriği ekleyebileceği veya silebileceği için biçimlendirme işlemi bırakıl. @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Razor dil hizmetleri düzgün yapılandırılmadı, '{0}' dil hizmeti eksik. From fff39dce74f319750501f68292e04435fab1f0a2 Mon Sep 17 00:00:00 2001 From: dotnet bot Date: Mon, 26 Aug 2024 10:30:38 -0700 Subject: [PATCH 161/271] Localized file check-in by OneLocBuild Task: Build definition ID 262: Build ID 2524412 --- .../Resources/xlf/SR.zh-Hans.xlf | 14 +++++++------- .../Resources/xlf/SR.zh-Hant.xlf | 14 +++++++------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf index c913c3de99a..63a41117bc2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hans.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + 诊断后: Diagnostics before: - Diagnostics before: + 诊断前: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + 于 {0} 编辑,添加非空格内容“{1}”。 Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + 于 {0} 编辑,删除非空格内容“{1}”。 A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + 正在放弃格式操作,因为它会引入或删除其他诊断之一。 A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + 正在放弃格式操作,因为它会添加或删除非空格内容。 @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + Razor 语言服务未正确配置,缺少语言服务 "{0}"。 diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf index c469cd01f4b..5719f9dccf7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Resources/xlf/SR.zh-Hant.xlf @@ -9,12 +9,12 @@ Diagnostics after: - Diagnostics after: + 在以下事項之後的診斷: Diagnostics before: - Diagnostics before: + 在以下事項之前的診斷: @@ -31,22 +31,22 @@ Edit at {0} adds the non-whitespace content '{1}'. - Edit at {0} adds the non-whitespace content '{1}'. + 在 {0} 處編輯將新增非空白內容 '{1}'。 Edit at {0} deletes the non-whitespace content '{1}'. - Edit at {0} deletes the non-whitespace content '{1}'. + 在 {0} 處編輯將刪除非空白內容 '{1}'。 A format operation is being abandoned because it would introduce or remove one of more diagnostics. - A format operation is being abandoned because it would introduce or remove one of more diagnostics. + 將放棄格式化作業,因為它將引入或移除一個或多個診斷。 A format operation is being abandoned because it would add or delete non-whitespace content. - A format operation is being abandoned because it would add or delete non-whitespace content. + 將放棄格式化作業,因為它將新增或删除非空白內容。 @@ -56,7 +56,7 @@ Razor language services not configured properly, missing language service '{0}'. - Razor language services not configured properly, missing language service '{0}'. + 未正確設定 Razor 語言服務,遺漏語言服務 '{0}'。 From e7db6bcb15098593a695d3d225073893a249ef23 Mon Sep 17 00:00:00 2001 From: David Barbet Date: Mon, 26 Aug 2024 13:59:43 -0700 Subject: [PATCH 162/271] Update configs for 17.12p3 snap --- eng/Versions.props | 2 +- eng/config/PublishData.json | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 46fe8c947f9..41c4e059ba2 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -30,7 +30,7 @@ imported. This OK because we want to just have an obvious salt for a local build. --> - 17.12.2 + 17.12.3 17.12 $(AddinMajorVersion) $(AddinVersion).$(OfficialBuildId) diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 0430b2b4e1f..0ed6c986efe 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -28,8 +28,8 @@ ], "vsBranch": "main", "vsMajorVersion": 17, - "insertionCreateDraftPR": false, - "insertionTitlePrefix": "[d17.12 P2]" + "insertionCreateDraftPR": true, + "insertionTitlePrefix": "[d17.12 P3]" }, "release/dev17.6": { "nugetKind": [ @@ -92,10 +92,10 @@ "Shipping", "NonShipping" ], - "vsBranch": "rel/d17.12", + "vsBranch": "main", "vsMajorVersion": 17, "insertionCreateDraftPR": false, - "insertionTitlePrefix": "[d17.12 P1]" + "insertionTitlePrefix": "[d17.12 P2]" } } } From 8cebb29b87e0673e13671ebec1ce57b9c7d07a91 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 27 Aug 2024 14:00:50 +1000 Subject: [PATCH 163/271] Remove debug.fails --- .../GeneratedDocumentPublisher.cs | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs index 81a34f72030..18cbf9b9e65 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/GeneratedDocumentPublisher.cs @@ -75,7 +75,6 @@ public void PublishCSharp(ProjectKey projectKey, string filePath, SourceText sou if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) { // We've already published a newer version of this document. No-op. - Debug.Fail("C# document being published that is older than one we've previously published!"); _logger.LogWarning($"Skipping publish of C# for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); return; } @@ -122,7 +121,6 @@ public void PublishHtml(ProjectKey projectKey, string filePath, SourceText sourc if (previouslyPublishedData.HostDocumentVersion > hostDocumentVersion) { // We've already published a newer version of this document. No-op. - Debug.Fail("Html document being published that is older than one we've previously published!"); _logger.LogWarning($"Skipping publish of Html for {filePath} because we've already published version {previouslyPublishedData.HostDocumentVersion}, and this request is for {hostDocumentVersion}."); return; } From 19134c2ee6554ada37a97ab9752d95ffe46b17e5 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 27 Aug 2024 14:08:54 +1000 Subject: [PATCH 164/271] PR feedback --- .../Formatting/HtmlFormatter.cs | 2 +- .../Extensions/SourceTextExtensions.cs | 12 +++++++++--- .../Formatting/Passes/CSharpOnTypeFormattingPass.cs | 2 +- .../Formatting/RazorFormattingService.cs | 4 ++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs index a20dde45416..0123abd9b5b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/HtmlFormatter.cs @@ -92,6 +92,6 @@ public static TextEdit[] FixHtmlTextEdits(SourceText htmlSourceText, TextEdit[] if (!edits.Any(static e => e.NewText.Contains("~"))) return edits; - return htmlSourceText.NormalizeTextEdits(edits); + return htmlSourceText.MinimizeTextEdits(edits); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs index cf8b62aa8c5..77b8b9b1b8e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs @@ -273,10 +273,16 @@ public static bool TryGetSourceLocation(this SourceText text, int line, int char return false; } - public static TextEdit[] NormalizeTextEdits(this SourceText text, TextEdit[] edits) - => NormalizeTextEdits(text, edits, out _); + /// + /// Applies the set of edits specified, and returns the minimal set needed to make the same changes + /// + public static TextEdit[] MinimizeTextEdits(this SourceText text, TextEdit[] edits) + => MinimizeTextEdits(text, edits, out _); - public static TextEdit[] NormalizeTextEdits(this SourceText text, TextEdit[] edits, out SourceText originalTextWithChanges) + /// + /// Applies the set of edits specified, and returns the minimal set needed to make the same changes + /// + public static TextEdit[] MinimizeTextEdits(this SourceText text, TextEdit[] edits, out SourceText originalTextWithChanges) { var changes = edits.Select(text.GetTextChange); originalTextWithChanges = text.WithChanges(changes); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs index 5ce1e2b13bc..f8025b7f8d3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpOnTypeFormattingPass.cs @@ -85,7 +85,7 @@ public async override Task ExecuteAsync(FormattingContext context, T } } - var normalizedEdits = csharpText.NormalizeTextEdits((TextEdit[])edits, out var originalTextWithChanges); + var normalizedEdits = csharpText.MinimizeTextEdits(edits, out var originalTextWithChanges); var mappedEdits = RemapTextEdits(codeDocument, normalizedEdits); var filteredEdits = FilterCSharpTextEdits(context, mappedEdits); if (filteredEdits.Length == 0) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 1808203447f..8879e83232b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -99,7 +99,7 @@ public async Task GetDocumentFormattingEditsAsync( ? result : result.Where(e => range.LineOverlapsWith(e.Range)).ToArray(); - return originalText.NormalizeTextEdits(filteredEdits); + return originalText.MinimizeTextEdits(filteredEdits); } public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) @@ -204,7 +204,7 @@ private async Task ApplyFormattedEditsAsync( } var originalText = context.SourceText; - var razorEdits = originalText.NormalizeTextEdits(result); + var razorEdits = originalText.MinimizeTextEdits(result); if (collapseEdits) { From d7b76ad62371db69fdacb46880f6eb1b22c75388 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Tue, 27 Aug 2024 12:52:28 +0000 Subject: [PATCH 165/271] Update dependencies from https://github.com/dotnet/arcade build 20240826.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24423.2 -> To Version 9.0.0-beta.24426.3 --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 0e7d73da173..64501db8a49 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 91599268652b51969b8d8088d4f2f2ba7b3ebb19 + e3bdd9a0f2a65fe037ba1adb2261eea48a840fa4 - + https://github.com/dotnet/arcade - 91599268652b51969b8d8088d4f2f2ba7b3ebb19 + e3bdd9a0f2a65fe037ba1adb2261eea48a840fa4 diff --git a/eng/Versions.props b/eng/Versions.props index 1f645fc437c..1180eb983ce 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24423.2 + 9.0.0-beta.24426.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index 865ef90d330..095b262e374 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24423.2", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24426.3", "Microsoft.Build.NoTargets": "3.7.0" } } From b6eb03fb0d1b8d5ca5e8441323e6e9e8e193211d Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 26 Aug 2024 10:18:46 -0700 Subject: [PATCH 166/271] Merge RazorSyntaxTree and DefaultRazorSyntaxTree --- .../DefaultDirectiveSyntaxTreePass.cs | 4 +- .../src/Language/DefaultRazorSyntaxTree.cs | 60 ------------- .../src/Language/RazorSyntaxTree.cs | 88 +++++++++++-------- 3 files changed, 54 insertions(+), 98 deletions(-) delete mode 100644 src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs index e685e50f20f..134e942dc67 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultDirectiveSyntaxTreePass.cs @@ -41,8 +41,8 @@ public NestedSectionVerifier(RazorSyntaxTree syntaxTree) public RazorSyntaxTree Verify() { var root = Visit(_syntaxTree.Root); - var rewrittenTree = new DefaultRazorSyntaxTree(root, _syntaxTree.Source, _diagnostics, _syntaxTree.Options); - return rewrittenTree; + + return new RazorSyntaxTree(root, _syntaxTree.Source, _diagnostics, _syntaxTree.Options); } public override SyntaxNode Visit(SyntaxNode node) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs deleted file mode 100644 index 4f1b9e7adec..00000000000 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/DefaultRazorSyntaxTree.cs +++ /dev/null @@ -1,60 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. - -#nullable disable - -using System.Collections.Generic; -using System.Linq; -using Microsoft.AspNetCore.Razor.Language.Syntax; - -namespace Microsoft.AspNetCore.Razor.Language; - -internal class DefaultRazorSyntaxTree : RazorSyntaxTree -{ - private readonly IReadOnlyList _diagnostics; - private IReadOnlyList _allDiagnostics; - - public DefaultRazorSyntaxTree( - SyntaxNode root, - RazorSourceDocument source, - IReadOnlyList diagnostics, - RazorParserOptions options) - { - Root = root; - Source = source; - _diagnostics = diagnostics; - Options = options; - } - - public override IReadOnlyList Diagnostics - { - get - { - if (_allDiagnostics == null) - { - var allDiagnostics = new HashSet(); - for (var i = 0; i < _diagnostics.Count; i++) - { - allDiagnostics.Add(_diagnostics[i]); - } - - var rootDiagnostics = Root.GetAllDiagnostics(); - for (var i = 0; i < rootDiagnostics.Count; i++) - { - allDiagnostics.Add(rootDiagnostics[i]); - } - - var allOrderedDiagnostics = allDiagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); - _allDiagnostics = allOrderedDiagnostics.ToArray(); - } - - return _allDiagnostics; - } - } - - public override RazorParserOptions Options { get; } - - internal override SyntaxNode Root { get; } - - public override RazorSourceDocument Source { get; } -} diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs index 0796773b172..a71e24baf4d 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs @@ -3,70 +3,86 @@ #nullable disable -using System; using System.Collections.Generic; +using System.Linq; using Microsoft.AspNetCore.Razor.Language.Legacy; using Microsoft.AspNetCore.Razor.Language.Syntax; namespace Microsoft.AspNetCore.Razor.Language; -public abstract class RazorSyntaxTree +public sealed class RazorSyntaxTree { - internal static RazorSyntaxTree Create( + internal SyntaxNode Root { get; } + public RazorParserOptions Options { get; } + public RazorSourceDocument Source { get; } + + private readonly IReadOnlyList _diagnostics; + private IReadOnlyList _allDiagnostics; + + internal RazorSyntaxTree( SyntaxNode root, RazorSourceDocument source, - IEnumerable diagnostics, + IReadOnlyList diagnostics, RazorParserOptions options) { - if (root == null) - { - throw new ArgumentNullException(nameof(root)); - } - - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + Root = root; + Source = source; + _diagnostics = diagnostics; + Options = options; + } - if (diagnostics == null) + public IReadOnlyList Diagnostics + { + get { - throw new ArgumentNullException(nameof(diagnostics)); + if (_allDiagnostics == null) + { + var allDiagnostics = new HashSet(); + for (var i = 0; i < _diagnostics.Count; i++) + { + allDiagnostics.Add(_diagnostics[i]); + } + + var rootDiagnostics = Root.GetAllDiagnostics(); + for (var i = 0; i < rootDiagnostics.Count; i++) + { + allDiagnostics.Add(rootDiagnostics[i]); + } + + var allOrderedDiagnostics = allDiagnostics.OrderBy(diagnostic => diagnostic.Span.AbsoluteIndex); + _allDiagnostics = allOrderedDiagnostics.ToArray(); + } + + return _allDiagnostics; } + } - if (options == null) - { - throw new ArgumentNullException(nameof(options)); - } + internal static RazorSyntaxTree Create( + SyntaxNode root, + RazorSourceDocument source, + IEnumerable diagnostics, + RazorParserOptions options) + { + ArgHelper.ThrowIfNull(root); + ArgHelper.ThrowIfNull(source); + ArgHelper.ThrowIfNull(diagnostics); + ArgHelper.ThrowIfNull(options); - return new DefaultRazorSyntaxTree(root, source, new List(diagnostics), options); + return new RazorSyntaxTree(root, source, new List(diagnostics), options); } public static RazorSyntaxTree Parse(RazorSourceDocument source) { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgHelper.ThrowIfNull(source); return Parse(source, options: null); } public static RazorSyntaxTree Parse(RazorSourceDocument source, RazorParserOptions options) { - if (source == null) - { - throw new ArgumentNullException(nameof(source)); - } + ArgHelper.ThrowIfNull(source); var parser = new RazorParser(options ?? RazorParserOptions.CreateDefault()); return parser.Parse(source); } - - public abstract IReadOnlyList Diagnostics { get; } - - public abstract RazorParserOptions Options { get; } - - internal abstract SyntaxNode Root { get; } - - public abstract RazorSourceDocument Source { get; } } From a7e5bf915292988413b0271a38bbff297ba2ac39 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 26 Aug 2024 10:25:27 -0700 Subject: [PATCH 167/271] Prefer constructor over Create method --- .../Legacy/WhiteSpaceRewriterTest.cs | 2 +- .../DefaultRazorTagHelperBinderPhaseTest.cs | 2 +- .../test/Legacy/WhiteSpaceRewriterTest.cs | 2 +- .../src/Language/HtmlNodeOptimizationPass.cs | 3 +- .../src/Language/Legacy/RazorParser.cs | 3 +- .../Legacy/TagHelperParseTreeRewriter.cs | 3 +- .../src/Language/RazorSyntaxTree.cs | 29 +++++++------------ .../Parsing/RazorSyntaxTreePartialParser.cs | 2 +- .../Language/Legacy/ToolingParserTestBase.cs | 2 +- .../RazorSyntaxTreePartialParserTest.cs | 2 +- .../VisualStudioRazorParserIntegrationTest.cs | 2 +- .../Language/Legacy/ParserTestBase.cs | 2 +- 12 files changed, 21 insertions(+), 33 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs index 18837bc17b7..34adfc50ce9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/legacyTest/Legacy/WhiteSpaceRewriterTest.cs @@ -32,7 +32,7 @@ public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() var rewritten = rewriter.Visit(parsed.Root); // Assert - var rewrittenTree = RazorSyntaxTree.Create(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); + var rewrittenTree = new RazorSyntaxTree(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); BaselineTest(rewrittenTree); } } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs index 567dfe62ff6..33482ff3f55 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/DefaultRazorTagHelperBinderPhaseTest.cs @@ -604,7 +604,7 @@ public void Execute_CombinesErrorsOnRewritingErrors() var expectedRewritingError = RazorDiagnosticFactory.CreateParsing_TagHelperFoundMalformedTagHelper( new SourceSpan(new SourceLocation((Environment.NewLine.Length * 2) + 30, 2, 1), contentLength: 4), "form"); - var erroredOriginalTree = RazorSyntaxTree.Create(originalTree.Root, originalTree.Source, [initialError], originalTree.Options); + var erroredOriginalTree = new RazorSyntaxTree(originalTree.Root, originalTree.Source, [initialError], originalTree.Options); codeDocument.SetSyntaxTree(erroredOriginalTree); // Act diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs index 7f19eb246f9..6d7a461dbc3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/WhiteSpaceRewriterTest.cs @@ -32,7 +32,7 @@ public void Moves_Whitespace_Preceeding_ExpressionBlock_To_Parent_Block() var rewritten = rewriter.Visit(parsed.Root); // Assert - var rewrittenTree = RazorSyntaxTree.Create(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); + var rewrittenTree = new RazorSyntaxTree(rewritten, parsed.Source, parsed.Diagnostics, parsed.Options); BaselineTest(rewrittenTree); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs index 6d831ea3587..42356425310 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/HtmlNodeOptimizationPass.cs @@ -27,7 +27,6 @@ public RazorSyntaxTree Execute(RazorCodeDocument codeDocument, RazorSyntaxTree s var whitespaceRewriter = new WhitespaceRewriter(); var rewritten = whitespaceRewriter.Visit(syntaxTree.Root); - var rewrittenSyntaxTree = RazorSyntaxTree.Create(rewritten, syntaxTree.Source, syntaxTree.Diagnostics, syntaxTree.Options); - return rewrittenSyntaxTree; + return new RazorSyntaxTree(rewritten, syntaxTree.Source, syntaxTree.Diagnostics, syntaxTree.Options); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs index 5c762cf1c68..26d73699099 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/RazorParser.cs @@ -44,7 +44,6 @@ public virtual RazorSyntaxTree Parse(RazorSourceDocument source) var root = markupParser.ParseDocument().CreateRed(); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, Options); - return syntaxTree; + return new RazorSyntaxTree(root, source, diagnostics, Options); } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs index cc82532dcef..80d973916b2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Legacy/TagHelperParseTreeRewriter.cs @@ -34,8 +34,7 @@ public static RazorSyntaxTree Rewrite(RazorSyntaxTree syntaxTree, TagHelperBinde usedDescriptors = rewriter.UsedDescriptors; - var newSyntaxTree = RazorSyntaxTree.Create(rewritten, syntaxTree.Source, diagnostics, syntaxTree.Options); - return newSyntaxTree; + return new RazorSyntaxTree(rewritten, syntaxTree.Source, diagnostics, syntaxTree.Options); } private static IReadOnlyList CombineErrors(IReadOnlyList errors1, IReadOnlyList errors2) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs index a71e24baf4d..2ee7eec7fd4 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorSyntaxTree.cs @@ -16,18 +16,23 @@ public sealed class RazorSyntaxTree public RazorParserOptions Options { get; } public RazorSourceDocument Source { get; } - private readonly IReadOnlyList _diagnostics; + private readonly List _diagnostics; private IReadOnlyList _allDiagnostics; internal RazorSyntaxTree( SyntaxNode root, RazorSourceDocument source, - IReadOnlyList diagnostics, + IEnumerable diagnostics, RazorParserOptions options) { + ArgHelper.ThrowIfNull(root); + ArgHelper.ThrowIfNull(source); + ArgHelper.ThrowIfNull(diagnostics); + ArgHelper.ThrowIfNull(options); + Root = root; Source = source; - _diagnostics = diagnostics; + _diagnostics = new List(diagnostics); Options = options; } @@ -38,9 +43,9 @@ public IReadOnlyList Diagnostics if (_allDiagnostics == null) { var allDiagnostics = new HashSet(); - for (var i = 0; i < _diagnostics.Count; i++) + foreach (var diagnostic in _diagnostics) { - allDiagnostics.Add(_diagnostics[i]); + allDiagnostics.Add(diagnostic); } var rootDiagnostics = Root.GetAllDiagnostics(); @@ -57,20 +62,6 @@ public IReadOnlyList Diagnostics } } - internal static RazorSyntaxTree Create( - SyntaxNode root, - RazorSourceDocument source, - IEnumerable diagnostics, - RazorParserOptions options) - { - ArgHelper.ThrowIfNull(root); - ArgHelper.ThrowIfNull(source); - ArgHelper.ThrowIfNull(diagnostics); - ArgHelper.ThrowIfNull(options); - - return new RazorSyntaxTree(root, source, new List(diagnostics), options); - } - public static RazorSyntaxTree Parse(RazorSourceDocument source) { ArgHelper.ThrowIfNull(source); diff --git a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/Parsing/RazorSyntaxTreePartialParser.cs b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/Parsing/RazorSyntaxTreePartialParser.cs index d567c869407..d741a810a22 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/Parsing/RazorSyntaxTreePartialParser.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/Parsing/RazorSyntaxTreePartialParser.cs @@ -44,7 +44,7 @@ public RazorSyntaxTreePartialParser(RazorSyntaxTree syntaxTree) // Remember if this was provisionally accepted for next partial parse. _lastResultProvisional = (result & PartialParseResultInternal.Provisional) == PartialParseResultInternal.Provisional; - var newSyntaxTree = RazorSyntaxTree.Create(ModifiedSyntaxTreeRoot, OriginalSyntaxTree.Source, OriginalSyntaxTree.Diagnostics, OriginalSyntaxTree.Options); + var newSyntaxTree = new RazorSyntaxTree(ModifiedSyntaxTreeRoot, OriginalSyntaxTree.Source, OriginalSyntaxTree.Diagnostics, OriginalSyntaxTree.Options); return (result, newSyntaxTree); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs index 64c89e2de7a..e6f5d16fefa 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Language/Legacy/ToolingParserTestBase.cs @@ -199,7 +199,7 @@ internal virtual RazorSyntaxTree ParseDocument(RazorLanguageVersion version, str var codeDocument = RazorCodeDocument.Create(source); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, options); + var syntaxTree = new RazorSyntaxTree(root, source, diagnostics, options); codeDocument.SetSyntaxTree(syntaxTree); var defaultDirectivePass = new DefaultDirectiveSyntaxTreePass(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs index 0c7b2caf527..2cc9e500372 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/RazorSyntaxTreePartialParserTest.cs @@ -378,7 +378,7 @@ private void RunPartialParseTest(TestEdit edit, PartialParseResultInternal addit Assert.Equal(PartialParseResultInternal.Accepted | additionalFlags, result); var newSource = TestRazorSourceDocument.Create(edit.NewSnapshot.GetText()); - var newSyntaxTree = RazorSyntaxTree.Create(parser.ModifiedSyntaxTreeRoot, newSource, parser.OriginalSyntaxTree.Diagnostics, parser.OriginalSyntaxTree.Options); + var newSyntaxTree = new RazorSyntaxTree(parser.ModifiedSyntaxTreeRoot, newSource, parser.OriginalSyntaxTree.Diagnostics, parser.OriginalSyntaxTree.Options); BaselineTest(newSyntaxTree); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs index 8ba0b8b426f..0f5427a7a3b 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/Parsing/VisualStudioRazorParserIntegrationTest.cs @@ -551,7 +551,7 @@ private void VerifyPartialParseTree(TestParserManager manager, string content, s } var sourceDocument = TestRazorSourceDocument.Create(content); - var syntaxTree = RazorSyntaxTree.Create(manager.PartialParsingSyntaxTreeRoot, sourceDocument, manager.CurrentSyntaxTree!.Diagnostics, manager.CurrentSyntaxTree.Options); + var syntaxTree = new RazorSyntaxTree(manager.PartialParsingSyntaxTreeRoot, sourceDocument, manager.CurrentSyntaxTree!.Diagnostics, manager.CurrentSyntaxTree.Options); BaselineTest(syntaxTree); } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs index 3d38abc1518..f382944c049 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Test.Common/Language/Legacy/ParserTestBase.cs @@ -211,7 +211,7 @@ internal virtual RazorSyntaxTree ParseDocument(RazorLanguageVersion version, str var codeDocument = RazorCodeDocument.Create(source); - var syntaxTree = RazorSyntaxTree.Create(root, source, diagnostics, options); + var syntaxTree = new RazorSyntaxTree(root, source, diagnostics, options); codeDocument.SetSyntaxTree(syntaxTree); var defaultDirectivePass = new DefaultDirectiveSyntaxTreePass(); From 965d3e8307ab34f442ac65d28f84592d4f4cdd93 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Mon, 26 Aug 2024 11:47:14 -0700 Subject: [PATCH 168/271] Add (Drain)ToImmutableOrdered* methods to PooledArrayBuilder --- .../PooledObjects/PooledArrayBuilderTests.cs | 271 ++++++++++++++++++ .../PooledObjects/PooledArrayBuilder`1.cs | 192 +++++++++++++ 2 files changed, 463 insertions(+) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs index 03129b86b02..d2272705ecf 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs @@ -2,6 +2,7 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor.PooledObjects; using Xunit; using SR = Microsoft.AspNetCore.Razor.Utilities.Shared.Resources.SR; @@ -86,6 +87,100 @@ public void RemoveAtIndex(int count, int removeIndex) } } + private static Comparison OddBeforeEven + => (x, y) => (x % 2 != 0, y % 2 != 0) switch + { + (true, false) => -1, + (false, true) => 1, + _ => x.CompareTo(y) + }; + + public readonly record struct ValueHolder(int Value) + { + public static implicit operator ValueHolder(int value) + => new(value); + } + + public static TheoryData, ImmutableArray> OrderTestData + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + }; + + public static TheoryData, ImmutableArray> OrderTestData_OddBeforeEven + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + }; + + public static TheoryData, ImmutableArray> OrderDescendingTestData + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + }; + + public static TheoryData, ImmutableArray> OrderDescendingTestData_OddBeforeEven + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + }; + + public static TheoryData, ImmutableArray> OrderByTestData + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] }, + }; + + public static TheoryData, ImmutableArray> OrderByTestData_OddBeforeEven + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [1, 3, 5, 7, 9, 2, 4, 6, 8, 10] }, + }; + + public static TheoryData, ImmutableArray> OrderByDescendingTestData + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 9, 8, 7, 6, 5, 4, 3, 2, 1] }, + }; + + public static TheoryData, ImmutableArray> OrderByDescendingTestData_OddBeforeEven + => new() + { + { [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [1, 3, 5, 7, 9, 2, 4, 6, 8, 10], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [2, 5, 8, 1, 3, 9, 7, 4, 10, 6], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + { [6, 10, 4, 7, 9, 3, 1, 8, 5, 2], [10, 8, 6, 4, 2, 9, 7, 5, 3, 1] }, + }; + private static Func IsEven => x => x % 2 == 0; private static Func IsOdd => x => x % 2 != 0; @@ -253,4 +348,180 @@ public void SingleWithPredicate() Assert.Equal(42, builder.Single(IsEven)); Assert.Equal(42, builder.SingleOrDefault(IsEven)); } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void ToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrdered(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void ToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrdered(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void ToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedDescending(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedDescending(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void ToImmutableOrderedBy(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedBy(static x => x.Value); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void ToImmutableOrderedBy_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void ToImmutableOrderedByDescending(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void ToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.ToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData))] + public void DrainToImmutableOrdered(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrdered(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderTestData_OddBeforeEven))] + public void DrainToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrdered(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData))] + public void DrainToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedDescending(); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedDescending(OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData))] + public void DrainToImmutableOrderedBy(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByTestData_OddBeforeEven))] + public void DrainToImmutableOrderedBy_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value, OddBeforeEven); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData))] + public void DrainToImmutableOrderedByDescending(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value); + Assert.Equal(expected, sorted); + } + + [Theory] + [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] + public void DrainToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) + { + using var builder = new PooledArrayBuilder(capacity: data.Length); + builder.AddRange(data); + + var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); + Assert.Equal(expected, sorted); + } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs index 457b72c0988..6d4f984552a 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs @@ -1333,4 +1333,196 @@ private void MoveInlineItemsToBuilder() // Since _inlineCount tracks the number of inline items used, we zero it out here. _inlineCount = 0; } + + public readonly ImmutableArray ToImmutableOrdered() + { + var result = ToImmutable(); + result.Unsafe().Order(); + + return result; + } + + public readonly ImmutableArray ToImmutableOrdered(IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().Order(comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrdered(Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().Order(comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending() + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending(IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedDescending(Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderDescending(comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector, IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector, comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedBy(Func keySelector, Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderBy(keySelector, comparison); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector, IComparer comparer) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparer); + + return result; + } + + public readonly ImmutableArray ToImmutableOrderedByDescending(Func keySelector, Comparison comparison) + { + var result = ToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered() + { + var result = DrainToImmutable(); + result.Unsafe().Order(); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered(IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().Order(comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrdered(Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().Order(comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending() + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending(IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedDescending(Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderDescending(comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector, IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector, comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedBy(Func keySelector, Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderBy(keySelector, comparison); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector, IComparer comparer) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparer); + + return result; + } + + public ImmutableArray DrainToImmutableOrderedByDescending(Func keySelector, Comparison comparison) + { + var result = DrainToImmutable(); + result.Unsafe().OrderByDescending(keySelector, comparison); + + return result; + } } From 6045ef21ac6648cbad75fc5e2b19fb4ca0f501b0 Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Tue, 27 Aug 2024 08:52:17 -0700 Subject: [PATCH 169/271] Suppress unique ids (#10791) * Use more obvious SuppressUniqueIds value * Update baselines --- .../IncompleteDirectives_Runtime.codegen.cs | 2 +- .../IncompleteDirectives_Runtime.mappings.txt | 4 +- .../IncompleteDirectives_Runtime.codegen.cs | 2 +- ...odelExpressionTagHelper_Runtime.codegen.cs | 4 +- .../RazorPagesWithoutModel_Runtime.codegen.cs | 10 ++--- .../RazorPages_Runtime.codegen.cs | 10 ++--- .../Sections_Runtime.codegen.cs | 2 +- .../ViewComponentTagHelper_Runtime.codegen.cs | 2 +- .../BasicTest.codegen.cs | 4 +- .../IncompleteDirectives_Runtime.codegen.cs | 2 +- ...odelExpressionTagHelper_Runtime.codegen.cs | 4 +- .../RazorPage_WithCssScope.codegen.cs | 4 +- .../RazorPagesWithoutModel_Runtime.codegen.cs | 10 ++--- .../RazorPages_Runtime.codegen.cs | 10 ++--- .../RazorView_WithCssScope.codegen.cs | 4 +- .../Sections_Runtime.codegen.cs | 2 +- ...tTagHelperOptionalParam_Runtime.codegen.cs | 18 ++++----- .../ViewComponentTagHelper_Runtime.codegen.cs | 2 +- ...buteTargetingTagHelpers_Runtime.codegen.cs | 8 ++-- ...asicTagHelpers_Prefixed_Runtime.codegen.cs | 4 +- ...Helpers_RemoveTagHelper_Runtime.codegen.cs | 8 ++-- .../BasicTagHelpers_Runtime.codegen.cs | 8 ++-- .../CSharp7_Runtime.codegen.cs | 2 +- .../ComplexTagHelpers_Runtime.codegen.cs | 38 +++++++++---------- .../ConditionalAttributes2_Runtime.codegen.cs | 2 +- .../ConditionalAttributes_Runtime.codegen.cs | 2 +- ...ctorTagHelperAttributes_Runtime.codegen.cs | 20 +++++----- ...cateAttributeTagHelpers_Runtime.codegen.cs | 8 ++-- ...uplicateTargetTagHelper_Runtime.codegen.cs | 2 +- ...amicAttributeTagHelpers_Runtime.codegen.cs | 12 +++--- ...mptyAttributeTagHelpers_Runtime.codegen.cs | 6 +-- .../EnumTagHelpers_Runtime.codegen.cs | 10 ++--- .../EscapedExpression_Runtime.codegen.cs | 6 +-- .../EscapedIdentifier_Runtime.codegen.cs | 6 +-- .../EscapedTagHelpers_Runtime.codegen.cs | 2 +- ...CommentWithQuote_Double_Runtime.codegen.cs | 2 +- ...CommentWithQuote_Single_Runtime.codegen.cs | 2 +- .../IncompleteTagHelper_Runtime.codegen.cs | 2 +- ...CodeBlocksWithTagHelper_Runtime.codegen.cs | 4 +- ...ksWithTagHelper_Runtime.cs-diagnostics.txt | 6 +-- .../MinimizedTagHelpers_Runtime.codegen.cs | 14 +++---- ...stedScriptTagTagHelpers_Runtime.codegen.cs | 4 +- .../NestedTagHelpers_Runtime.codegen.cs | 6 +-- .../OpenedIf_Runtime.codegen.cs | 2 +- ...ixedAttributeTagHelpers_Runtime.codegen.cs | 8 ++-- .../SimpleTagHelpers_Runtime.codegen.cs | 2 +- ...NewlineBeforeAttributes_Runtime.codegen.cs | 2 +- .../SingleTagHelper_Runtime.codegen.cs | 2 +- .../SymbolBoundAttributes_Runtime.codegen.cs | 14 +++---- .../TagHelpersInSection_Runtime.codegen.cs | 6 +-- ...persWithBoundAttributes_Runtime.codegen.cs | 2 +- ...sWithDataDashAttributes_Runtime.codegen.cs | 4 +- .../TagHelpersWithPrefix_Runtime.codegen.cs | 2 +- .../TagHelpersWithTemplate_Runtime.codegen.cs | 6 +-- ...WeirdlySpacedAttributes_Runtime.codegen.cs | 8 ++-- ...nsInTagHelperAttributes_Runtime.codegen.cs | 12 +++--- .../IntegrationTests/IntegrationTestBase.cs | 2 +- 57 files changed, 176 insertions(+), 176 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 470f2a28c4d..65462825454 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -35,7 +35,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete #line default #line hidden - Member_test { get; private set; } + Member___UniqueIdSuppressedForTesting__ { get; private set; } #line (7,9)-(7,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt index 61ba7c7637a..8fa27285b80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.mappings.txt @@ -5,11 +5,11 @@ Generated Location: (1895:33,0 [9] ) Source Location: (123:6,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2096:39,0 [0] ) +Generated Location: (2124:39,0 [0] ) || Source Location: (113:5,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2233:43,0 [0] ) +Generated Location: (2261:43,0 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 4044c13d2f1..9760efcc988 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -57,7 +57,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete #line default #line hidden - Member_test { get; private set; } + Member___UniqueIdSuppressedForTesting__ { get; private set; } #line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" #line default diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs index af9cb84cea6..65503cb77d7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs @@ -49,7 +49,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre WriteLiteral("\r\n"); EndContext(); BeginContext(66, 25, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre WriteLiteral("\r\n"); EndContext(); BeginContext(93, 27, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs index 0b2b650d335..85100fe90d8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n

New Customer

\r\n
\r\n "); EndContext(); BeginContext(456, 31, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -78,7 +78,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(493, 237, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(517, 48, true); WriteLiteral("\r\n \r\n "); EndContext(); BeginContext(588, 130, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(611, 101, true); WriteLiteral("\r\n \r\n \r\n "); EndContext(); @@ -132,12 +132,12 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(736, 174, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(760, 10, true); WriteLiteral("\r\n "); EndContext(); BeginContext(770, 128, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(809, 83, true); WriteLiteral("\r\n \r\n "); EndContext(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs index 417e4c21079..bd1654c914b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n

New Customer

\r\n\r\n "); EndContext(); BeginContext(551, 31, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -78,7 +78,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(588, 243, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(612, 48, true); WriteLiteral("\r\n \r\n "); EndContext(); BeginContext(689, 130, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(712, 101, true); WriteLiteral("\r\n \r\n \r\n "); EndContext(); @@ -132,12 +132,12 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n "); EndContext(); BeginContext(837, 174, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(861, 10, true); WriteLiteral("\r\n "); EndContext(); BeginContext(871, 128, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(910, 83, true); WriteLiteral("\r\n \r\n "); EndContext(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index 9544b7fdd5f..d6cda67f0f4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -63,7 +63,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : WriteLiteral("\r\n
This is in Section 1
\r\n "); EndContext(); BeginContext(205, 25, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs index acca84c3a07..ed19fdfc28c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs @@ -55,7 +55,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon WriteLiteral("\r\n"); EndContext(); BeginContext(61, 50, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs index 6812ca87c29..be031f1c937 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version2_X/test/TestFiles/IntegrationTests/InstrumentationPassIntegrationTest/BasicTest.codegen.cs @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_Basic EndContext(); BeginContext(71, 87, false); BeginContext(71, 87, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { BeginContext(91, 6, true); BeginContext(91, 6, true); WriteLiteral("\r\n "); @@ -77,7 +77,7 @@ public class TestFiles_IntegrationTests_InstrumentationPassIntegrationTest_Basic EndContext(); BeginContext(97, 52, false); BeginContext(97, 52, false); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 641f07ac3e4..abe84baa4bf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -44,7 +44,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete #line default #line hidden #nullable disable - Member_test { get; private set; } + Member___UniqueIdSuppressedForTesting__ { get; private set; } = default!; #nullable restore #line (11,9)-(11,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs index 737f6dc2ace..eed476b253a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre { WriteLiteral("\r\n"); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); @@ -70,7 +70,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpre Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.codegen.cs index 67004f5a5e1..29a19e954bd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.codegen.cs @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo #nullable disable WriteLiteral("
\r\n

Welcome

\r\n

Learn about building Web apps with ASP.NET Core.

\r\n
\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n"); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs index 22f235cc89d..026dff36502 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n"); WriteLiteral("\r\n"); WriteLiteral("\r\n

New Customer

\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -72,7 +72,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n \r\n "); } ); @@ -112,9 +112,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs index a029a343a45..4a73f56e094 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages WriteLiteral("\r\n"); WriteLiteral("\r\n"); WriteLiteral("\r\n

New Customer

\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -72,7 +72,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n \r\n "); } ); @@ -112,9 +112,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs index cd3b23a0f11..0cf08bfd880 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo #nullable disable WriteLiteral("
\r\n

Welcome

\r\n

Learn about building Web apps with ASP.NET Core.

\r\n
\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("all", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : glo Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("form", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n"); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index dacf79c54db..cea3d1aee85 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -59,7 +59,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : WriteLiteral("\r\n
Some body
\r\n\r\n"); DefineSection("Section1", async() => { WriteLiteral("\r\n
This is in Section 1
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTestTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs index 377646cfe7d..7794ab8fd83 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs @@ -48,7 +48,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalTestViewComponentTagHelper = CreateTagHelper(); @@ -61,7 +61,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalTestViewComponentTagHelper = CreateTagHelper(); @@ -84,7 +84,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); @@ -102,7 +102,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); @@ -130,7 +130,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); @@ -143,7 +143,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); @@ -186,7 +186,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); @@ -219,7 +219,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); @@ -262,7 +262,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs index 56a0795ba61..9e2e46abc1e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs @@ -57,7 +57,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon #nullable disable WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __AllTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs index d5cabab89c3..3043c54536f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs @@ -52,9 +52,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("strong", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("strong", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Hello"); } ); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("World

\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -98,7 +98,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs index 0221050c13c..b2e32e22f4e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs @@ -50,9 +50,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs index 1393a8a5025..ec6dc9cebc1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs @@ -51,9 +51,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -66,7 +66,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -85,7 +85,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs index 402316266c1..532a0f124ed 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs @@ -53,9 +53,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -102,7 +102,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHe Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs index 95477dd0bdb..bd80f3c83a2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs @@ -45,7 +45,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("body", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n"); #nullable restore #line (2,7)-(8,9) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 513c0353eae..85a29517773 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -68,7 +68,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral("
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); @@ -130,7 +130,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

Set Time:

\r\n"); #nullable restore #line (11,14)-(13,1) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" @@ -142,9 +142,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("New Time: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -187,9 +187,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Current Time: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -239,7 +239,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -268,7 +268,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -348,7 +348,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n"); #nullable restore #line (23,15)-(23,36) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" @@ -359,7 +359,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -422,9 +422,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -487,9 +487,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagOnly, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -536,9 +536,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -609,8 +609,8 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable item => new global::Microsoft.AspNetCore.Mvc.Razor.HelperResult(async(__razor_template_writer) => { PushWriter(__razor_template_writer); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -668,7 +668,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTag #nullable disable ); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs index bfdfcbda387..bea2dc40c02 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs @@ -215,7 +215,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Conditiona ), 289, 25, false); EndWriteAttribute(); WriteLiteral(" />\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs index c1bbb67fd09..5d39602f9ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs @@ -151,7 +151,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Conditiona ), 256, 25, false); EndWriteAttribute(); WriteLiteral(" />\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs index 42a9dffd1e3..d8b78779e99 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs @@ -60,7 +60,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers."); } ); @@ -77,7 +77,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper."); } ); @@ -92,7 +92,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers"); } ); @@ -109,7 +109,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("2 TagHelpers"); } ); @@ -138,7 +138,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n0 TagHelpers.\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -164,7 +164,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -179,7 +179,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("a", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("1 TagHelper"); } ); @@ -205,7 +205,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -227,7 +227,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper2 = CreateTagHelper(); @@ -245,7 +245,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelecto Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper2 = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs index 02d1285c41e..970cd93696c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -57,9 +57,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -79,7 +79,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -110,7 +110,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateA Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs index 9187b068bd6..7f3d34603a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs @@ -48,7 +48,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs index 151e828a910..b23c4b4fa53 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs @@ -46,7 +46,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -71,7 +71,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -131,7 +131,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -172,7 +172,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -315,7 +315,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -359,7 +359,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAtt Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs index 172586535bc..04ba3dfb0da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs @@ -50,7 +50,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttri public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n
\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -79,9 +79,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttri Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs index 34161e8ccd5..8507277ecc7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -57,7 +57,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel #nullable disable WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -82,7 +82,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -108,7 +108,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -133,7 +133,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -168,7 +168,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHel Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs index c752c653108..eb90674c363 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs @@ -46,7 +46,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -69,7 +69,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -92,7 +92,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExp Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs index b97277b2108..2b20a74bbe3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs @@ -58,7 +58,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde #line hidden #nullable disable - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -91,7 +91,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); @@ -124,7 +124,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIde Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs index e2a818c275d..19b047d3be6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs @@ -62,7 +62,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTag WriteLiteral("input type=\"text\" />\r\n <"); WriteLiteral("em>Not a TagHelper: "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs index 81126e4108e..a7bc9e25980 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommen public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs index b88b00e29fe..693d546a7ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommen public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("img", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs index e279225f6e1..6f8cd813b2b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs @@ -47,7 +47,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Incomplete public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_PTagHelper = CreateTagHelper(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs index 5731be96cfe..2e8972ab128 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs @@ -61,7 +61,7 @@ void PrintName(Person person) #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { Write( #nullable restore #line (10,15)-(10,26) "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml" @@ -123,7 +123,7 @@ Task AnnounceBirthday(Person person) #nullable disable WriteLiteral(" "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n

Happy birthday "); Write( #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt index 14a65a3b3ed..8abdb160933 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.cs-diagnostics.txt @@ -4,9 +4,9 @@ Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await __tagHelperRunne // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(81,17): error CS4033: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // await __tagHelperExecutionContext.SetOutputContentAsync(); Diagnostic(ErrorCode.ERR_BadAwaitWithoutVoidAsyncMethod, "await __tagHelperExecutionContext.SetOutputContentAsync()").WithLocation(81, 17), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(126,165): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. -// __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { -Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(126, 165), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(126,193): warning CS1998: This async method lacks 'await' operators and will run synchronously. Consider using the 'await' operator to await non-blocking API calls, or 'await Task.Run(...)' to do CPU-bound work on a background thread. +// __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { +Diagnostic(ErrorCode.WRN_AsyncLacksAwaits, "=>").WithLocation(126, 193), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml(142,9): error CS4032: The 'await' operator can only be used within an async method. Consider marking this method with the 'async' modifier and changing its return type to 'Task'. // await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); Diagnostic(ErrorCode.ERR_BadAwaitWithoutAsyncMethod, "await __tagHelperRunner.RunAsync(__tagHelperExecutionContext)").WithArguments("System.Threading.Tasks.Task").WithLocation(142, 9), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs index b50b06f40ef..685f4fa6bdb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs @@ -55,9 +55,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n"); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("p", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("\r\n \r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_CatchAllTagHelper = CreateTagHelper(); @@ -74,7 +74,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -98,7 +98,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -124,7 +124,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("input", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.SelfClosing, "__UniqueIdSuppressedForTesting__", async() => { } ); __TestNamespace_InputTagHelper = CreateTagHelper(); @@ -147,7 +147,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { } ); __DivTagHelper = CreateTagHelper(); @@ -168,7 +168,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedT Write(__tagHelperExecutionContext.Output); __tagHelperExecutionContext = __tagHelperScopeManager.End(); WriteLiteral("\r\n "); - __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { + __tagHelperExecutionContext = __tagHelperScopeManager.Begin("div", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "__UniqueIdSuppressedForTesting__", async() => { WriteLiteral("Tag helper with unmatched bound boolean attributes."); } ); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs index 31d02abb628..6d3392ac954 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs @@ -51,7 +51,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScri public async override global::System.Threading.Tasks.Task ExecuteAsync() { WriteLiteral("\r\n + + +} \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml new file mode 100644 index 00000000000..7cefd6acf19 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml @@ -0,0 +1,54 @@ +@page +@model Model +@{ + ViewBag.Title = "This is a title"; + ViewBag.HeaderTitle = "This is a header title"; + ViewBag.HeaderBackground = "#003459"; + ViewBag.HeaderForeground = "#FFFFFF"; + + if (Model.ChartName.Length == 0) + { + ViewBag.ShowChart = false; + } +} + +@section Scripts { + + + +} \ No newline at end of file From e5160528c353242c81233903e8222fb9d406375a Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 28 Aug 2024 14:21:26 +1000 Subject: [PATCH 183/271] Improve integration tests --- .../Formatting/FormatDocumentTests.cs | 44 ++++++++++--------- 1 file changed, 24 insertions(+), 20 deletions(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs index 4ffa1015ba4..7d7b23d949a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/FormatDocumentTests.cs @@ -24,27 +24,11 @@ public class FormatDocumentTests(ITestOutputHelper testOutputHelper) : AbstractR // If you want to generate the "after" state simple run the test without // creating the expected file, and it will be generated for you. // - // Things that aren't (yet?) supported: - // * Formatting must change the input state or the test will hang - // ie. these tests cannot be used for pure validation - // * Test input is always placed in a .razor file, so .cshtml specific - // quirks can't be validated - // - // You'll just have to write tests for those ones :P + // NOTE: Formatting must change the input state or the test will hang + // ie. these tests cannot be used for pure validation [IdeTheory] - [InlineData("BadlyFormattedCounter.razor")] - [InlineData("FormatCommentWithKeyword.cshtml")] - [InlineData("FormatDocument.cshtml")] - [InlineData("FormatDocumentAfterEdit.cshtml")] - [InlineData("FormatDocumentWithTextAreaAttributes.cshtml")] - [InlineData("FormatIfBlockInsideForBlock.cshtml")] - [InlineData("FormatOnPaste.cshtml")] - [InlineData("FormatOnPasteContainedLanguageCode.cshtml")] - [InlineData("FormatSelection.cshtml")] - [InlineData("FormatSelectionStartingWithContainedLanguageCode.cshtml")] - [InlineData("FormatSwitchCaseBlock.cshtml")] - [InlineData("RazorInCssClassAttribute.cshtml")] + [MemberData(nameof(GetFormattingTestResourceNames))] public async Task FormattingDocument(string testFileName) { var inputResourceName = GetResourceName(testFileName, "Input"); @@ -92,8 +76,11 @@ public async Task FormattingDocument(string testFileName) AssertEx.EqualOrDiff(expected, actual); } + private static string GetResourceBaseName() + => $"{typeof(FormatDocumentTests).Namespace}.Formatting.TestFiles"; + private static string GetResourceName(string name, string suffix) - => $"{typeof(FormatDocumentTests).Namespace}.Formatting.TestFiles.{suffix}.{name}"; + => $"{GetResourceBaseName()}.{suffix}.{name}"; private static bool TryGetResource(string name, [NotNullWhen(true)] out string? value) { @@ -112,4 +99,21 @@ private static bool TryGetResource(string name, [NotNullWhen(true)] out string? return true; } + + public static TheoryData GetFormattingTestResourceNames() + { + var baseName = $"{GetResourceBaseName()}.Input."; + var data = new TheoryData(); + var names = typeof(FormatDocumentTests).Assembly.GetManifestResourceNames(); + + foreach (var name in names) + { + if (name.StartsWith(baseName)) + { + data.Add(Path.GetFileName(name)[baseName.Length..]); + } + } + + return data; + } } From eba6a6a303e420992b5fbf13ee4e84fa0fa79fbf Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 28 Aug 2024 14:21:37 +1000 Subject: [PATCH 184/271] Test for some edges just in case --- .../Formatting_NetFx/HtmlFormattingTest.cs | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs index 08f596cf0ad..6ef32d08326 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs @@ -211,6 +211,38 @@ This is heavily nested """); } + [Fact] + public async Task FormatAttributeStyles() + { + await RunFormattingTestAsync( + input: """ +
Some Text
+
Some Text
+
Some Text
+
Some Text
+
Some Text
+ +
+
+
+
+
+ """, + expected: """ +
Some Text
+
Some Text
+
Some Text
+
Some Text
+
Some Text
+ +
+
+
+
+
+ """); + } + [Fact] public async Task FormatsMixedRazorBlock() { From acb9a8e19d3a4ac31d422580463c6bccc7c39ded Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 28 Aug 2024 15:01:34 +1000 Subject: [PATCH 185/271] Update compiler test baselines --- ...iveWithViewImports_DesignTime.codegen.html | 2 +- .../BasicComponent_DesignTime.codegen.html | 10 +- .../Basic_DesignTime.codegen.html | 8 +- ...completeDirectives_DesignTime.codegen.html | 22 ++-- .../InheritsViewModel_DesignTime.codegen.html | 4 +- ...itsWithViewImports_DesignTime.codegen.html | 4 +- .../InjectWithModel_DesignTime.codegen.html | 6 +- ...njectWithSemicolon_DesignTime.codegen.html | 10 +- .../Inject_DesignTime.codegen.html | 2 +- ...alidNamespaceAtEOF_DesignTime.codegen.html | 2 +- ...ormedPageDirective_DesignTime.codegen.html | 2 +- ...xpressionTagHelper_DesignTime.codegen.html | 8 +- .../Model_DesignTime.codegen.html | 2 +- .../MultipleModels_DesignTime.codegen.html | 4 +- .../PageWithNamespace_DesignTime.codegen.html | 4 +- ...adingPageDirective_DesignTime.codegen.html | 2 +- ...lableModel_LangNew_DesignTime.codegen.html | 10 +- ...NullableModel_LangNew_Runtime.codegen.html | 10 +- ...lableModel_LangOld_DesignTime.codegen.html | 10 +- ...NullableModel_LangOld_Runtime.codegen.html | 10 +- ...lableModel_LangNew_DesignTime.codegen.html | 10 +- ...NullableModel_LangNew_Runtime.codegen.html | 10 +- ...lableModel_LangOld_DesignTime.codegen.html | 10 +- ...NullableModel_LangOld_Runtime.codegen.html | 10 +- ...sWithRouteTemplate_DesignTime.codegen.html | 14 +-- ...rPagesWithoutModel_DesignTime.codegen.html | 22 ++-- .../RazorPages_DesignTime.codegen.html | 26 ++-- .../Sections_DesignTime.codegen.html | 10 +- .../UsingDirectives_DesignTime.codegen.html | 8 +- ...ComponentTagHelper_DesignTime.codegen.html | 6 +- .../ViewWithNamespace_DesignTime.codegen.html | 2 +- .../_ViewImports_DesignTime.codegen.html | 2 +- ...TagHelperDirective_DesignTime.codegen.html | 2 +- ...AttributeDirective_DesignTime.codegen.html | 8 +- ...argetingTagHelpers_DesignTime.codegen.html | 6 +- .../Await_DesignTime.codegen.html | 30 ++--- .../BasicTagHelpers_DesignTime.codegen.html | 6 +- ...agHelpers_Prefixed_DesignTime.codegen.html | 6 +- ...rs_RemoveTagHelper_DesignTime.codegen.html | 6 +- .../Blocks_DesignTime.codegen.html | 28 ++--- .../CSharp7_DesignTime.codegen.html | 44 +++---- .../CSharp8_DesignTime.codegen.html | 66 +++++----- ...ockWithTextElement_DesignTime.codegen.html | 2 +- .../CodeBlock_DesignTime.codegen.html | 4 +- .../ComplexTagHelpers_DesignTime.codegen.html | 40 +++--- ...itionalAttributes2_DesignTime.codegen.html | 28 ++--- ...ditionalAttributes_DesignTime.codegen.html | 18 +-- ...agHelperAttributes_DesignTime.codegen.html | 6 +- .../DesignTime_DesignTime.codegen.html | 10 +- ...ttributeTagHelpers_DesignTime.codegen.html | 6 +- ...ateTargetTagHelper_DesignTime.codegen.html | 4 +- ...ttributeTagHelpers_DesignTime.codegen.html | 16 +-- ...ttributeTagHelpers_DesignTime.codegen.html | 2 +- .../EnumTagHelpers_DesignTime.codegen.html | 14 +-- .../EscapedExpression_DesignTime.codegen.html | 8 +- .../EscapedIdentifier_DesignTime.codegen.html | 16 +-- .../EscapedTagHelpers_DesignTime.codegen.html | 4 +- ...ExplicitExpression_DesignTime.codegen.html | 2 +- .../ExpressionsInCode_DesignTime.codegen.html | 14 +-- ...ctionsBlockMinimal_DesignTime.codegen.html | 6 +- .../FunctionsBlock_DesignTime.codegen.html | 12 +- .../HiddenSpansInCode_DesignTime.codegen.html | 2 +- .../Implements_DesignTime.codegen.html | 6 +- ...ImplicitExpression_DesignTime.codegen.html | 2 +- ...completeDirectives_DesignTime.codegen.html | 36 +++--- ...ncompleteTagHelper_DesignTime.codegen.html | 2 +- .../Inherits_DesignTime.codegen.html | 4 +- .../InlineBlocks_DesignTime.codegen.html | 4 +- .../Instrumented_DesignTime.codegen.html | 28 ++--- .../MarkupInCodeBlock_DesignTime.codegen.html | 4 +- ...locksWithTagHelper_DesignTime.codegen.html | 38 +++--- ...arkup_InCodeBlocks_DesignTime.codegen.html | 34 ++--- ...inimizedTagHelpers_DesignTime.codegen.html | 2 +- .../NestedCSharp_DesignTime.codegen.html | 4 +- .../NestedCodeBlocks_DesignTime.codegen.html | 4 +- ...criptTagTagHelpers_DesignTime.codegen.html | 6 +- .../NestedTagHelpers_DesignTime.codegen.html | 2 +- .../NoLinePragmas_DesignTime.codegen.html | 30 ++--- ...itionalExpressions_DesignTime.codegen.html | 16 +-- .../OpenedIf_DesignTime.codegen.html | 2 +- .../ParserError_DesignTime.codegen.html | 4 +- ...ttributeTagHelpers_DesignTime.codegen.html | 18 +-- .../RazorComments_DesignTime.codegen.html | 18 +-- ...TagHelperDirective_DesignTime.codegen.html | 2 +- .../Sections_DesignTime.codegen.html | 12 +- .../SimpleTagHelpers_DesignTime.codegen.html | 2 +- .../SimpleUnspacedIf_DesignTime.codegen.html | 2 +- ...trolFlowStatements_DesignTime.codegen.html | 116 +++++++++--------- ...neBeforeAttributes_DesignTime.codegen.html | 4 +- .../SingleTagHelper_DesignTime.codegen.html | 4 +- .../StringLiterals_DesignTime.codegen.html | 4 +- ...n_RecursivePattern_DesignTime.codegen.html | 18 +-- ...bolBoundAttributes_DesignTime.codegen.html | 10 +- ...agHelpersInSection_DesignTime.codegen.html | 12 +- ...ithBoundAttributes_DesignTime.codegen.html | 4 +- ...DataDashAttributes_DesignTime.codegen.html | 4 +- ...gHelpersWithPrefix_DesignTime.codegen.html | 6 +- ...elpersWithTemplate_DesignTime.codegen.html | 18 +-- ...lySpacedAttributes_DesignTime.codegen.html | 8 +- .../Templates_DesignTime.codegen.html | 40 +++--- ...agHelperAttributes_DesignTime.codegen.html | 18 +-- ...edExpressionInCode_DesignTime.codegen.html | 2 +- .../Usings_DesignTime.codegen.html | 20 +-- .../Usings_OutOfOrder_DesignTime.codegen.html | 34 ++--- 104 files changed, 641 insertions(+), 641 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html index 5d66b1d977c..31b236ec01c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~ \ No newline at end of file +/*~~~~~~*/ /*~~~~~~~~~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html index 29671e2e94e..d50f0aa7edc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicComponent_DesignTime.codegen.html @@ -1,9 +1,9 @@ -~~~~~~~~~~~ ~~~~~~~~~~~ -
+/*~~~~~~~*/ /*~~~~~~~*/ +
Hello world - ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + /*~~~~~~~~~~~~~~~~~*/ /*~~~~*/
-~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~ ~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~*/ ~ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html index 24e2e736663..5ed5d03cb0a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.html @@ -1,8 +1,8 @@ -
+
Hello world - ~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ + /*~~~~~~~~~~~~~~~~~*/ /*~~~~*/
~~ - ~~~ ~~~ ~ ~~~~~~ + ~~~ ~~~ ~ /*~~*/ ~ -

+

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html index 3b4d82ad8bf..b7aa7c9942e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -1,15 +1,15 @@ -~~ ~~~~~ ~~~~ ~~~~~ ~~~~~~~~ ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~ ~~ +~~ /*~*/ /**/ /*~*/ /*~~~~*/ /**/ /*~~~~~~~*/ /*~~~~~~*/ /*~~~~~~*/ /*~*/ /*~~*/ ~~ -~~~~~ -~~~~~ -~~~~~ " +/*~*/ +/*~*/ +/*~*/ " -~~~~~~ -~~~~~~ +/*~~*/ +/*~~*/ -~~~~~~~ -~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ +/*~~~*/ +/*~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ -~~~~~~~~~~ -~~~~~~~~~~ +/*~~~~~~*/ +/*~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html index d4a60595cdc..91063890b07 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~ +/*~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html index 496639ef56f..3bd4c5872cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~ -~~~~~~ ~~~~~~~ +/*~*/ +/*~~*/ /*~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html index 981eb0e1f2f..cfb2e63f00b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~ ~~~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~ +/*~~*/ /*~~~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ /**/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html index ceeac4385ba..d9302bcff03 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~ ~~~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~~ ~ -~~~~~~~ ~~~~~~~~~~~~~~~~~ ~~~~~ ~ +/*~~*/ /*~~~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~~*/ +/*~~~*/ /*~~~~~~~~~~~~~*/ /*~*/ +/*~~~*/ /*~*/ /*~~~~~~~~~~~*/ ~ +/*~~~*/ /*~~~~~~~~~~~~~*/ /*~*/ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html index 0dc8f50e6be..f4385cddb0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~ ~~~~~ ~~~~~~~~~~~~~~ +/*~~~*/ /*~*/ /*~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html index 626e2018bdd..76e928baf80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~ Test. \ No newline at end of file +/*~~~~~~*/ Test. \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html index df04496106b..a7889e3c07e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~ "foo +/*~*/ "foo

About Us

We are awesome.

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html index 9ac477264fa..d960ab45c14 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~ ~~~~~~~~ +/*~~*/ /*~~~~*/ -~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ +/*~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ /*~~~~*/ - - + + diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html index a35472a2d2f..2d38dc6a64c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html index a707958a381..cdc19a67ddf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html index 62560e0be27..6e90b5c956b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~ +/*~*/ +/*~~~~~~*/ /*~~~~~~~~~~*/

Hi There!

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html index 236c4e85314..0266c6d5a88 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.codegen.html @@ -1,2 +1,2 @@ 
Some text here.
-~~~~~ +/*~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html index c696270a401..4cbbdb41940 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html index 0de886d9a8d..6db933daefa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.html @@ -1,7 +1,7 @@ -~~~~~ -~~~~~~ ~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ +/*~*/ +/*~~*/ /*~~~~~~~~~*/ +/*~~*/ /*~~~~~~*/ -

~~~~~~~~~~~

+

/*~~~~~~~*/

-

~~~~~~~~~~~~~~~

\ No newline at end of file +

/*~~~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html index 02367c51f7e..ed8901a2a44 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.html @@ -1,13 +1,13 @@ -~~~~~ ~~~~~~~~ +/*~*/ /*~~~~*/ -~~~~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ ~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~*/ ~ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ -

New Customer ~~~~~~~~~~~

+

New Customer /*~~~~~~~*/

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html index daab158b7d1..56b48a10d01 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.html @@ -1,20 +1,20 @@ -~~~~~ +/*~*/ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~~~~~~~~~*/ /*~~~~~~~~~~~*/ /*~~~~~*/ ~ - ~~~~ ~ ~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /**/ ~ /*~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ + /*~~*/ /*~*/ /*~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ @@ -22,7 +22,7 @@

New Customer

- +
diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html index 64f7eac8c2a..deaa4ef67ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.html @@ -1,24 +1,24 @@ -~~~~~ +/*~*/ -~~~~~~ ~~~~~~~~ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~*/ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ ~ ~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~*/ ~ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~ ~~~~~~~~~ + /*~~*/ /*~~~~~~~~~*/ /*~~~~~~~~~~~*/ /*~~~~~*/ ~ - ~~~~ ~ ~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /**/ ~ /*~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~ + /*~~*/ /*~*/ /*~~~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ ~ ~ @@ -26,7 +26,7 @@

New Customer

- +
diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html index dde1bb31217..9e7818b9ab4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.html @@ -1,14 +1,14 @@ -~~~~~~ ~~~~~~~~ +/*~~*/ /*~~~~*/ -~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~ +/*~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ /*~~~~*/ ~~ - ~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /*~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~
Some body
-~~~~~~~~ ~~~~~~~~ ~ +/*~~~~*/ /*~~~~*/ ~
This is in Section 1
- + ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html index ade006860ec..0764100ac8d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~~~~~~~~~ -~~~~~~ ~~~~~~ -~~~~~~ ~~~~~~ \ No newline at end of file +/*~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~*/ /*~~~~~~~~~~~~~~*/ +/*~~*/ /*~~*/ +/*~~*/ /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html index 8027d8fb1b8..772a14b598b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~*/ ~~ - ~~~ ~~~ ~ ~~~~~~~~ + ~~~ ~~~ ~ /*~~~~*/ ~ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html index 63bfdf58d91..1c4043833a8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.html @@ -1,2 +1,2 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~ +/*~~~~~~*/ /*~~~~~~~~~~*/

Hi There!

diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html index a9823b39aac..b5872a65558 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~ \ No newline at end of file +/*~~~*/ /*~~~~~~~~~~~~~~~*/ /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html index 36ca9ed4def..c29aeeb42f8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.html @@ -1 +1 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html index b0994b12416..4538c8e34a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.html @@ -1,6 +1,6 @@ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~*/ +/*~~~~~~*/ /*~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~~*/ Hello World \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html index 29fdc470b4e..94086a0e60e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.html @@ -1,8 +1,8 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/

HelloWorld

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html index 2cd2f153d8a..39991e0bcb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.html @@ -1,26 +1,26 @@ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~~~~~~~~~~~~ ~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ /*~~~~~~~~*/ /*~*/ ~ - ~~~~~~ ~~~~~~ + /*~~*/ /*~~*/ ~ ~

Basic Asynchronous Expression Test

-

Basic Asynchronous Expression: ~~~~~~ ~~~~~

-

Basic Asynchronous Template: ~~~~~~~ ~~~~~~

-

Basic Asynchronous Statement: ~~ ~~~~~ ~~~~~~ ~

-

Basic Asynchronous Statement Nested: ~~ ~~~~~~ ~~~~~ ~

-

Basic Incomplete Asynchronous Statement: ~~~~~~

+

Basic Asynchronous Expression: /*~~*/ /*~*/

+

Basic Asynchronous Template: /*~~~*/ /*~~*/

+

Basic Asynchronous Statement: ~~ /*~*/ /*~~*/ ~

+

Basic Asynchronous Statement Nested: ~~ /*~~*/ /*~*/ ~

+

Basic Incomplete Asynchronous Statement: /*~~*/

Advanced Asynchronous Expression Test

-

Advanced Asynchronous Expression: ~~~~~~ ~~~~~~ ~~

-

Advanced Asynchronous Expression Extended: ~~~~~~ ~~~~~~~~~~ ~~

-

Advanced Asynchronous Template: ~~~~~~~ ~~~~~~~~~~ ~~~~~~

-

Advanced Asynchronous Statement: ~~ ~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~

-

Advanced Asynchronous Statement Extended: ~~ ~~~~~ ~~~~~~~~~~ ~~ ~

-

Advanced Asynchronous Statement Nested: ~~ ~~~~~~ ~~~~~~~~~~~~~~ ~~~~~~ ~

-

Advanced Incomplete Asynchronous Statement: ~~~~~~ ~~~~~~~~~~~~~

+

Advanced Asynchronous Expression: /*~~*/ /*~~*/ ~~

+

Advanced Asynchronous Expression Extended: /*~~*/ /*~~~~~~*/ ~~

+

Advanced Asynchronous Template: /*~~~*/ /*~~~~~~*/ /*~~*/

+

Advanced Asynchronous Statement: ~~ /*~*/ /*~~~~~~~~~~*/ /*~~*/ /*~~~~~*/ ~

+

Advanced Asynchronous Statement Extended: ~~ /*~*/ /*~~~~~~*/ ~~ ~

+

Advanced Asynchronous Statement Nested: ~~ /*~~*/ /*~~~~~~~~~~*/ /*~~*/ ~

+

Advanced Incomplete Asynchronous Statement: /*~~*/ /*~~~~~~~~~*/

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html index a7977c2f3eb..a1b48a80492 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.html @@ -1,9 +1,9 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html index 83791946e75..64cc9386aad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.html @@ -1,10 +1,10 @@ -~~~~~~~~~~~~~~~~ ~~~~~ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~~~~*/ /*~*/ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- +
\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html index 241c86f381f..ed4d8edb834 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.html @@ -1,10 +1,10 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ ~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ /*~~~~~~~~~~*/ /*~*/

- +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html index c8e3d6d849d..eb6ccef7af1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.html @@ -2,36 +2,36 @@ ~~~ ~ ~ ~~ ~ -~~~~~~~~ ~~ ~~~ ~ -

Hello from C#, #~~~~

+/*~~~~*/ ~~ ~~~ ~ +

Hello from C#, #/**/

~ ~~ ~~ ~ -~~~~~ ~~ ~~~ ~ +/*~*/ ~~ ~~~ ~

We wrote 10 lines!

~ -~~~~~~~~~~ ~ - ~~~~ ~~~ +/*~~~~~~*/ ~ + /**/ ~~~

No really, we wrote 10 lines!

- ~~~~~~ - ~~~~~~~~ + /*~~*/ + /*~~~~*/

Actually, we didn't...

- ~~~~~~ + /*~~*/ ~ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ -

Hello again from C#, #~~~~

+/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ +

Hello again from C#, #/**/

~ -~~~~ ~ +/**/ ~

That time, we wrote 5 lines!

-~ ~~~~~~~~~~~~~~~ ~~~ ~ -

Oh no! An error occurred: ~~~~~~~~~~~~~

+~ /*~~~~~~~~~~~*/ ~~~ ~ +

Oh no! An error occurred: /*~~~~~~~~~*/

~

i is now ~~

-~~~~~~~~~ ~~~~~~~~~ ~ +/*~~~~~*/ /*~~~~~*/ ~

This block is locked, for your security!

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html index bbfa490f37a..a3f50faa4ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.html @@ -1,43 +1,43 @@  ~~ - ~~~ ~~~~~~~~~~ ~ ~~~ ~~~~~~~~~~~~~~~~~~ ~~~~~~~ ~~~~~~~~~~ ~~~~~~ ~~~~~~~~~ ~~~~~~ ~~~~~~~~~ + ~~~ /*~~~~~~*/ ~ ~~~ /*~~~~~~~~~~~~~~*/ /*~~~*/ /*~~~~~~*/ /*~~*/ /*~~~~~*/ /*~~*/ /*~~~~~*/ ~ - ~~~~~~ ~~~~~ ~ ~~~~~~~~ ~~~~~~ ~~~~~ + /*~~*/ /*~*/ ~ /*~~~~*/ /*~~*/ /*~*/ ~~ - ~~ ~~~~ ~~ ~~~ ~~ ~ ~~~~ ~~~~ ~~~~~~ ~~~~~ ~~ + ~~ /**/ ~~ ~~~ ~~ ~ /**/ /**/ /*~~*/ /*~*/ ~~ - ~~~ ~~~~~~~ ~ ~~~~~~~~~~~~ - ~~~~ ~~~~~~~~~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~~ ~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ /*~~~*/ ~ /*~~~~~~~~*/ + /**/ /*~~~~~~~~~~~~~~~*/ ~ /*~~~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~*/ + /*~~~*/ /*~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~ ~~~ ~~~ ~~~~~~~ + ~~~ /*~~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~*/ ~~~ ~~~ /*~~~*/ ~ - ~~ ~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~ + ~~ /*~~~~~~~~*/ ~~ /**/ /*~~*/ ~ - ~~ ~~ ~~~~~~~~~ + ~~ ~~ /*~~~~~*/ ~ ~

- Here's a very unique number: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + Here's a very unique number: /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/

- ~~~~~~~~~ ~~~~~~~ ~~~~~ ~~~~~~~~~~~~~ ~~ ~~~~~ ~~~~~~ ~~ + /*~~~~~*/ /*~~~*/ /*~*/ /*~~~~~~~~~*/ ~~ /*~*/ /*~~*/ ~~
- ~~~~~~~ ~~~~~~~~~~~~~ + /*~~~*/ /*~~~~~~~~~*/ ~ - ~~~~ ~~~ ~~~~ - ~~ ~~ ~~~~~~~~~ - ~~~~~~ - ~~~~ ~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~ - ~~ ~~ ~~~~ ~~~~~~~~~ - ~~~~~~ - ~~~~ ~~~~~ - ~~ ~~ ~~~~ ~~~~ ~~ ~~~~~~~~~ - ~~~~~~ + /**/ ~~~ /**/ + ~~ ~~ /*~~~~~*/ + /*~~*/ + /**/ /*~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~*/ + ~~ ~~ /**/ /*~~~~~*/ + /*~~*/ + /**/ /*~*/ + ~~ ~~ /**/ /**/ ~~ /*~~~~~*/ + /*~~*/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html index b2ada4d5846..aa7e750f48d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.html @@ -1,67 +1,67 @@ -~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~~~~~~~~~~~~~~~~~~~~*/ ~~ - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~ + /*~~~~~~~~~~~~~~~~~~*/ /*~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~ ~~~~~ + /*~~*/ /*~*/ ~ - ~~~~~ ~~~~~~~ ~~~~ ~~~ ~~ ~~~~~~~~~~~~~~~~~~~~~ + /*~*/ /*~~~*/ /**/ ~~~ ~~ /*~~~~~~~~~~~~~~~~~*/ ~ ~ - ~~~~~ ~~~~~ ~ ~~~~~ - ~~~~~ ~~~ ~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + /*~*/ /*~*/ ~ /*~*/ + /*~*/ ~~~ /*~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ - ~~~ ~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~ - ~~~ ~~~~~~~~ ~ ~~~~~~~~~~ - ~~~~~~ ~~~~~~~~ ~~~~~~~~~ + ~~~ /*~*/ ~ /*~~~~~~~~~~~~~~~~~~*/ + ~~~ /*~~~~*/ ~ /*~~~~~~*/ + /*~~*/ /*~~~~*/ /*~~~~~*/ ~ - ~~~~~~ ~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~*/ ~ ~ -~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ +/*~~~~~~~~*/ +/*~~~~~~~~~~~~*/ -~~~~~~~~~~ ~~~~~~ +/*~~~~~~*/ /*~~*/ ~ - ~~~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~~~ - ~~~~~~~~~~~~~~~ ~~ ~~~~ ~~~~~~~~~ - ~ ~~ ~~~~ ~~~~~~~~ + /*~~~~~~~~~~*/ ~~ /**/ /*~~~~*/ + /*~~~~~~~~~~~*/ ~~ /**/ /*~~~~~*/ + ~ ~~ /**/ /*~~~~*/ ~~ -~~~~~~ ~~~~~~~ ~~~~ ~~~ ~~ ~~~~~~~~~~~~~~~~~~~~~ +/*~~*/ /*~~~*/ /**/ ~~~ ~~ /*~~~~~~~~~~~~~~~~~*/ ~ - ~~~~ + /**/ ~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~~~~~~~ +/*~~~~~~~~~*/ +/*~~~~~~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~*/ ~ - ~~~~~~ - ~~~~~~ + /*~~*/ + /*~~*/ ~ - ~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~ + /*~~~~~~~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~~~*/ /*~~*/ ~ - ~~~ ~~~~~~~~~~~ ~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ + ~~~ /*~~~~~~~*/ ~ /*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ + /*~~*/ /*~~~~~~~~~~~~~~~~~~~*/ ~ - ~~~~~~~ ~~~~~~ ~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~*/ /*~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~~~~~ ~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~~~~*/ /*~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~~~~~~~ ~~~~~~~~ ~~~~~~~~~~~ ~ ~~~~ ~~~~ ~ + /*~~~*/ /*~~~~~~~*/ /*~~~~*/ /*~~~~~~~*/ ~ /**/ /**/ ~ - ~~~~~~~ ~~~~~ ~~~~~ + /*~~~*/ /*~*/ /*~*/ ~ - ~~~~~~ ~~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~~*/ /**/ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html index bc136f506a6..03876c01edf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.html @@ -1,4 +1,4 @@ ~~ ~~~ ~ ~ ~~ foo - ~~~ ~ ~ ~~ bar ~~~~~~ + ~~~ ~ ~ ~~ bar /*~~*/ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html index f9dbfc45c01..0a78d260923 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.html @@ -1,5 +1,5 @@ ~~ - ~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ - ~~~~~~~~~~~~~~~~~~~~~~ ~~~~ ~~~ ~~ ~ ~~~~~~~~~~~~ ~ ~~~~~~~~ + /*~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~ + /*~~~~~~~~~~~~~~~~~~*/ /**/ ~~~ ~~ ~ /*~~~~~~~~*/ ~ /*~~~~*/ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html index a8544403c47..e3c4cd8dade 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.html @@ -1,38 +1,38 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ -~~~ ~~~~~~ +~~~ /*~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~~~~~~~~ + ~~~ /*~~~~*/ ~ /*~~~~~~~*/
-

-

+

+

Set Time:

- ~~~ ~~~~~~~ + ~~~ /*~~~*/ ~

New Time:

~ - ~~~~ + /**/ ~ -

Current Time:

- - +

Current Time:

+ + ~

-

- ~~ ~~~ ~~~~~~~ ~ ~~~~~~~ - +

+ ~~ ~~~ /*~~~*/ ~ /*~~~*/ +

-

- +

+

-

- +

+

-

- +

+

- ~~~~~~~~~~~~~

~ + /*~~~~~~~~~*/

~

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html index 3981b69f586..afb7b659f30 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.html @@ -1,22 +1,22 @@ ~~ - ~~~ ~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~~~~ - ~~~ ~ ~ ~~~~~~ + ~~~ ~~ ~ /*~*/ + ~~~ ~~~ ~ /*~~*/ + ~~~ ~ ~ /*~~*/ -

-

-

+

+

+

-

+

- -

-

+ +

+

-

x

+

x

-

x

-

x

-

x

+

x

+

x

+

x

~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html index 323da7fe613..15d9955bf53 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.html @@ -1,16 +1,16 @@ ~~ - ~~~ ~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~~~~ + ~~~ ~~ ~ /*~*/ + ~~~ ~~~ ~ /*~~*/
-

-

-

+

+

+

-

+

- - + + -

+

~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html index d4f55031d2f..8e21e54367e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.html @@ -1,13 +1,13 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ 2 TagHelpers. 1 TagHelper. 2 TagHelpers -2 TagHelpers +2 TagHelpers 0 TagHelpers. 1 TagHelper 1 TagHelper -1 TagHelper +1 TagHelper \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html index d4fa4e75c16..006ecf00a0e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.html @@ -1,15 +1,15 @@ 

- ~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ + /*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~

This is item #~~

~

-~~~~~~~~~~~~~~~ -~~~~~~

Bar ~~~~ Biz

~ +/*~~~~~~~~~~~*/ +/*~~*/

Bar /**/ Biz

~

-~~~~~~~~ ~~~~~~ ~ +/*~~~~*/ /*~~*/ ~

Foo

- ~~~~ + /**/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html index 790e3bed02b..a84297901e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.codegen.html @@ -1,7 +1,7 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

- - + +

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html index ffcfa6aa75b..07b52c13950 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html index 2ec57a6f889..21503f3ffb2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.html @@ -1,14 +1,14 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - + - + - + - + - + - \ No newline at end of file + \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html index 1d1a1dccf6e..abb4af9f7da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/
diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html index 502b2ba29ce..459ec2118cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~~~~~ ~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~~~~~~~~~~~*/ ~ - - - - - + + + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html index ec43fd7f175..c9f6298277c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ - - - + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html index 37e0121757a..a423d0868e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~ ~ ~~~~ - ~~~ ~~~~~ ~ ~~~~~ - ~~~ ~~~ ~ ~~~ ~ ~~~ ~ ~~~~~~~~~ ~~ - ~~~ ~~~~ ~ ~~~ ~ ~~~~~ ~ ~~~ ~~~~~~~~~~~~~~~~~~~~~ ~ ~~~~~~ ~~~~~ ~ ~~ + ~~~ /*~*/ ~ /**/ + ~~~ /*~*/ ~ /*~*/ + ~~~ ~~~ ~ ~~~ ~ ~~~ ~ /*~~~~~*/ ~~ + ~~~ /**/ ~ ~~~ ~ /*~*/ ~ ~~~ /*~~~~~~~~~~~~~~~~~*/ ~ /*~~*/ /*~*/ ~ ~~ ~ - - - + + + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html index 5a7ee1c8e99..330c5968da2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.html @@ -1,8 +1,8 @@ -~~~~~~~~~~~~~ ~~ ~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~ /*~~~~~~~~*/ - Not a TagHelper: + Not a TagHelper: \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html index de64a85c025..1968612c862 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.codegen.html @@ -1 +1 @@ -1 + 1 = ~~~~~~ \ No newline at end of file +1 + 1 = /*~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html index 6705095c5a8..7cc8aafa571 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.html @@ -1,16 +1,16 @@ ~~ - ~~~~~~ ~~~ ~ ~~~~~ - ~~~~~~ ~~~ ~ ~~~~~~ + /*~~*/ ~~~ ~ /*~*/ + /*~~*/ ~~~ ~ /*~~*/ ~ -~~~~~~~ ~~ ~~~~~ ~ - ~~~~ -~ ~~~~ ~ +/*~~~*/ ~~ /*~*/ ~ + /**/ +~ /**/ ~

Foo is Null!

~

-~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ - ~~~~~~~~~~~~~~~~~~ ~~~~~ +/*~~~~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ + /*~~~~~~~~~~~~~~*/ /*~*/ ~

\ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html index 3b426fe7e50..482708e173a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.html @@ -1,7 +1,7 @@  - ~~~~~~~~~~~ -~~~~~~ ~~~~~~~~~~ ~~~~~~ ~ - ~~~~~~ ~~~~~ ~ ~~~~ + /*~~~~~~~*/ +/*~~*/ /*~~~~~~*/ /*~~*/ ~ + /*~~*/ /*~*/ ~ /**/ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html index 6486d498a3d..78f2d99505b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.html @@ -1,12 +1,12 @@ -~~~~~~~~~~ ~ +/*~~~~~~*/ ~ ~ -~~~~~~~~~~ ~ - ~~~~~~ ~~~~~ ~ ~~~ ~~~~~~~~~ - ~~~~~~~ ~~~ ~~~~~~~~~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~ +/*~~~~~~*/ ~ + /*~~*/ /*~*/ ~ ~~~ /*~~~~~*/ + /*~~~*/ ~~~ /*~~~~~~~*/ ~ + /*~~*/ /*~~~~~~~~~*/ ~ ~ -Here's a random number: ~~~~~~~~~~~~ \ No newline at end of file +Here's a random number: /*~~~~~~~~*/ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html index 994e8efc2cc..3cd74d11b6f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.html @@ -1,3 +1,3 @@ ~~ - ~~~~ + /**/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html index 86e588c23bd..7490626ee6d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.html @@ -1,5 +1,5 @@ -~~~~~~~~~~~ ~~~~~~~~~~~ +/*~~~~~~~*/ /*~~~~~~~*/ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~ ~ ~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~*/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html index 11d9506a659..575be17a330 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ +/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~

This is item #~~

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html index d8a9146ac9b..b8e8517b76c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.html @@ -1,25 +1,25 @@ -~~ ~~~~~ ~~~~ ~~~~~ ~~~~~~~~ ~~~~ ~~~~~~~~~~~ ~~~~~~~~~~ ~~~~~~~~~~ ~~~~~ ~~~~~~ ~~ +~~ /*~*/ /**/ /*~*/ /*~~~~*/ /**/ /*~~~~~~~*/ /*~~~~~~*/ /*~~~~~~*/ /*~*/ /*~~*/ ~~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~ -~~~~~~~~~~~~~ ~ +/*~~~~~~~~~*/ +/*~~~~~~~~~*/ +/*~~~~~~~~~*/ ~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ ~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ -~~~~~~~~~~~~~~~~ ~ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ +/*~~~~~~~~~~~~*/ ~ -~~~~~~~~~ -~~~~~~~~~ +/*~~~~~*/ +/*~~~~~*/ -~~~~~~~~~~ -~~~~~~~~~~ +/*~~~~~~*/ +/*~~~~~~*/ -~~~~~~~~ -~~~~~~~~ +/*~~~~*/ +/*~~~~*/ -~~~~~~~~ { -~~~~~~~~~~ ~ \ No newline at end of file +/*~~~~*/ { +/*~~~~~~*/ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html index 40b68fd5b19..ba70622d969 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.html @@ -1,3 +1,3 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

# ~" /> +/*~~~~*/ /**/(string link) { + } \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html index 523f914f69d..a89de497f3e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.html @@ -5,34 +5,34 @@

Hello, World

~ -~~~~~~~~ ~~ ~~~ ~ -

Hello from C#, #~~~~

+/*~~~~*/ ~~ ~~~ ~ +

Hello from C#, #/**/

~ ~~ ~~ ~ -~~~~~ ~~ ~~~ ~ +/*~*/ ~~ ~~~ ~

We wrote 10 lines!

~ -~~~~~~~~~~ ~ - ~~~~ ~~~ +/*~~~~~~*/ ~ + /**/ ~~~

No really, we wrote 10 lines!

- ~~~~~~ - ~~~~~~~~ + /*~~*/ + /*~~~~*/

Actually, we didn't...

- ~~~~~~ + /*~~*/ ~ -~~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ -

Hello again from C#, #~~~~

+/*~~~~*/ ~ ~ ~~ ~ ~~ ~~~ ~ ~~ ~~ ~ +

Hello again from C#, #/**/

~ -~~~~ ~ +/**/ ~

That time, we wrote 5 lines!

-~ ~~~~~~~~~~~~~~~ ~~~ ~ -

Oh no! An error occurred: ~~~~~~~~~~~~~

+~ /*~~~~~~~~~~~*/ ~~~ ~ +

Oh no! An error occurred: /*~~~~~~~~~*/

~ -~~~~~~~~~ ~~~~~~~~~ ~ +/*~~~~~*/ /*~~~~~*/ ~

This block is locked, for your security!

~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html index cab63f7d85e..c267bf19829 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.html @@ -1,5 +1,5 @@ ~~ - ~~~~~~~ ~ ~ ~~ ~ ~~ ~~~ ~~~~ ~ -

Hello from C#, #~~~~~~~~~~~~~~~

+ /*~~~*/ ~ ~ ~~ ~ ~~ ~~~ /**/ ~ +

Hello from C#, #/*~~~~~~~~~~~*/

~ ~ diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html index 94cb1ec258d..d8704691b59 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.html @@ -1,47 +1,47 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~~ - ~~~ ~~~~~~ ~ ~~~ ~~~~~~~~ + ~~~ /*~~*/ ~ ~~~ /*~~~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~ ~ ~~~~~~~~~ ~~~ ~ ~~~ ~~ + ~~~ /*~~~~*/ ~ /**/ ~ /*~~~~~*/ ~~~ ~ ~~~ ~~ ~~ - ~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~ + /**/ /*~~~~~~~~~~~~*/ /*~~~*/ ~ -
~~~~~~~~~~~~
+
/*~~~~~~~~*/
~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~~ ~ -~~ ~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ +~~ /*~~~~~~~~~~~~~~~~~*/ ~ +~~ /*~*/ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~~*/ /*~~~*/ ~ - ~~~ ~~~~~~~~~ ~ ~~~~~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~*/ /*~~~~~~~~~~~*/
-

Happy birthday ~~~~~~~~~~~~!

+

Happy birthday /*~~~~~~~~*/!

    - ~~~~ ~~~~ ~ ~ ~~ ~ ~ ~~~~~~~~~~ ~ ~~~ ~~~~ + /**/ /**/ ~ ~ ~~ ~ ~ /*~~~~~~*/ ~ ~~~ /**/ ~ -
  • ~~~~ Happy birthday!
  • +
  • /**/ Happy birthday!
  • ~
- ~~ ~~~~~~~~~~~ ~ ~~~ + ~~ /*~~~~~~~*/ ~ ~~~ ~ - ~~~~~~ ~~~~~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~~~~~*/ ~

Secret message

- ~~~~~~ ~~~~~~~~~~~~~~~~~~~ + /*~~*/ /*~~~~~~~~~~~~~~~*/ ~ - ~~~~~ ~~~~~~ + /*~*/ /*~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ - ~~~~~~ ~~~ ~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ + /*~~*/ ~~~ ~~~ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html index ffd8006a48e..557deb22dc2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.html @@ -1,45 +1,45 @@  ~~ - ~~~ ~~~~~~ ~ ~~~ ~~~~~~~~ + ~~~ /*~~*/ ~ ~~~ /*~~~~*/ ~ - ~~~ ~~~~~~~~ ~ ~~~~ ~ ~~~~~~~~~ ~~~ ~ ~~~ ~ + ~~~ /*~~~~*/ ~ /**/ ~ /*~~~~~*/ ~~~ ~ ~~~ ~ ~~ - ~~~~ ~~~~~~~~~~~~~~~~ ~~~~~~~ + /**/ /*~~~~~~~~~~~~*/ /*~~~*/ ~ -
~~~~~~~~~~~~
+
/*~~~~~~~~*/
~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~ ~ -~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~ +~~ /*~~~~~~~~~~~~~~~~*/ ~ +~~ /*~~~~~~~~~~~~~~~~~~~~~~~~*/ ~ -~~~~~~~~~~ ~ - ~~~~ ~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~ +/*~~~~~~*/ ~ + /**/ /*~~~~~~~~~~~~~~~~~~~*/ /*~~~*/ ~ - ~~~ ~~~~~~~~~ ~ ~~~~~ ~~~~~~~~~~~~~~~ + ~~~ /*~~~~~*/ ~ /*~*/ /*~~~~~~~~~~~*/
-

Happy birthday ~~~~~~~~~~~~!

+

Happy birthday /*~~~~~~~~*/!

    - ~~~~ ~~~~ ~ ~ ~~ ~ ~ ~~~~~~~~~~ ~ ~~~ ~~~~ + /**/ /**/ ~ ~ ~~ ~ ~ /*~~~~~~*/ ~ ~~~ /**/ ~ -
  • ~~~~ Happy birthday!
  • +
  • /**/ Happy birthday!
  • ~
- ~~ ~~~~~~~~~~~ ~ ~~~ + ~~ /*~~~~~~~*/ ~ ~~~ ~ - ~~~~~~~ + /*~~~*/ ~

Secret message

~ - ~~~~~ ~~~~~~ + /*~*/ /*~~*/ ~ - ~~~~~~ ~~~~~~ ~~~~ ~ ~~~~ ~~~~ ~ - ~~~~~~ ~~~ ~~~ ~ ~~~~ ~~~~ ~ + /*~~*/ /*~~*/ /**/ ~ /**/ /**/ ~ + /*~~*/ ~~~ ~~~ ~ /**/ /**/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html index 1a6335ea467..7e2de8666d2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/

diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html index eed8d5cc3f0..a97a9dfd6bd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.html @@ -1,8 +1,8 @@ ~~ - ~~~~~~~~ ~~~~ ~~~~~~ ~~ ~~~~~~~~~~~~~ + /*~~~~*/ /**/ /*~~*/ ~~ /*~~~~~~~~~*/ ~

- ~~~~~~~~~~~~~~~~~. + /*~~~~~~~~~~~~~*/.
~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html index 8c9dd15aba7..1307d485615 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.html @@ -1,4 +1,4 @@ -~~~~~~~~ ~ - ~~~~~~~~ ~ +/*~~~~*/ ~ + /*~~~~*/ ~ ~ ~ \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html index 86dd6dcdf7c..de7ee0ff7f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.html @@ -1,11 +1,11 @@ -~~~~~~~~~~~~~ ~~~ ~~~~~~~~~~~~~ +/*~~~~~~~~~*/ ~~~ /*~~~~~~~~~*/ ~ } \ No newline at end of file diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml index 7cefd6acf19..c0f80a29675 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/Formatting/TestFiles/Input/CshtmlWithScript.cshtml @@ -48,7 +48,5 @@ urlTwo: "@Request.PathBase/two", @(Model.IncludeData15.HasValue ? FormattableString.Invariant($"data15: {(Model.Data15.Value ? "true" : "false")},") : null) @(Model.IncludeData16.HasValue ? FormattableString.Invariant($"data16: {(Model.Data16.Value ? "true" : "false")},") : null) @(Model.IncludeData17.Length > 0 ? Html.Raw(FormattableString.Invariant($"static: {{ data1: {Json.Serialize(Model.Data1)}, data2: {Json.Serialize(Model.Data2)}, data3: {Json.Serialize(Model.Data3)}, data4: {Json.Serialize(Model.Data4)} }},")) : null) - }).start(); - }; } \ No newline at end of file From ec671dbc8a15dcf9409e06e3711c2b2b66680ce5 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 28 Aug 2024 21:12:33 +1000 Subject: [PATCH 190/271] Fix find all references calls to Roslyn --- ...orCustomMessageTarget_FindAllReferences.cs | 48 +++++++++++++++++++ ...ustomMessageTarget_TextDocumentPosition.cs | 4 -- 2 files changed, 48 insertions(+), 4 deletions(-) create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_FindAllReferences.cs diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_FindAllReferences.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_FindAllReferences.cs new file mode 100644 index 00000000000..8420acfa157 --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_FindAllReferences.cs @@ -0,0 +1,48 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using StreamJsonRpc; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Endpoints; + +internal partial class RazorCustomMessageTarget +{ + [JsonRpcMethod(CustomMessageNames.RazorReferencesEndpointName, UseSingleObjectParameterDeserialization = true)] + public async Task ReferencesAsync(DelegatedPositionParams request, CancellationToken cancellationToken) + { + var delegationDetails = await GetProjectedRequestDetailsAsync(request, cancellationToken).ConfigureAwait(false); + if (delegationDetails is null) + { + return default; + } + + var referenceParams = new ReferenceParams() + { + TextDocument = new VSTextDocumentIdentifier() + { + Uri = delegationDetails.Value.ProjectedUri, + ProjectContext = null, + }, + Position = request.ProjectedPosition, + Context = new ReferenceContext(), + }; + + var response = await _requestInvoker.ReinvokeRequestOnServerAsync( + delegationDetails.Value.TextBuffer, + Methods.TextDocumentReferencesName, + delegationDetails.Value.LanguageServerName, + referenceParams, + cancellationToken).ConfigureAwait(false); + + if (response is null) + { + return default; + } + + return response.Response; + } +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_TextDocumentPosition.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_TextDocumentPosition.cs index 5c11db83526..31716c290e5 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_TextDocumentPosition.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Endpoints/RazorCustomMessageTarget_TextDocumentPosition.cs @@ -29,10 +29,6 @@ internal partial class RazorCustomMessageTarget public Task> ImplementationAsync(DelegatedPositionParams request, CancellationToken cancellationToken) => DelegateTextDocumentPositionAndProjectContextAsync>(request, Methods.TextDocumentImplementationName, cancellationToken); - [JsonRpcMethod(CustomMessageNames.RazorReferencesEndpointName, UseSingleObjectParameterDeserialization = true)] - public Task ReferencesAsync(DelegatedPositionParams request, CancellationToken cancellationToken) - => DelegateTextDocumentPositionAndProjectContextAsync(request, Methods.TextDocumentReferencesName, cancellationToken); - [JsonRpcMethod(CustomMessageNames.RazorSignatureHelpEndpointName, UseSingleObjectParameterDeserialization = true)] public Task SignatureHelpAsync(DelegatedPositionParams request, CancellationToken cancellationToken) => DelegateTextDocumentPositionAndProjectContextAsync(request, Methods.TextDocumentSignatureHelpName, cancellationToken); From f35b6c6fe964e7d4a9f710ac482364f14267410b Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Wed, 28 Aug 2024 10:11:29 -0700 Subject: [PATCH 191/271] Change UseConsolidatedMvcViews to default to true (#10795) * Change UseConsolidatedMvcViews to default to true * Update baselines * Update LSP test --- ...ctiveWithViewImports_DesignTime.codegen.cs | 4 +- ...DirectiveWithViewImports_DesignTime.ir.txt | 4 +- ...iveWithViewImports_DesignTime.mappings.txt | 2 +- ...irectiveWithViewImports_Runtime.codegen.cs | 6 +- ...uteDirectiveWithViewImports_Runtime.ir.txt | 4 +- .../Basic_DesignTime.codegen.cs | 4 +- .../Basic_DesignTime.ir.txt | 4 +- .../Basic_DesignTime.mappings.txt | 12 +-- .../Basic_Runtime.codegen.cs | 6 +- .../Basic_Runtime.ir.txt | 4 +- ...IncompleteDirectives_DesignTime.codegen.cs | 4 +- .../IncompleteDirectives_DesignTime.ir.txt | 4 +- ...completeDirectives_DesignTime.mappings.txt | 14 +-- .../IncompleteDirectives_Runtime.codegen.cs | 6 +- .../IncompleteDirectives_Runtime.ir.txt | 4 +- .../InheritsViewModel_DesignTime.codegen.cs | 4 +- .../InheritsViewModel_DesignTime.ir.txt | 4 +- .../InheritsViewModel_DesignTime.mappings.txt | 4 +- .../InheritsViewModel_Runtime.codegen.cs | 6 +- .../InheritsViewModel_Runtime.ir.txt | 4 +- ...eritsWithViewImports_DesignTime.codegen.cs | 4 +- .../InheritsWithViewImports_DesignTime.ir.txt | 4 +- ...itsWithViewImports_DesignTime.mappings.txt | 2 +- ...InheritsWithViewImports_Runtime.codegen.cs | 6 +- .../InheritsWithViewImports_Runtime.ir.txt | 4 +- .../InjectWithModel_DesignTime.codegen.cs | 4 +- .../InjectWithModel_DesignTime.ir.txt | 4 +- .../InjectWithModel_DesignTime.mappings.txt | 10 +- .../InjectWithModel_Runtime.codegen.cs | 6 +- .../InjectWithModel_Runtime.ir.txt | 4 +- .../InjectWithModel_Runtime.mappings.txt | 8 +- .../InjectWithSemicolon_DesignTime.codegen.cs | 4 +- .../InjectWithSemicolon_DesignTime.ir.txt | 4 +- ...njectWithSemicolon_DesignTime.mappings.txt | 18 ++-- .../InjectWithSemicolon_Runtime.codegen.cs | 6 +- .../InjectWithSemicolon_Runtime.ir.txt | 4 +- .../InjectWithSemicolon_Runtime.mappings.txt | 16 ++-- .../Inject_DesignTime.codegen.cs | 4 +- .../Inject_DesignTime.ir.txt | 4 +- .../Inject_DesignTime.mappings.txt | 4 +- .../Inject_Runtime.codegen.cs | 6 +- .../Inject_Runtime.ir.txt | 4 +- .../Inject_Runtime.mappings.txt | 4 +- ...nvalidNamespaceAtEOF_DesignTime.codegen.cs | 4 +- .../InvalidNamespaceAtEOF_DesignTime.ir.txt | 4 +- .../InvalidNamespaceAtEOF_Runtime.codegen.cs | 6 +- .../InvalidNamespaceAtEOF_Runtime.ir.txt | 4 +- ...lformedPageDirective_DesignTime.codegen.cs | 4 +- .../MalformedPageDirective_DesignTime.ir.txt | 4 +- .../MalformedPageDirective_Runtime.codegen.cs | 6 +- .../MalformedPageDirective_Runtime.ir.txt | 4 +- ...lExpressionTagHelper_DesignTime.codegen.cs | 4 +- ...ModelExpressionTagHelper_DesignTime.ir.txt | 4 +- ...xpressionTagHelper_DesignTime.mappings.txt | 8 +- ...odelExpressionTagHelper_Runtime.codegen.cs | 6 +- .../ModelExpressionTagHelper_Runtime.ir.txt | 4 +- .../Model_DesignTime.codegen.cs | 4 +- .../Model_DesignTime.ir.txt | 4 +- .../Model_DesignTime.mappings.txt | 2 +- .../Model_Runtime.codegen.cs | 6 +- .../Model_Runtime.ir.txt | 4 +- .../MultipleModels_DesignTime.codegen.cs | 4 +- .../MultipleModels_DesignTime.ir.txt | 4 +- .../MultipleModels_DesignTime.mappings.txt | 4 +- .../PageWithNamespace_DesignTime.codegen.cs | 2 +- .../PageWithNamespace_DesignTime.ir.txt | 2 +- .../PageWithNamespace_DesignTime.mappings.txt | 2 +- .../PageWithNamespace_Runtime.codegen.cs | 2 +- .../PageWithNamespace_Runtime.ir.txt | 2 +- ...LeadingPageDirective_DesignTime.codegen.cs | 4 +- ...thNoLeadingPageDirective_DesignTime.ir.txt | 4 +- ...hNoLeadingPageDirective_Runtime.codegen.cs | 6 +- ...eWithNoLeadingPageDirective_Runtime.ir.txt | 4 +- .../RazorPage_WithCssScope.codegen.cs | 6 +- .../RazorPage_WithCssScope.ir.txt | 4 +- ...ullableModel_LangNew_DesignTime.codegen.cs | 4 +- ...NonNullableModel_LangNew_DesignTime.ir.txt | 4 +- ...lableModel_LangNew_DesignTime.mappings.txt | 8 +- ...onNullableModel_LangNew_Runtime.codegen.cs | 6 +- ...ithNonNullableModel_LangNew_Runtime.ir.txt | 4 +- ...NullableModel_LangNew_Runtime.mappings.txt | 6 +- ...ullableModel_LangOld_DesignTime.codegen.cs | 4 +- ...NonNullableModel_LangOld_DesignTime.ir.txt | 4 +- ...lableModel_LangOld_DesignTime.mappings.txt | 8 +- ...onNullableModel_LangOld_Runtime.codegen.cs | 6 +- ...ithNonNullableModel_LangOld_Runtime.ir.txt | 4 +- ...NullableModel_LangOld_Runtime.mappings.txt | 6 +- ...ullableModel_LangNew_DesignTime.codegen.cs | 4 +- ...ithNullableModel_LangNew_DesignTime.ir.txt | 4 +- ...lableModel_LangNew_DesignTime.mappings.txt | 8 +- ...thNullableModel_LangNew_Runtime.codegen.cs | 6 +- ...e_WithNullableModel_LangNew_Runtime.ir.txt | 4 +- ...NullableModel_LangNew_Runtime.mappings.txt | 6 +- ...ullableModel_LangOld_DesignTime.codegen.cs | 4 +- ...ithNullableModel_LangOld_DesignTime.ir.txt | 4 +- ...lableModel_LangOld_DesignTime.mappings.txt | 8 +- ...thNullableModel_LangOld_Runtime.codegen.cs | 6 +- ...e_WithNullableModel_LangOld_Runtime.ir.txt | 4 +- ...NullableModel_LangOld_Runtime.mappings.txt | 6 +- ...gesWithRouteTemplate_DesignTime.codegen.cs | 4 +- ...orPagesWithRouteTemplate_DesignTime.ir.txt | 4 +- ...sWithRouteTemplate_DesignTime.mappings.txt | 10 +- ...rPagesWithRouteTemplate_Runtime.codegen.cs | 6 +- ...RazorPagesWithRouteTemplate_Runtime.ir.txt | 4 +- ...zorPagesWithoutModel_DesignTime.codegen.cs | 4 +- .../RazorPagesWithoutModel_DesignTime.ir.txt | 4 +- ...rPagesWithoutModel_DesignTime.mappings.txt | 8 +- .../RazorPagesWithoutModel_Runtime.codegen.cs | 6 +- .../RazorPagesWithoutModel_Runtime.ir.txt | 4 +- .../RazorPages_DesignTime.codegen.cs | 4 +- .../RazorPages_DesignTime.ir.txt | 4 +- .../RazorPages_DesignTime.mappings.txt | 10 +- .../RazorPages_Runtime.codegen.cs | 6 +- .../RazorPages_Runtime.ir.txt | 4 +- .../RazorView_Layout_WithCssScope.codegen.cs | 6 +- .../RazorView_Layout_WithCssScope.ir.txt | 4 +- .../RazorView_WithCssScope.codegen.cs | 6 +- .../RazorView_WithCssScope.ir.txt | 4 +- ...bleModel_NullableContextEnabled.codegen.cs | 6 +- ...ullableModel_NullableContextEnabled.ir.txt | 4 +- ...eBaseType_NullableContexEnabled.codegen.cs | 6 +- ...lableBaseType_NullableContexEnabled.ir.txt | 4 +- ...bleModel_NullableContextEnabled.codegen.cs | 6 +- ...ullableModel_NullableContextEnabled.ir.txt | 4 +- ...Model_NullableContextNotEnabled.codegen.cs | 6 +- ...ableModel_NullableContextNotEnabled.ir.txt | 4 +- .../Sections_DesignTime.codegen.cs | 4 +- .../Sections_DesignTime.ir.txt | 4 +- .../Sections_DesignTime.mappings.txt | 10 +- .../Sections_Runtime.codegen.cs | 6 +- .../Sections_Runtime.ir.txt | 4 +- .../UsingDirectives_DesignTime.codegen.cs | 4 +- .../UsingDirectives_DesignTime.ir.txt | 4 +- .../UsingDirectives_DesignTime.mappings.txt | 8 +- .../UsingDirectives_Runtime.codegen.cs | 6 +- .../UsingDirectives_Runtime.ir.txt | 4 +- ...tTagHelperOptionalParam_Runtime.codegen.cs | 30 +++--- ...onentTagHelperOptionalParam_Runtime.ir.txt | 28 +++--- ...ewComponentTagHelper_DesignTime.codegen.cs | 8 +- .../ViewComponentTagHelper_DesignTime.ir.txt | 8 +- ...ComponentTagHelper_DesignTime.mappings.txt | 6 +- .../ViewComponentTagHelper_Runtime.codegen.cs | 10 +- .../ViewComponentTagHelper_Runtime.ir.txt | 8 +- .../ViewWithNamespace_DesignTime.codegen.cs | 2 +- .../ViewWithNamespace_DesignTime.ir.txt | 2 +- .../ViewWithNamespace_DesignTime.mappings.txt | 2 +- .../ViewWithNamespace_Runtime.codegen.cs | 2 +- .../ViewWithNamespace_Runtime.ir.txt | 2 +- .../_ViewImports_DesignTime.codegen.cs | 4 +- .../_ViewImports_DesignTime.ir.txt | 4 +- .../_ViewImports_DesignTime.mappings.txt | 4 +- .../_ViewImports_Runtime.codegen.cs | 6 +- .../_ViewImports_Runtime.ir.txt | 4 +- ...ddTagHelperDirective_DesignTime.codegen.cs | 4 +- .../AddTagHelperDirective_DesignTime.ir.txt | 4 +- ...TagHelperDirective_DesignTime.mappings.txt | 2 +- .../AddTagHelperDirective_Runtime.codegen.cs | 6 +- .../AddTagHelperDirective_Runtime.ir.txt | 4 +- .../AttributeDirective_DesignTime.codegen.cs | 4 +- .../AttributeDirective_DesignTime.ir.txt | 4 +- ...AttributeDirective_DesignTime.mappings.txt | 8 +- .../AttributeDirective_Runtime.codegen.cs | 6 +- .../AttributeDirective_Runtime.ir.txt | 4 +- ...eTargetingTagHelpers_DesignTime.codegen.cs | 4 +- ...ibuteTargetingTagHelpers_DesignTime.ir.txt | 4 +- ...argetingTagHelpers_DesignTime.mappings.txt | 6 +- ...buteTargetingTagHelpers_Runtime.codegen.cs | 6 +- ...ttributeTargetingTagHelpers_Runtime.ir.txt | 4 +- .../Await_DesignTime.codegen.cs | 4 +- .../Await_DesignTime.cs-diagnostics.txt | 4 +- .../Await_DesignTime.ir.txt | 4 +- .../Await_DesignTime.mappings.txt | 34 +++---- .../Await_Runtime.codegen.cs | 6 +- .../Await_Runtime.cs-diagnostics.txt | 4 +- .../Await_Runtime.ir.txt | 4 +- .../BasicTagHelpers_DesignTime.codegen.cs | 4 +- .../BasicTagHelpers_DesignTime.ir.txt | 4 +- .../BasicTagHelpers_DesignTime.mappings.txt | 6 +- ...cTagHelpers_Prefixed_DesignTime.codegen.cs | 4 +- ...BasicTagHelpers_Prefixed_DesignTime.ir.txt | 4 +- ...agHelpers_Prefixed_DesignTime.mappings.txt | 6 +- ...asicTagHelpers_Prefixed_Runtime.codegen.cs | 6 +- .../BasicTagHelpers_Prefixed_Runtime.ir.txt | 4 +- ...pers_RemoveTagHelper_DesignTime.codegen.cs | 4 +- ...gHelpers_RemoveTagHelper_DesignTime.ir.txt | 4 +- ...rs_RemoveTagHelper_DesignTime.mappings.txt | 6 +- ...Helpers_RemoveTagHelper_Runtime.codegen.cs | 6 +- ...cTagHelpers_RemoveTagHelper_Runtime.ir.txt | 4 +- .../BasicTagHelpers_Runtime.codegen.cs | 6 +- .../BasicTagHelpers_Runtime.ir.txt | 4 +- .../Blocks_DesignTime.codegen.cs | 4 +- .../Blocks_DesignTime.ir.txt | 4 +- .../Blocks_DesignTime.mappings.txt | 38 ++++---- .../Blocks_Runtime.codegen.cs | 6 +- .../Blocks_Runtime.ir.txt | 4 +- .../CSharp7_DesignTime.codegen.cs | 4 +- .../CSharp7_DesignTime.ir.txt | 4 +- .../CSharp7_DesignTime.mappings.txt | 12 +-- .../CSharp7_Runtime.codegen.cs | 6 +- .../CSharp7_Runtime.ir.txt | 4 +- .../CSharp8_DesignTime.codegen.cs | 4 +- .../CSharp8_DesignTime.ir.txt | 4 +- .../CSharp8_DesignTime.mappings.txt | 24 ++--- .../CSharp8_Runtime.codegen.cs | 6 +- .../CSharp8_Runtime.ir.txt | 4 +- .../CodeBlockAtEOF_DesignTime.codegen.cs | 4 +- .../CodeBlockAtEOF_DesignTime.ir.txt | 4 +- .../CodeBlockAtEOF_DesignTime.mappings.txt | 2 +- .../CodeBlockAtEOF_Runtime.codegen.cs | 6 +- .../CodeBlockAtEOF_Runtime.ir.txt | 4 +- ...BlockWithTextElement_DesignTime.codegen.cs | 4 +- ...CodeBlockWithTextElement_DesignTime.ir.txt | 4 +- ...ockWithTextElement_DesignTime.mappings.txt | 8 +- ...odeBlockWithTextElement_Runtime.codegen.cs | 6 +- .../CodeBlockWithTextElement_Runtime.ir.txt | 4 +- .../CodeBlock_DesignTime.codegen.cs | 4 +- .../CodeBlock_DesignTime.ir.txt | 4 +- .../CodeBlock_DesignTime.mappings.txt | 2 +- .../CodeBlock_Runtime.codegen.cs | 6 +- .../CodeBlock_Runtime.ir.txt | 4 +- .../ComplexTagHelpers_DesignTime.codegen.cs | 4 +- .../ComplexTagHelpers_DesignTime.ir.txt | 4 +- .../ComplexTagHelpers_DesignTime.mappings.txt | 80 ++++++++-------- .../ComplexTagHelpers_Runtime.codegen.cs | 6 +- .../ComplexTagHelpers_Runtime.ir.txt | 4 +- ...nditionalAttributes2_DesignTime.codegen.cs | 4 +- .../ConditionalAttributes2_DesignTime.ir.txt | 4 +- ...itionalAttributes2_DesignTime.mappings.txt | 92 +++++++++---------- .../ConditionalAttributes2_Runtime.codegen.cs | 6 +- .../ConditionalAttributes2_Runtime.ir.txt | 4 +- ...onditionalAttributes_DesignTime.codegen.cs | 4 +- .../ConditionalAttributes_DesignTime.ir.txt | 4 +- ...ditionalAttributes_DesignTime.mappings.txt | 48 +++++----- .../ConditionalAttributes_Runtime.codegen.cs | 6 +- .../ConditionalAttributes_Runtime.ir.txt | 4 +- ...rTagHelperAttributes_DesignTime.codegen.cs | 4 +- ...ectorTagHelperAttributes_DesignTime.ir.txt | 4 +- ...agHelperAttributes_DesignTime.mappings.txt | 8 +- ...ctorTagHelperAttributes_Runtime.codegen.cs | 6 +- ...SelectorTagHelperAttributes_Runtime.ir.txt | 4 +- .../DesignTime_DesignTime.codegen.cs | 4 +- .../DesignTime_DesignTime.ir.txt | 4 +- .../DesignTime_DesignTime.mappings.txt | 18 ++-- .../DesignTime_Runtime.codegen.cs | 6 +- .../DesignTime_Runtime.ir.txt | 4 +- ...eAttributeTagHelpers_DesignTime.codegen.cs | 4 +- ...icateAttributeTagHelpers_DesignTime.ir.txt | 4 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 8 +- ...cateAttributeTagHelpers_Runtime.codegen.cs | 6 +- ...uplicateAttributeTagHelpers_Runtime.ir.txt | 4 +- ...icateTargetTagHelper_DesignTime.codegen.cs | 4 +- ...DuplicateTargetTagHelper_DesignTime.ir.txt | 4 +- ...ateTargetTagHelper_DesignTime.mappings.txt | 4 +- ...uplicateTargetTagHelper_Runtime.codegen.cs | 6 +- .../DuplicateTargetTagHelper_Runtime.ir.txt | 4 +- ...cAttributeTagHelpers_DesignTime.codegen.cs | 4 +- ...namicAttributeTagHelpers_DesignTime.ir.txt | 4 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 62 ++++++------- ...amicAttributeTagHelpers_Runtime.codegen.cs | 6 +- .../DynamicAttributeTagHelpers_Runtime.ir.txt | 4 +- ...yAttributeTagHelpers_DesignTime.codegen.cs | 4 +- ...EmptyAttributeTagHelpers_DesignTime.ir.txt | 4 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 8 +- ...mptyAttributeTagHelpers_Runtime.codegen.cs | 6 +- .../EmptyAttributeTagHelpers_Runtime.ir.txt | 4 +- .../EmptyCodeBlock_DesignTime.codegen.cs | 4 +- .../EmptyCodeBlock_DesignTime.ir.txt | 4 +- .../EmptyCodeBlock_DesignTime.mappings.txt | 2 +- .../EmptyCodeBlock_Runtime.codegen.cs | 6 +- .../EmptyCodeBlock_Runtime.ir.txt | 4 +- ...tyExplicitExpression_DesignTime.codegen.cs | 4 +- .../EmptyExplicitExpression_DesignTime.ir.txt | 4 +- ...ExplicitExpression_DesignTime.mappings.txt | 2 +- ...EmptyExplicitExpression_Runtime.codegen.cs | 6 +- .../EmptyExplicitExpression_Runtime.ir.txt | 4 +- ...icitExpressionInCode_DesignTime.codegen.cs | 4 +- ...ImplicitExpressionInCode_DesignTime.ir.txt | 4 +- ...itExpressionInCode_DesignTime.mappings.txt | 6 +- ...mplicitExpressionInCode_Runtime.codegen.cs | 6 +- ...ptyImplicitExpressionInCode_Runtime.ir.txt | 4 +- ...tyImplicitExpression_DesignTime.codegen.cs | 4 +- .../EmptyImplicitExpression_DesignTime.ir.txt | 4 +- ...ImplicitExpression_DesignTime.mappings.txt | 2 +- ...EmptyImplicitExpression_Runtime.codegen.cs | 6 +- .../EmptyImplicitExpression_Runtime.ir.txt | 4 +- .../EnumTagHelpers_DesignTime.codegen.cs | 4 +- .../EnumTagHelpers_DesignTime.ir.txt | 4 +- .../EnumTagHelpers_DesignTime.mappings.txt | 18 ++-- .../EnumTagHelpers_Runtime.codegen.cs | 6 +- .../EnumTagHelpers_Runtime.ir.txt | 4 +- .../EscapedExpression_DesignTime.codegen.cs | 4 +- .../EscapedExpression_DesignTime.ir.txt | 4 +- .../EscapedExpression_DesignTime.mappings.txt | 8 +- .../EscapedExpression_Runtime.codegen.cs | 6 +- .../EscapedExpression_Runtime.ir.txt | 4 +- .../EscapedIdentifier_DesignTime.codegen.cs | 4 +- .../EscapedIdentifier_DesignTime.ir.txt | 4 +- .../EscapedIdentifier_DesignTime.mappings.txt | 14 +-- .../EscapedIdentifier_Runtime.codegen.cs | 6 +- .../EscapedIdentifier_Runtime.ir.txt | 4 +- .../EscapedTagHelpers_DesignTime.codegen.cs | 4 +- .../EscapedTagHelpers_DesignTime.ir.txt | 4 +- .../EscapedTagHelpers_DesignTime.mappings.txt | 8 +- .../EscapedTagHelpers_Runtime.codegen.cs | 6 +- .../EscapedTagHelpers_Runtime.ir.txt | 4 +- ...licitExpressionAtEOF_DesignTime.codegen.cs | 4 +- .../ExplicitExpressionAtEOF_DesignTime.ir.txt | 4 +- ...citExpressionAtEOF_DesignTime.mappings.txt | 2 +- ...ExplicitExpressionAtEOF_Runtime.codegen.cs | 6 +- .../ExplicitExpressionAtEOF_Runtime.ir.txt | 4 +- ...ExpressionWithMarkup_DesignTime.codegen.cs | 4 +- ...icitExpressionWithMarkup_DesignTime.ir.txt | 4 +- ...pressionWithMarkup_DesignTime.mappings.txt | 2 +- ...citExpressionWithMarkup_Runtime.codegen.cs | 6 +- ...xplicitExpressionWithMarkup_Runtime.ir.txt | 4 +- .../ExplicitExpression_DesignTime.codegen.cs | 4 +- .../ExplicitExpression_DesignTime.ir.txt | 4 +- ...ExplicitExpression_DesignTime.mappings.txt | 2 +- .../ExplicitExpression_Runtime.codegen.cs | 6 +- .../ExplicitExpression_Runtime.ir.txt | 4 +- .../ExpressionsInCode_DesignTime.codegen.cs | 4 +- .../ExpressionsInCode_DesignTime.ir.txt | 4 +- .../ExpressionsInCode_DesignTime.mappings.txt | 16 ++-- .../ExpressionsInCode_Runtime.codegen.cs | 6 +- .../ExpressionsInCode_Runtime.ir.txt | 4 +- ...unctionsBlockMinimal_DesignTime.codegen.cs | 4 +- .../FunctionsBlockMinimal_DesignTime.ir.txt | 4 +- ...ctionsBlockMinimal_DesignTime.mappings.txt | 2 +- .../FunctionsBlockMinimal_Runtime.codegen.cs | 6 +- .../FunctionsBlockMinimal_Runtime.ir.txt | 4 +- .../FunctionsBlock_DesignTime.codegen.cs | 4 +- .../FunctionsBlock_DesignTime.ir.txt | 4 +- .../FunctionsBlock_DesignTime.mappings.txt | 6 +- .../FunctionsBlock_Runtime.codegen.cs | 6 +- .../FunctionsBlock_Runtime.ir.txt | 4 +- .../HiddenSpansInCode_DesignTime.codegen.cs | 4 +- .../HiddenSpansInCode_DesignTime.ir.txt | 4 +- .../HiddenSpansInCode_DesignTime.mappings.txt | 4 +- .../HiddenSpansInCode_Runtime.codegen.cs | 6 +- .../HiddenSpansInCode_Runtime.ir.txt | 4 +- ...mentWithQuote_Double_DesignTime.codegen.cs | 4 +- ...lCommentWithQuote_Double_DesignTime.ir.txt | 4 +- ...CommentWithQuote_Double_Runtime.codegen.cs | 6 +- ...HtmlCommentWithQuote_Double_Runtime.ir.txt | 4 +- ...mentWithQuote_Single_DesignTime.codegen.cs | 4 +- ...lCommentWithQuote_Single_DesignTime.ir.txt | 4 +- ...CommentWithQuote_Single_Runtime.codegen.cs | 6 +- ...HtmlCommentWithQuote_Single_Runtime.ir.txt | 4 +- .../Implements_DesignTime.codegen.cs | 4 +- .../Implements_DesignTime.ir.txt | 4 +- .../Implements_DesignTime.mappings.txt | 4 +- .../Implements_Runtime.codegen.cs | 6 +- .../Implements_Runtime.ir.txt | 4 +- ...licitExpressionAtEOF_DesignTime.codegen.cs | 4 +- .../ImplicitExpressionAtEOF_DesignTime.ir.txt | 4 +- ...citExpressionAtEOF_DesignTime.mappings.txt | 2 +- ...ImplicitExpressionAtEOF_Runtime.codegen.cs | 6 +- .../ImplicitExpressionAtEOF_Runtime.ir.txt | 4 +- .../ImplicitExpression_DesignTime.codegen.cs | 4 +- .../ImplicitExpression_DesignTime.ir.txt | 4 +- ...ImplicitExpression_DesignTime.mappings.txt | 6 +- .../ImplicitExpression_Runtime.codegen.cs | 6 +- .../ImplicitExpression_Runtime.ir.txt | 4 +- ...IncompleteDirectives_DesignTime.codegen.cs | 4 +- .../IncompleteDirectives_DesignTime.ir.txt | 4 +- ...completeDirectives_DesignTime.mappings.txt | 28 +++--- .../IncompleteDirectives_Runtime.codegen.cs | 6 +- .../IncompleteDirectives_Runtime.ir.txt | 4 +- .../IncompleteTagHelper_DesignTime.codegen.cs | 4 +- .../IncompleteTagHelper_DesignTime.ir.txt | 4 +- ...ncompleteTagHelper_DesignTime.mappings.txt | 2 +- .../IncompleteTagHelper_Runtime.codegen.cs | 6 +- .../IncompleteTagHelper_Runtime.ir.txt | 4 +- .../Inherits_DesignTime.codegen.cs | 4 +- .../Inherits_DesignTime.cs-diagnostics.txt | 18 ++-- .../Inherits_DesignTime.ir.txt | 4 +- .../Inherits_DesignTime.mappings.txt | 4 +- .../Inherits_Runtime.codegen.cs | 6 +- .../Inherits_Runtime.cs-diagnostics.txt | 18 ++-- .../Inherits_Runtime.ir.txt | 4 +- .../InlineBlocks_DesignTime.codegen.cs | 4 +- .../InlineBlocks_DesignTime.ir.txt | 4 +- .../InlineBlocks_DesignTime.mappings.txt | 10 +- .../InlineBlocks_Runtime.codegen.cs | 6 +- .../InlineBlocks_Runtime.ir.txt | 4 +- .../Instrumented_DesignTime.codegen.cs | 4 +- .../Instrumented_DesignTime.ir.txt | 4 +- .../Instrumented_DesignTime.mappings.txt | 42 ++++----- .../Instrumented_Runtime.codegen.cs | 6 +- .../Instrumented_Runtime.ir.txt | 4 +- .../MarkupInCodeBlock_DesignTime.codegen.cs | 4 +- .../MarkupInCodeBlock_DesignTime.ir.txt | 4 +- .../MarkupInCodeBlock_DesignTime.mappings.txt | 6 +- .../MarkupInCodeBlock_Runtime.codegen.cs | 6 +- .../MarkupInCodeBlock_Runtime.ir.txt | 4 +- ...eBlocksWithTagHelper_DesignTime.codegen.cs | 4 +- ...nCodeBlocksWithTagHelper_DesignTime.ir.txt | 4 +- ...locksWithTagHelper_DesignTime.mappings.txt | 28 +++--- ...CodeBlocksWithTagHelper_Runtime.codegen.cs | 6 +- ...p_InCodeBlocksWithTagHelper_Runtime.ir.txt | 4 +- .../Markup_InCodeBlocks_DesignTime.codegen.cs | 4 +- .../Markup_InCodeBlocks_DesignTime.ir.txt | 4 +- ...arkup_InCodeBlocks_DesignTime.mappings.txt | 26 +++--- .../Markup_InCodeBlocks_Runtime.codegen.cs | 6 +- .../Markup_InCodeBlocks_Runtime.ir.txt | 4 +- .../MinimizedTagHelpers_DesignTime.codegen.cs | 4 +- .../MinimizedTagHelpers_DesignTime.ir.txt | 4 +- ...inimizedTagHelpers_DesignTime.mappings.txt | 2 +- .../MinimizedTagHelpers_Runtime.codegen.cs | 6 +- .../MinimizedTagHelpers_Runtime.ir.txt | 4 +- .../NestedCSharp_DesignTime.codegen.cs | 4 +- .../NestedCSharp_DesignTime.ir.txt | 4 +- .../NestedCSharp_DesignTime.mappings.txt | 10 +- .../NestedCSharp_Runtime.codegen.cs | 6 +- .../NestedCSharp_Runtime.ir.txt | 4 +- .../NestedCodeBlocks_DesignTime.codegen.cs | 4 +- .../NestedCodeBlocks_DesignTime.ir.txt | 4 +- .../NestedCodeBlocks_DesignTime.mappings.txt | 6 +- .../NestedCodeBlocks_Runtime.codegen.cs | 6 +- .../NestedCodeBlocks_Runtime.ir.txt | 4 +- ...dScriptTagTagHelpers_DesignTime.codegen.cs | 4 +- ...estedScriptTagTagHelpers_DesignTime.ir.txt | 4 +- ...criptTagTagHelpers_DesignTime.mappings.txt | 10 +- ...stedScriptTagTagHelpers_Runtime.codegen.cs | 6 +- .../NestedScriptTagTagHelpers_Runtime.ir.txt | 4 +- .../NestedTagHelpers_DesignTime.codegen.cs | 4 +- .../NestedTagHelpers_DesignTime.ir.txt | 4 +- .../NestedTagHelpers_DesignTime.mappings.txt | 2 +- .../NestedTagHelpers_Runtime.codegen.cs | 6 +- .../NestedTagHelpers_Runtime.ir.txt | 4 +- .../NoLinePragmas_DesignTime.codegen.cs | 4 +- .../NoLinePragmas_DesignTime.ir.txt | 4 +- .../NoLinePragmas_DesignTime.mappings.txt | 40 ++++---- .../NoLinePragmas_Runtime.codegen.cs | 6 +- .../NoLinePragmas_Runtime.ir.txt | 4 +- ...nditionalExpressions_DesignTime.codegen.cs | 4 +- ...llConditionalExpressions_DesignTime.ir.txt | 4 +- ...itionalExpressions_DesignTime.mappings.txt | 26 +++--- ...lConditionalExpressions_Runtime.codegen.cs | 6 +- .../NullConditionalExpressions_Runtime.ir.txt | 4 +- .../OpenedIf_DesignTime.codegen.cs | 4 +- .../OpenedIf_DesignTime.ir.txt | 4 +- .../OpenedIf_DesignTime.mappings.txt | 6 +- .../OpenedIf_Runtime.codegen.cs | 6 +- .../OpenedIf_Runtime.ir.txt | 4 +- .../ParserError_DesignTime.codegen.cs | 4 +- .../ParserError_DesignTime.ir.txt | 4 +- .../ParserError_DesignTime.mappings.txt | 2 +- .../ParserError_Runtime.codegen.cs | 6 +- .../ParserError_Runtime.ir.txt | 4 +- ...dAttributeTagHelpers_DesignTime.codegen.cs | 4 +- ...fixedAttributeTagHelpers_DesignTime.ir.txt | 4 +- ...ttributeTagHelpers_DesignTime.mappings.txt | 24 ++--- ...ixedAttributeTagHelpers_Runtime.codegen.cs | 6 +- ...PrefixedAttributeTagHelpers_Runtime.ir.txt | 4 +- .../RazorComments_DesignTime.codegen.cs | 4 +- .../RazorComments_DesignTime.ir.txt | 4 +- .../RazorComments_DesignTime.mappings.txt | 14 +-- .../RazorComments_Runtime.codegen.cs | 6 +- .../RazorComments_Runtime.ir.txt | 4 +- ...veTagHelperDirective_DesignTime.codegen.cs | 4 +- ...RemoveTagHelperDirective_DesignTime.ir.txt | 4 +- ...TagHelperDirective_DesignTime.mappings.txt | 2 +- ...emoveTagHelperDirective_Runtime.codegen.cs | 6 +- .../RemoveTagHelperDirective_Runtime.ir.txt | 4 +- .../Sections_DesignTime.codegen.cs | 4 +- .../Sections_DesignTime.ir.txt | 4 +- .../Sections_DesignTime.mappings.txt | 16 ++-- .../Sections_Runtime.codegen.cs | 6 +- .../Sections_Runtime.ir.txt | 4 +- .../SimpleTagHelpers_DesignTime.codegen.cs | 4 +- .../SimpleTagHelpers_DesignTime.ir.txt | 4 +- .../SimpleTagHelpers_DesignTime.mappings.txt | 2 +- .../SimpleTagHelpers_Runtime.codegen.cs | 6 +- .../SimpleTagHelpers_Runtime.ir.txt | 4 +- .../SimpleUnspacedIf_DesignTime.codegen.cs | 4 +- .../SimpleUnspacedIf_DesignTime.ir.txt | 4 +- .../SimpleUnspacedIf_DesignTime.mappings.txt | 4 +- .../SimpleUnspacedIf_Runtime.codegen.cs | 6 +- .../SimpleUnspacedIf_Runtime.ir.txt | 4 +- ...ontrolFlowStatements_DesignTime.codegen.cs | 4 +- ...ineControlFlowStatements_DesignTime.ir.txt | 4 +- ...trolFlowStatements_DesignTime.mappings.txt | 82 ++++++++--------- ...neControlFlowStatements_Runtime.codegen.cs | 6 +- ...leLineControlFlowStatements_Runtime.ir.txt | 4 +- ...lineBeforeAttributes_DesignTime.codegen.cs | 4 +- ...hNewlineBeforeAttributes_DesignTime.ir.txt | 4 +- ...neBeforeAttributes_DesignTime.mappings.txt | 4 +- ...NewlineBeforeAttributes_Runtime.codegen.cs | 6 +- ...WithNewlineBeforeAttributes_Runtime.ir.txt | 4 +- .../SingleTagHelper_DesignTime.codegen.cs | 4 +- .../SingleTagHelper_DesignTime.ir.txt | 4 +- .../SingleTagHelper_DesignTime.mappings.txt | 4 +- .../SingleTagHelper_Runtime.codegen.cs | 6 +- .../SingleTagHelper_Runtime.ir.txt | 4 +- .../StringLiterals_DesignTime.codegen.cs | 4 +- .../StringLiterals_DesignTime.ir.txt | 4 +- .../StringLiterals_DesignTime.mappings.txt | 4 +- .../StringLiterals_Runtime.codegen.cs | 6 +- .../StringLiterals_Runtime.ir.txt | 4 +- ...ion_RecursivePattern_DesignTime.codegen.cs | 4 +- ...ression_RecursivePattern_DesignTime.ir.txt | 4 +- ...n_RecursivePattern_DesignTime.mappings.txt | 4 +- ...ession_RecursivePattern_Runtime.codegen.cs | 6 +- ...Expression_RecursivePattern_Runtime.ir.txt | 4 +- ...ymbolBoundAttributes_DesignTime.codegen.cs | 4 +- .../SymbolBoundAttributes_DesignTime.ir.txt | 4 +- ...bolBoundAttributes_DesignTime.mappings.txt | 10 +- .../SymbolBoundAttributes_Runtime.codegen.cs | 6 +- .../SymbolBoundAttributes_Runtime.ir.txt | 4 +- .../TagHelpersInSection_DesignTime.codegen.cs | 4 +- .../TagHelpersInSection_DesignTime.ir.txt | 4 +- ...agHelpersInSection_DesignTime.mappings.txt | 14 +-- .../TagHelpersInSection_Runtime.codegen.cs | 6 +- .../TagHelpersInSection_Runtime.ir.txt | 4 +- ...sWithBoundAttributes_DesignTime.codegen.cs | 4 +- ...lpersWithBoundAttributes_DesignTime.ir.txt | 4 +- ...ithBoundAttributes_DesignTime.mappings.txt | 4 +- ...persWithBoundAttributes_Runtime.codegen.cs | 6 +- ...gHelpersWithBoundAttributes_Runtime.ir.txt | 4 +- ...thDataDashAttributes_DesignTime.codegen.cs | 4 +- ...rsWithDataDashAttributes_DesignTime.ir.txt | 4 +- ...DataDashAttributes_DesignTime.mappings.txt | 8 +- ...sWithDataDashAttributes_Runtime.codegen.cs | 6 +- ...lpersWithDataDashAttributes_Runtime.ir.txt | 4 +- ...TagHelpersWithPrefix_DesignTime.codegen.cs | 4 +- .../TagHelpersWithPrefix_DesignTime.ir.txt | 4 +- ...gHelpersWithPrefix_DesignTime.mappings.txt | 6 +- .../TagHelpersWithPrefix_Runtime.codegen.cs | 6 +- .../TagHelpersWithPrefix_Runtime.ir.txt | 4 +- ...gHelpersWithTemplate_DesignTime.codegen.cs | 4 +- .../TagHelpersWithTemplate_DesignTime.ir.txt | 4 +- ...elpersWithTemplate_DesignTime.mappings.txt | 10 +- .../TagHelpersWithTemplate_Runtime.codegen.cs | 6 +- .../TagHelpersWithTemplate_Runtime.ir.txt | 4 +- ...rdlySpacedAttributes_DesignTime.codegen.cs | 4 +- ...hWeirdlySpacedAttributes_DesignTime.ir.txt | 4 +- ...lySpacedAttributes_DesignTime.mappings.txt | 8 +- ...WeirdlySpacedAttributes_Runtime.codegen.cs | 6 +- ...WithWeirdlySpacedAttributes_Runtime.ir.txt | 4 +- .../Tags_DesignTime.codegen.cs | 4 +- .../Tags_DesignTime.ir.txt | 4 +- .../Tags_DesignTime.mappings.txt | 6 +- .../Tags_Runtime.codegen.cs | 6 +- .../Tags_Runtime.ir.txt | 4 +- .../Templates_DesignTime.codegen.cs | 4 +- .../Templates_DesignTime.ir.txt | 4 +- .../Templates_DesignTime.mappings.txt | 54 +++++------ .../Templates_Runtime.codegen.cs | 6 +- .../Templates_Runtime.ir.txt | 4 +- ...nTagHelperAttributes_DesignTime.codegen.cs | 4 +- ...onsInTagHelperAttributes_DesignTime.ir.txt | 4 +- ...agHelperAttributes_DesignTime.mappings.txt | 24 ++--- ...nsInTagHelperAttributes_Runtime.codegen.cs | 6 +- ...itionsInTagHelperAttributes_Runtime.ir.txt | 4 +- ...shedExpressionInCode_DesignTime.codegen.cs | 4 +- ...finishedExpressionInCode_DesignTime.ir.txt | 4 +- ...edExpressionInCode_DesignTime.mappings.txt | 6 +- ...inishedExpressionInCode_Runtime.codegen.cs | 6 +- .../UnfinishedExpressionInCode_Runtime.ir.txt | 4 +- .../Usings_DesignTime.codegen.cs | 4 +- .../Usings_DesignTime.ir.txt | 4 +- .../Usings_DesignTime.mappings.txt | 18 ++-- .../Usings_OutOfOrder_DesignTime.codegen.cs | 4 +- .../Usings_OutOfOrder_DesignTime.ir.txt | 4 +- .../Usings_OutOfOrder_DesignTime.mappings.txt | 26 +++--- .../Usings_OutOfOrder_Runtime.codegen.cs | 6 +- .../Usings_OutOfOrder_Runtime.ir.txt | 4 +- .../Usings_Runtime.codegen.cs | 6 +- .../Usings_Runtime.ir.txt | 4 +- .../src/Language/RazorConfiguration.cs | 4 +- .../DocumentSymbolEndpointTest.cs | 2 +- 572 files changed, 1780 insertions(+), 1780 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs index 72ea10cfae3..3094fa0145d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -34,7 +34,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt index f74d046c984..42fe022cab0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -14,7 +14,7 @@ IntermediateToken - (11:0,11 [14] AttributeDirectiveWithViewImports.cshtml) - CSharp - [Serializable] RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt index d4c610e7d5d..1122df5abb6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (11:0,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml) |[Serializable]| -Generated Location: (903:28,11 [14] ) +Generated Location: (920:28,11 [14] ) |[Serializable]| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs index 1b6e023a63f..e8c12c22554 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9a963ab17d89a7739e64cf5d94e1dc35aa41cf1004222067bca2328b832666d9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -40,7 +40,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt index 74fee171927..f6ea905d7be 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirectiveWithViewImports_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks @@ -16,7 +16,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirectiveWithViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs index 4db1c047ed4..a50c79314f4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt index 7cb303a862a..3adfb0244ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt index dae7e6e57f7..5648379bb4d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_DesignTime.mappings.txt @@ -1,34 +1,34 @@ Source Location: (13:0,13 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |this.ToString()| -Generated Location: (1437:33,13 [15] ) +Generated Location: (1463:33,13 [15] ) |this.ToString()| Source Location: (54:2,5 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |string.Format("{0}", "Hello")| -Generated Location: (1611:40,6 [29] ) +Generated Location: (1637:40,6 [29] ) |string.Format("{0}", "Hello")| Source Location: (95:4,2 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) | var cls = "foo"; | -Generated Location: (1795:47,2 [25] ) +Generated Location: (1821:47,2 [25] ) | var cls = "foo"; | Source Location: (134:7,11 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |if(cls != null) { | -Generated Location: (1981:55,11 [18] ) +Generated Location: (2007:55,11 [18] ) |if(cls != null) { | Source Location: (153:7,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) |cls| -Generated Location: (2181:62,30 [3] ) +Generated Location: (2207:62,30 [3] ) |cls| Source Location: (156:7,33 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml) | }| -Generated Location: (2370:69,33 [2] ) +Generated Location: (2396:69,33 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs index 3d2e93a3ba8..6b3e145e2c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3b732a30f94dc763cbd74d150cca70825dbddec2bddfba4e4d82547d5ced9a82" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt index 56e9bc2e1c6..bb2dfe4d57f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Basic_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Basic - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [4] Basic.cshtml) LazyIntermediateToken - (0:0,0 [4] Basic.cshtml) - Html -
#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index 61e677a4eb7..8a46de8392f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 68b99fa9b03..fc357d92584 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -1,35 +1,35 @@ Source Location: (128:7,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1204:26,0 [0] ) +Generated Location: (1230:26,0 [0] ) || Source Location: (149:10,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1441:36,0 [0] ) +Generated Location: (1467:36,0 [0] ) || Source Location: (159:11,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |MyService| -Generated Location: (1678:46,0 [17] ) +Generated Location: (1704:46,0 [17] ) |MyService| Source Location: (203:14,11 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1956:56,0 [0] ) +Generated Location: (1982:56,0 [0] ) || Source Location: (119:6,6 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2454:73,6 [0] ) +Generated Location: (2480:73,6 [0] ) || Source Location: (139:9,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2629:80,7 [0] ) +Generated Location: (2655:80,7 [0] ) || Source Location: (190:13,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2807:87,10 [0] ) +Generated Location: (2833:87,10 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index 641f07ac3e4..3732d035246 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7afd23f4d24de7b2bec1fb06d0a708e2d98adee36c510f65d3424dfda5445dca" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index 11e2588b30a..6af247f7569 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs index e97b456f33a..7bcc7e4db5d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt index 33b5e760949..53cd7044111 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt index 49ab8159e50..23d8691b5e8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyBasePageForViews| -Generated Location: (1174:26,0 [26] ) +Generated Location: (1200:26,0 [26] ) |MyBasePageForViews| Source Location: (45:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml) |MyModel| -Generated Location: (1457:36,0 [7] ) +Generated Location: (1483:36,0 [7] ) |MyModel| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs index 158b2dc8916..7d5e59cc7ec 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1ca5ae8e569aefa6575a68e8d8b2d375ed79deec6565fb893b72b89423f55abd" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel : MyBasePageForViews #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt index 6a2103779ca..a87252108ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsViewModel_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsViewModel - MyBasePageForViews - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs index 2797f550402..c288744ec5a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt index 02331d9ea15..1abea22138a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt index ad901af4382..eb4779efcf4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:1,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml) |MyModel| -Generated Location: (1185:26,0 [7] ) +Generated Location: (1211:26,0 [7] ) |MyModel| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs index 68eeb760030..2615dac991c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a652fac42d6a27ace9b45de079bd1bd21d47f29255b96899785aaa55a4a8e354" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -19,7 +19,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports : MyPageModel #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt index 80d7c75bf5d..78ebbebbdb6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InheritsWithViewImports_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InheritsWithViewImports - MyPageModel - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs index c522f09d73f..507fdf59594 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt index 333382ac822..64e0602a5c2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt index 2aef24850cd..ead29c02167 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyModel| -Generated Location: (1198:26,0 [7] ) +Generated Location: (1224:26,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (1460:36,0 [5] ) +Generated Location: (1486:36,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (1742:46,22 [14] ) +Generated Location: (1768:46,22 [14] ) |MyPropertyName| Source Location: (54:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (1995:56,0 [17] ) +Generated Location: (2021:56,0 [17] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (2289:66,22 [4] ) +Generated Location: (2315:66,22 [4] ) |Html| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs index 0b56e2be1e9..be636240d3d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "319d5fa6f848e64d19bf7eab2f5e3339cdfc75b02a9bc6f2773eed1a40f5e9d0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt index ea79180b0e6..f3c7bb47cc6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithModel - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt index 74596acbc18..a8d413833d9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel_Runtime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (54:2,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyService| -Generated Location: (2037:32,0 [9] ) +Generated Location: (2080:32,0 [9] ) |MyService| Source Location: (72:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |Html| -Generated Location: (2240:40,0 [4] ) +Generated Location: (2283:40,0 [4] ) |Html| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyApp| -Generated Location: (2568:51,0 [5] ) +Generated Location: (2611:51,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithModel.cshtml) |MyPropertyName| -Generated Location: (2758:59,0 [14] ) +Generated Location: (2801:59,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs index 0a785bf0448..325edc73996 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt index 8cecee2bc1a..82b67dbaac8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt index 296b4548b4e..cb492a0fcca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_DesignTime.mappings.txt @@ -1,45 +1,45 @@ Source Location: (7:0,7 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyModel| -Generated Location: (1210:26,0 [7] ) +Generated Location: (1236:26,0 [7] ) |MyModel| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (1476:36,0 [5] ) +Generated Location: (1502:36,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (1762:46,22 [14] ) +Generated Location: (1788:46,22 [14] ) |MyPropertyName| Source Location: (58:2,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (2019:56,0 [17] ) +Generated Location: (2045:56,0 [17] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (2317:66,22 [4] ) +Generated Location: (2343:66,22 [4] ) |Html| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (2564:76,0 [5] ) +Generated Location: (2590:76,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (2850:86,22 [15] ) +Generated Location: (2876:86,22 [15] ) |MyPropertyName2| Source Location: (129:4,8 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (3108:96,0 [17] ) +Generated Location: (3134:96,0 [17] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (3406:106,22 [5] ) +Generated Location: (3432:106,22 [5] ) |Html2| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs index 8a9e54e83ec..26d47a76b27 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "771acb56660727ab6e4ca50e95bde0cf2a72af8de3e9ec1cd4b72969645cb9af" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt index bde5ff49094..a22e7329218 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InjectWithSemicolon - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt index 8bdc56783f5..56b60c17d77 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon_Runtime.mappings.txt @@ -1,40 +1,40 @@ Source Location: (129:4,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (2065:32,0 [9] ) +Generated Location: (2108:32,0 [9] ) |MyService| Source Location: (147:4,26 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html2| -Generated Location: (2272:40,0 [5] ) +Generated Location: (2315:40,0 [5] ) |Html2| Source Location: (93:3,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (2605:51,0 [5] ) +Generated Location: (2648:51,0 [5] ) |MyApp| Source Location: (99:3,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName2| -Generated Location: (2799:59,0 [15] ) +Generated Location: (2842:59,0 [15] ) |MyPropertyName2| Source Location: (58:2,8 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyService| -Generated Location: (3142:70,0 [9] ) +Generated Location: (3185:70,0 [9] ) |MyService| Source Location: (76:2,26 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |Html| -Generated Location: (3349:78,0 [4] ) +Generated Location: (3392:78,0 [4] ) |Html| Source Location: (24:1,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyApp| -Generated Location: (3681:89,0 [5] ) +Generated Location: (3724:89,0 [5] ) |MyApp| Source Location: (30:1,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InjectWithSemicolon.cshtml) |MyPropertyName| -Generated Location: (3875:97,0 [14] ) +Generated Location: (3918:97,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs index 6b3b1d6fe0a..95b744435dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt index 9ddf119a56e..94f6f2ad15b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt index c6395a4a74a..4e939233544 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (1171:26,0 [5] ) +Generated Location: (1197:26,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (1444:36,22 [14] ) +Generated Location: (1470:36,22 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs index 2aac70d02e7..96e2a2f1399 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f0ec78e6ab6def57bd9067e564edaa84059a8ecb9a3c1766a148a7df3096b7b0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt index 847d8453977..cdcb7fbec97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inject - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt index 1922c8947a9..d8c4bcd952e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject_Runtime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyApp| -Generated Location: (1974:32,0 [5] ) +Generated Location: (2017:32,0 [5] ) |MyApp| Source Location: (14:0,14 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inject.cshtml) |MyPropertyName| -Generated Location: (2155:40,0 [14] ) +Generated Location: (2198:40,0 [14] ) |MyPropertyName| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs index a8ea985c411..f6e3da8b232 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt index ebfd3e3876e..2fb419b34aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs index ac456620445..e698918c05c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3b8355e6c17c9dc5d6062d64a789a8b5a81db5adec1e9913ff7a7c1565682765" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt index 0ecb4011503..d01e12f9994 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InvalidNamespaceAtEOF_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InvalidNamespaceAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [11] InvalidNamespaceAtEOF.cshtml) - namespace HtmlContent - (11:0,11 [5] InvalidNamespaceAtEOF.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs index c1d814c2471..17e66eaa399 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt index 9512f8a1070..2ee3e356b92 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs index c9689a971e2..1fd1127e0d6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "189450bf29773af1b743c49fb8b24230b292c19db0334d587f0e094856e5218f" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt index fa1d7b2efe5..2ca6219b5d3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MalformedPageDirective_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MalformedPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [6] MalformedPageDirective.cshtml) - page HtmlContent - (6:0,6 [49] MalformedPageDirective.cshtml) diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs index d87a23e0538..3bf6b202b36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt index 433f38b5a28..008decced62 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt index 9e03dac2d9d..a80f0177844 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |DateTime| -Generated Location: (1700:32,0 [8] ) +Generated Location: (1726:32,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (2009:42,37 [29] ) +Generated Location: (2035:42,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (83:4,17 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Date| -Generated Location: (2719:60,102 [4] ) +Generated Location: (2745:60,102 [4] ) |Date| Source Location: (111:5,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml) |Model| -Generated Location: (3149:69,94 [5] ) +Generated Location: (3175:69,94 [5] ) |Model| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs index 737f6dc2ace..6fc3952dab6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b96e944bd86a2acecd5a176708eedb3cdc8eef05122fd51aa5c4fe58d4069af7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt index f83f43c30c1..184efec4d89 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ModelExpressionTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ModelExpressionTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs index 2c3a262eed2..8a984eb787c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt index c7b21ddcf3b..f486553c060 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt index 7394637419a..bb47d519adf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (7:0,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml) |System.Collections.IEnumerable| -Generated Location: (1191:26,0 [30] ) +Generated Location: (1217:26,0 [30] ) |System.Collections.IEnumerable| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs index 9fd9006a420..e789c5db091 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "36b79708f36f3606c2eb7c7eaf383853df55ab030280d5deb8f762fac54fd1c0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt index 2334402e431..2edaa113a45 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Model_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Model - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs index 74a617a6104..5d852cb1555 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt index a7e32184d01..211de3d9ff0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MultipleModels - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt index 20d5397ea6c..71c30fcdb10 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (7:0,7 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |ThisShouldBeGenerated| -Generated Location: (1209:26,0 [21] ) +Generated Location: (1235:26,0 [21] ) |ThisShouldBeGenerated| Source Location: (37:1,7 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MultipleModels.cshtml) |System.Collections.IEnumerable| -Generated Location: (1484:36,0 [30] ) +Generated Location: (1510:36,0 [30] ) |System.Collections.IEnumerable| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs index 6c494c79c74..f81e5637974 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt index b8bd6238d8c..ed9a464951c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.ir.txt @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt index 89f6b504abe..6ddb439deb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (18:1,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml) |Test.Namespace| -Generated Location: (1243:26,44 [14] ) +Generated Location: (1252:26,44 [14] ) |Test.Namespace| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs index 88fcd2f08a3..60084b62428 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.codegen.cs @@ -18,7 +18,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt index 6fa07da4f1c..31ab344447d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PageWithNamespace_Runtime.ir.txt @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PageWithNamespace - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (34:2,0 [20] PageWithNamespace.cshtml) LazyIntermediateToken - (34:2,0 [3] PageWithNamespace.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt index 4982f6e4002..cae87bb1f87 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs index 2732e3630be..d842ee826ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5eaf8fb8900db86500f29c357a6119d29d8639ae7b054b4cc5e00bbdf4882c2d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt index e45af51cdc0..346b2f28937 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPageWithNoLeadingPageDirective_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPageWithNoLeadingPageDirective - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [28] RazorPageWithNoLeadingPageDirective.cshtml) LazyIntermediateToken - (0:0,0 [4] RazorPageWithNoLeadingPageDirective.cshtml) - Html -
#pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Bar", "Foo", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt index 9f0866f81cf..661ce844d18 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithCssScope.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - Bar - Foo - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - asp-route - register - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - method - post - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs index 1a6c001424e..5b240502e36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt index 42c3c1e4cd8..e87172ba9ca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt index aea33d2ab95..e9450d8ef26 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [9] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel| -Generated Location: (1290:31,0 [9] ) +Generated Location: (1316:31,0 [9] ) |TestModel| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1805:48,6 [10] ) +Generated Location: (1831:48,6 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1973:55,6 [14] ) +Generated Location: (1999:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs index 52d2439f36d..3343a1a9015 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "938aa77e05d0524687967a4964c7424054e2f7b837772fe19895341aa7ef5bda" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt index 5179d0b1e19..8efd1b0b509 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (47:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (47:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt index b1ede97e6be..193db25f87d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangNew_Runtime.mappings.txt @@ -1,17 +1,17 @@ Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace | -Generated Location: (971:16,0 [21] ) +Generated Location: (1005:16,0 [21] ) |using TestNamespace | Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2063:36,0 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2319:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs index 74b01482d43..70d2d84399c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt index 63b5fb776d7..33c19ce8797 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt index aea33d2ab95..e9450d8ef26 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [9] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel| -Generated Location: (1290:31,0 [9] ) +Generated Location: (1316:31,0 [9] ) |TestModel| Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1805:48,6 [10] ) +Generated Location: (1831:48,6 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1973:55,6 [14] ) +Generated Location: (1999:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs index 60fb805e412..5660607b01a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "938aa77e05d0524687967a4964c7424054e2f7b837772fe19895341aa7ef5bda" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt index eaf0f2f9770..f937ddd5ef3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (47:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (47:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt index b1ede97e6be..193db25f87d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNonNullableModel_LangOld_Runtime.mappings.txt @@ -1,17 +1,17 @@ Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace | -Generated Location: (971:16,0 [21] ) +Generated Location: (1005:16,0 [21] ) |using TestNamespace | Source Location: (54:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2063:36,0 [10] ) |Model.Name| Source Location: (78:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2319:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs index 56e4cec6181..a0592546ba4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt index b13cccfd3eb..caecaef2084 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt index 4ab42af6467..580d99371c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel?| -Generated Location: (1290:31,0 [10] ) +Generated Location: (1316:31,0 [10] ) |TestModel?| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1806:48,6 [10] ) +Generated Location: (1832:48,6 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1974:55,6 [14] ) +Generated Location: (2000:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs index c743e8ac9c4..68a1f75cf5f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a0b3df03ac7b0b582a2924ed8f2f85f3df8f906c37a1aa7f1f8255290fbf29a9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt index 1f0b68a5737..1c026c0aef5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (48:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (48:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt index a2df4b7677c..544865bd281 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangNew_Runtime.mappings.txt @@ -1,17 +1,17 @@ Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace | -Generated Location: (971:16,0 [21] ) +Generated Location: (1005:16,0 [21] ) |using TestNamespace | Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2063:36,0 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2319:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs index 7c147f6f243..fa4833099f7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt index 70413ed61f7..d6dfdd62fd1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - TestNamespace RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt index 4ab42af6467..580d99371c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (8:1,1 [19] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace| -Generated Location: (545:15,0 [19] ) +Generated Location: (562:15,0 [19] ) |using TestNamespace| Source Location: (36:2,7 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |TestModel?| -Generated Location: (1290:31,0 [10] ) +Generated Location: (1316:31,0 [10] ) |TestModel?| Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (1806:48,6 [10] ) +Generated Location: (1832:48,6 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (1974:55,6 [14] ) +Generated Location: (2000:55,6 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs index eadcffb5342..cc5ef0e825e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a0b3df03ac7b0b582a2924ed8f2f85f3df8f906c37a1aa7f1f8255290fbf29a9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt index dc30fcf3e66..7a00e428f85 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (48:3,0 [6] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (48:3,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt index a2df4b7677c..544865bd281 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPage_WithNullableModel_LangOld_Runtime.mappings.txt @@ -1,17 +1,17 @@ Source Location: (8:1,1 [21] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |using TestNamespace | -Generated Location: (971:16,0 [21] ) +Generated Location: (1005:16,0 [21] ) |using TestNamespace | Source Location: (55:4,5 [10] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model.Name| -Generated Location: (2020:36,0 [10] ) +Generated Location: (2063:36,0 [10] ) |Model.Name| Source Location: (79:6,5 [14] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) |Model?.Address| -Generated Location: (2276:46,0 [14] ) +Generated Location: (2319:46,0 [14] ) |Model?.Address| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs index 6d226f0fd46..2984cf4987b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -22,7 +22,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt index dd03351f6cb..5350ef031e8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -12,7 +12,7 @@ RazorCompiledItemMetadataAttribute - (6:0,6 [8] RazorPagesWithRouteTemplate.cshtml) RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt index f350890e212..eb719e203ff 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (36:3,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (568:15,0 [41] ) +Generated Location: (585:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (6:0,6 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |"/About"| -Generated Location: (1572:33,37 [8] ) +Generated Location: (1598:33,37 [8] ) |"/About"| Source Location: (25:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |NewModel| -Generated Location: (1823:43,0 [8] ) +Generated Location: (1849:43,0 [8] ) |NewModel| Source Location: (213:12,18 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) |Model.Name| -Generated Location: (2373:60,18 [10] ) +Generated Location: (2399:60,18 [10] ) |Model.Name| Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml) @@ -25,7 +25,7 @@ Source Location: (93:5,12 [97] TestFiles/IntegrationTests/CodeGenerationIntegrat public string Name { get; set; } } | -Generated Location: (2619:69,12 [97] ) +Generated Location: (2645:69,12 [97] ) | public class NewModel : PageModel { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs index 26803a7ec1d..a0be33e7420 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "da9a31551104c58f287a17de26f4a3aa316e7e17fb9ed06e39692c4f45fb133a" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -34,7 +34,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt index 54fb257212b..1ffae76587e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithRouteTemplate_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -13,7 +13,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithRouteTemplate - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) LazyIntermediateToken - (16:1,0 [2] RazorPagesWithRouteTemplate.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs index c4fa3465aee..2d7527b1211 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt index eec7011d9bb..50cd6d68233 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (38:3,1 [41] RazorPagesWithoutModel.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt index e335c60c42a..139ede15cf8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_DesignTime.mappings.txt @@ -1,16 +1,16 @@ Source Location: (38:3,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (563:15,0 [41] ) +Generated Location: (580:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (23:2,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |"*, AppCode"| -Generated Location: (1902:38,37 [12] ) +Generated Location: (1928:38,37 [12] ) |"*, AppCode"| Source Location: (566:24,47 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) |Name| -Generated Location: (2603:57,47 [4] ) +Generated Location: (2629:57,47 [4] ) |Name| Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml) @@ -28,7 +28,7 @@ Source Location: (95:5,12 [283] TestFiles/IntegrationTests/CodeGenerationIntegra public string Name { get; set; } } | -Generated Location: (3426:74,12 [283] ) +Generated Location: (3452:74,12 [283] ) | public IActionResult OnPost(Customer customer) { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs index 22f235cc89d..b31ece9290d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4d4352438ec54cff935ed10c73f4fb4ce0ea8ffc7c46b467007618dead77f960" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt index e3d717690e5..8b1129000fc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPagesWithoutModel_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPagesWithoutModel - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs index a7e228168eb..34f4321738d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -21,7 +21,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt index 0395753efcf..b60fec33036 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -11,7 +11,7 @@ UsingDirective - (55:4,1 [41] RazorPages.cshtml) - Microsoft.AspNetCore.Mvc.RazorPages RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt index 6d58723a403..461dfa9e38b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (55:4,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |using Microsoft.AspNetCore.Mvc.RazorPages| -Generated Location: (551:15,0 [41] ) +Generated Location: (568:15,0 [41] ) |using Microsoft.AspNetCore.Mvc.RazorPages| Source Location: (16:2,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |NewModel| -Generated Location: (1798:37,0 [8] ) +Generated Location: (1824:37,0 [8] ) |NewModel| Source Location: (40:3,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |"*, AppCode"| -Generated Location: (2112:48,37 [12] ) +Generated Location: (2138:48,37 [12] ) |"*, AppCode"| Source Location: (661:28,47 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) |Model.Name| -Generated Location: (2801:67,47 [10] ) +Generated Location: (2827:67,47 [10] ) |Model.Name| Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml) @@ -36,7 +36,7 @@ Source Location: (112:6,12 [360] TestFiles/IntegrationTests/CodeGenerationIntegr public string Name { get; set; } } | -Generated Location: (3618:84,12 [360] ) +Generated Location: (3644:84,12 [360] ) | public class NewModel : PageModel { diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs index a029a343a45..e6a034a4616 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "676265931c358e22efce0fe9ebd76cc3a7d2a5c12d37384e13aec92aa7667663" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages), @"mvc.1.0.razor-page", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages : global::Microsoft.AspNetCore.Mvc.RazorPages.Page #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("text-danger"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt index 711a257e33e..983fbd7f38b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorPages_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorPages - global::Microsoft.AspNetCore.Mvc.RazorPages.Page - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - text-danger - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - col-md-10 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - form-group - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs index 6b5942c13ae..8d5327bb7b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ae0459eafa91f6ae24fb2b349577f0dfb20a0e269a8a48888a1285a725191322" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt index da0ffc7897f..181bccc7705 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_Layout_WithCssScope.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [164] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs index cd3b23a0f11..f7d7de1bfbf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "693e482257fa9ef37bc202b83d2bd2e6f8475e8f4d328f07e18a689f4f68c917" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("Bar", "Foo", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt index c17f79100e0..e9a136bd4b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithCssScope.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - Bar - Foo - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - asp-route - register - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - method - post - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs index 6b9da69c452..a83bb4b85aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d0420b910fa2a6f0119a96ffb534fee225ca66e96b3b1741cf04c7ebd9525f62" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt index 5368db952de..36bc7b80611 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNonNullableModel_NullableContextEnabled.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs index e7eb993196d..a043bb2314a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "714936b16425e1b5a49883c3e910ed43c30422ebc564f54651880695133a3b4b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : MyBasePage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : MyBasePage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt index 4c81d1f15e7..6a1136c45a7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableBaseType_NullableContexEnabled.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - MyBasePage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - MyBasePage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs index 78af829efa1..8ff9736d1a7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b354ee3595811e9701f9c464ddf35ccb31360a3799b7bb4279192f084591a4fe" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt index 38a57ff69d2..676d1e370ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextEnabled.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs index 78af829efa1..8ff9736d1a7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b354ee3595811e9701f9c464ddf35ccb31360a3799b7bb4279192f084591a4fe" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -24,7 +24,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/test.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt index 38a57ff69d2..676d1e370ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorView_WithNullableModel_NullableContextNotEnabled.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -12,7 +12,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_test - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) LazyIntermediateToken - (0:0,0 [2] TestFiles\IntegrationTests\CodeGenerationIntegrationTest\test.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index 81077af8977..8c7dd05d49e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt index cc0aa1a3871..04d308dc6fe 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index cb8e50488d6..744d86e6e84 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (7:0,7 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |DateTime| -Generated Location: (1652:32,0 [8] ) +Generated Location: (1678:32,0 [8] ) |DateTime| Source Location: (33:2,14 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |"InputTestTagHelper, AppCode"| -Generated Location: (1945:42,37 [29] ) +Generated Location: (1971:42,37 [29] ) |"InputTestTagHelper, AppCode"| Source Location: (152:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (2221:52,22 [8] ) +Generated Location: (2247:52,22 [8] ) |Section1| Source Location: (68:4,2 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml"; | -Generated Location: (2719:69,2 [46] ) +Generated Location: (2745:69,2 [46] ) | Layout = "_SectionTestLayout.cshtml"; | Source Location: (222:12,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Date| -Generated Location: (3182:79,102 [4] ) +Generated Location: (3208:79,102 [4] ) |Date| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index dacf79c54db..1f7e752cf29 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1ed96a957fe000fd0c80cc511def19ab692563eb64f3349a4c87c524e2ecbd60" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index 53f5abfb6ee..8f0184c644c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTestTagHelper - __InputTestTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs index 624e21b46c6..e6ee941687c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -35,7 +35,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt index f3331e380a8..fcf408db474 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -13,7 +13,7 @@ UsingDirective - (73:3,1 [12] UsingDirectives.cshtml) - System RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt index a22a7e8ae05..406be5361cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (1:0,1 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System.ComponentModel| -Generated Location: (529:14,0 [27] ) +Generated Location: (546:14,0 [27] ) |using System.ComponentModel| Source Location: (31:1,1 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System.Collections| -Generated Location: (690:19,0 [24] ) +Generated Location: (707:19,0 [24] ) |using System.Collections| Source Location: (58:2,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System| -Generated Location: (848:24,0 [12] ) +Generated Location: (865:24,0 [12] ) |using System| Source Location: (73:3,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml) |using System| -Generated Location: (994:29,0 [12] ) +Generated Location: (1011:29,0 [12] ) |using System| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs index 8a8ffe366b1..44a2a7ae909 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9194971d2fb7908a02b02841f18655ccc0908a204c2fa948e8dc7e947269da86" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -41,7 +41,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt index a679c25ed02..882893e7b82 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UsingDirectives_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks @@ -14,7 +14,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UsingDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs index 377646cfe7d..8be96b61c8d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "83aa72bbe254ff67d9ee42878d80c6403361bcbb777a50d8b3d718cba176d15c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -41,9 +41,9 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon return __backed__tagHelperScopeManager; } } - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper __OptionalTestViewComponentTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper __OptionalTestWithParamViewComponentTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper __OptionalWithMultipleTypesViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper __OptionalTestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper __OptionalTestWithParamViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper __OptionalWithMultipleTypesViewComponentTagHelper; #pragma warning disable 1998 public async override global::System.Threading.Tasks.Task ExecuteAsync() { @@ -51,7 +51,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalTestViewComponentTagHelper = CreateTagHelper(); + __OptionalTestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestViewComponentTagHelper); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -64,7 +64,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalTestViewComponentTagHelper = CreateTagHelper(); + __OptionalTestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestViewComponentTagHelper); __OptionalTestViewComponentTagHelper.showSecret = #nullable restore @@ -87,7 +87,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); + __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestWithParamViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("mysecret"); @@ -105,7 +105,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-test-with-param", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); + __OptionalTestWithParamViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalTestWithParamViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral("mysecret"); @@ -133,7 +133,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); await __tagHelperRunner.RunAsync(__tagHelperExecutionContext); if (!__tagHelperExecutionContext.Output.IsContentModified) @@ -146,7 +146,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -189,7 +189,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -222,7 +222,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore @@ -265,7 +265,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon __tagHelperExecutionContext = __tagHelperScopeManager.Begin("vc:optional-with-multiple-types", global::Microsoft.AspNetCore.Razor.TagHelpers.TagMode.StartTagAndEndTag, "test", async() => { } ); - __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); + __OptionalWithMultipleTypesViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__OptionalWithMultipleTypesViewComponentTagHelper); __OptionalWithMultipleTypesViewComponentTagHelper.age = #nullable restore diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt index 4f08e19b817..45573d87c08 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelperOptionalParam_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,23 +11,23 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper - __OptionalTestViewComponentTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper - __OptionalTestWithParamViewComponentTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper - __OptionalWithMultipleTypesViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper - __OptionalTestViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper - __OptionalTestWithParamViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper - __OptionalWithMultipleTypesViewComponentTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (28:1,0 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (28:1,0 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (30:2,0 [37] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper DefaultTagHelperExecute - HtmlContent - (67:2,37 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (67:2,37 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (69:3,0 [57] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestViewComponentTagHelper DefaultTagHelperProperty - (100:3,31 [5] ViewComponentTagHelperOptionalParam.cshtml) - show-secret - bool OptionalTestViewComponentTagHelper.showSecret - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (101:3,32 [4] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (101:3,32 [4] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - true @@ -36,7 +36,7 @@ LazyIntermediateToken - (126:3,57 [4] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n\n TagHelper - (130:5,0 [77] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test-with-param - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper DefaultTagHelperProperty - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - secret - string OptionalTestWithParamViewComponentTagHelper.secret - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (167:5,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - Html - mysecret @@ -45,7 +45,7 @@ LazyIntermediateToken - (207:5,77 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (209:6,0 [97] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-test-with-param - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalTestWithParamViewComponentTagHelper DefaultTagHelperProperty - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - secret - string OptionalTestWithParamViewComponentTagHelper.secret - HtmlAttributeValueStyle.DoubleQuotes HtmlContent - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (246:6,37 [8] ViewComponentTagHelperOptionalParam.cshtml) - Html - mysecret @@ -57,13 +57,13 @@ LazyIntermediateToken - (306:6,97 [4] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n\n TagHelper - (310:8,0 [67] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperExecute - HtmlContent - (377:8,67 [2] ViewComponentTagHelperOptionalParam.cshtml) LazyIntermediateToken - (377:8,67 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (379:9,0 [122] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (417:9,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (417:9,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (439:9,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -75,7 +75,7 @@ LazyIntermediateToken - (501:9,122 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (503:10,0 [100] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (541:10,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (541:10,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (563:10,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -85,7 +85,7 @@ LazyIntermediateToken - (603:10,100 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (605:11,0 [126] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (643:11,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (643:11,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (665:11,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes @@ -97,7 +97,7 @@ LazyIntermediateToken - (731:11,126 [2] ViewComponentTagHelperOptionalParam.cshtml) - Html - \n TagHelper - (733:12,0 [126] ViewComponentTagHelperOptionalParam.cshtml) - vc:optional-with-multiple-types - TagMode.StartTagAndEndTag DefaultTagHelperBody - - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelperOptionalParam.__Generated__OptionalWithMultipleTypesViewComponentTagHelper DefaultTagHelperProperty - (771:12,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - age - int OptionalWithMultipleTypesViewComponentTagHelper.age - HtmlAttributeValueStyle.DoubleQuotes LazyIntermediateToken - (771:12,38 [2] ViewComponentTagHelperOptionalParam.cshtml) - CSharp - 12 DefaultTagHelperProperty - (793:12,60 [4] ViewComponentTagHelperOptionalParam.cshtml) - favorite-decimal - double OptionalWithMultipleTypesViewComponentTagHelper.favoriteDecimal - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs index eb19091d31e..3ff1d5ee76c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden @@ -25,7 +25,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon #pragma warning restore 0649 private global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner __tagHelperRunner = new global::Microsoft.AspNetCore.Razor.Runtime.TagHelpers.TagHelperRunner(); private global::AllTagHelper __AllTagHelper; - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; #pragma warning disable 219 private void __RazorDirectiveTokenHelpers__() { ((global::System.Action)(() => { @@ -55,7 +55,7 @@ private void __RazorDirectiveTokenHelpers__() { #line hidden #nullable disable __AllTagHelper = CreateTagHelper(); - __TestViewComponentTagHelper = CreateTagHelper(); + __TestViewComponentTagHelper = CreateTagHelper(); #nullable restore #line 6 "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" __o = foo; diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt index ef059352dae..a9c80f4be8b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,10 +10,10 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html @@ -45,7 +45,7 @@ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag DefaultTagHelperBody - DefaultTagHelperCreate - - AllTagHelper - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml) LazyIntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt index 057088936b2..2a460b44375 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (14:0,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |"*, AppCode"| -Generated Location: (1904:33,37 [12] ) +Generated Location: (1947:33,37 [12] ) |"*, AppCode"| Source Location: (30:1,2 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) | var foo = "Hello"; | -Generated Location: (2412:50,2 [26] ) +Generated Location: (2455:50,2 [26] ) | var foo = "Hello"; | Source Location: (83:5,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml) |foo| -Generated Location: (2901:60,22 [3] ) +Generated Location: (2961:60,22 [3] ) |foo| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs index 56a0795ba61..6a736639fb4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9ef17a17b6e1fedefe92b2dd4e87273d3ae73d9b1f8b2ad44ce57c5611f991d3" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,10 +18,10 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { - private global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; + private global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper __TestViewComponentTagHelper; private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("bar", " World", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); #line hidden #pragma warning disable 0649 @@ -62,7 +62,7 @@ public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewCompon ); __AllTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__AllTagHelper); - __TestViewComponentTagHelper = CreateTagHelper(); + __TestViewComponentTagHelper = CreateTagHelper(); __tagHelperExecutionContext.Add(__TestViewComponentTagHelper); BeginWriteTagHelperAttribute(); WriteLiteral( diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt index 3a580f4bcfd..dbd7497bf4e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewComponentTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,8 +11,8 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - - FieldDeclaration - - private - global::AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + FieldDeclaration - - private - global::AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper - __TestViewComponentTagHelper PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - bar - World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::AllTagHelper - __AllTagHelper @@ -24,7 +24,7 @@ TagHelper - (61:5,0 [50] ViewComponentTagHelper.cshtml) - vc:test - TagMode.StartTagAndEndTag DefaultTagHelperBody - DefaultTagHelperCreate - - AllTagHelper - DefaultTagHelperCreate - - AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper + DefaultTagHelperCreate - - AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewComponentTagHelper.__Generated__TestViewComponentTagHelper DefaultTagHelperProperty - (82:5,21 [4] ViewComponentTagHelper.cshtml) - first-name - string TestViewComponentTagHelper.firstName - HtmlAttributeValueStyle.DoubleQuotes CSharpExpression - (83:5,22 [3] ViewComponentTagHelper.cshtml) LazyIntermediateToken - (83:5,22 [3] ViewComponentTagHelper.cshtml) - CSharp - foo diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs index 7b7b1d9c1d8..cf9a098e8f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.codegen.cs @@ -16,7 +16,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt index f3b8c4bf6a0..127368efc61 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.ir.txt @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt index 9bc576597c0..e262a3df658 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (11:0,11 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml) |Test.Namespace| -Generated Location: (1252:26,44 [14] ) +Generated Location: (1261:26,44 [14] ) |Test.Namespace| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs index 9f90d820011..703910bc92e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs @@ -18,7 +18,7 @@ namespace Test.Namespace [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt index 08028a66683..0084d515daa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.ir.txt @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ViewWithNamespace - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (27:1,0 [20] ViewWithNamespace.cshtml) LazyIntermediateToken - (27:1,0 [3] ViewWithNamespace.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt index de86e512705..ba2f901ea93 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt index 157f736942d..3462c072be6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (8:0,8 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |IHtmlHelper| -Generated Location: (1189:26,0 [19] ) +Generated Location: (1215:26,0 [19] ) |IHtmlHelper| Source Location: (28:0,28 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml) |Helper| -Generated Location: (1482:36,22 [6] ) +Generated Location: (1508:36,22 [6] ) |Helper| diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs index e1b5f94bf16..a59ed4b4c39 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d62f98eaaf5b78af8d93afeee3b564ac056a55d715d72361969351a6dd2ca3b2" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt index 5fb9225a6c9..d617143dc64 100644 --- a/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/_ViewImports_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest__ViewImports - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs index 6f587dfcbe1..8cde3aae0e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt index e071424669a..9a44b9c2446 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt index 07c4a5e920b..35a8de78307 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml) |"*, TestAssembly"| -Generated Location: (1253:26,37 [17] ) +Generated Location: (1279:26,37 [17] ) |"*, TestAssembly"| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs index d8ffd3b95f5..243ebcf2aa9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "acb2e9438f3250e99764ff47299ab6f5503f0ade0c3b94cd2fc81bc2e2506a59" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt index 405b5c6d5c4..42a48cc7afb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AddTagHelperDirective_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AddTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs index b75ad02d02d..70f39b825c2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -44,7 +44,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt index bac57b386b6..f4414203409 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -18,7 +18,7 @@ IntermediateToken - (223:3,11 [44] AttributeDirective.cshtml) - CSharp - [Conditional("DEBUG"), Conditional("TEST1")] RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt index 006aec03078..299aedb346b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (11:0,11 [56] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[System.Runtime.InteropServices.DllImport("user32.dll")]| -Generated Location: (607:17,11 [56] ) +Generated Location: (624:17,11 [56] ) |[System.Runtime.InteropServices.DllImport("user32.dll")]| Source Location: (80:1,11 [51] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[assembly: AssemblyTitleAttribute("Some assembly")]| -Generated Location: (839:24,11 [51] ) +Generated Location: (856:24,11 [51] ) |[assembly: AssemblyTitleAttribute("Some assembly")]| Source Location: (144:2,11 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]| -Generated Location: (1066:31,11 [66] ) +Generated Location: (1083:31,11 [66] ) |[DllImport("user32.dll", SetLastError=false, ExactSpelling=false)]| Source Location: (223:3,11 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml) |[Conditional("DEBUG"), Conditional("TEST1")]| -Generated Location: (1308:38,11 [44] ) +Generated Location: (1325:38,11 [44] ) |[Conditional("DEBUG"), Conditional("TEST1")]| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs index dc610f6d6d0..24e72f5cd86 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "182a864a99c94c5a3bbb535723dfb08ad1a97865628ed562e8f2c949e7098074" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -50,7 +50,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt index b6d17d80ca9..35d72f241bb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeDirective_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -19,7 +19,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (269:4,0 [13] AttributeDirective.cshtml) LazyIntermediateToken - (269:4,0 [13] AttributeDirective.cshtml) - Html - \nHello World diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs index ccb654f6366..ea08f7afb36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt index 2242a48e869..229a19759b0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt index 3b747b7422b..7643f998ef9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (2027:35,38 [15] ) +Generated Location: (2053:35,38 [15] ) |*, TestAssembly| Source Location: (187:5,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (3130:58,42 [4] ) +Generated Location: (3156:58,42 [4] ) |true| Source Location: (233:6,36 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml) |true| -Generated Location: (3897:71,42 [4] ) +Generated Location: (3923:71,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs index d5cabab89c3..fdd69b41d50 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a43c77165a8cc48045af412fa05ad51a01a7ac7693152e08d46013b3fe119376" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("catchAll", new global::Microsoft.AspNetCore.Html.HtmlString("hi"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt index 0add2b2b0b7..1b143bcc8ec 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/AttributeTargetingTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_AttributeTargetingTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - catchAll - hi - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - btn - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs index 5408bce08b8..0dfdaadb33b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt index a513815d442..17925588265 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.cs-diagnostics.txt @@ -9,7 +9,7 @@ Diagnostic(ErrorCode.ERR_InvalidExprTerm, ";").WithArguments(";").WithLocation(1 Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(19, 49), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(20,58): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // __o = await Foo.Bar(1, 2); -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(21,48): error CS1501: No overload for method 'Foo' takes 2 arguments // __o = await Foo("bob", true); Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(21, 48), @@ -18,7 +18,7 @@ Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocat Diagnostic(ErrorCode.ERR_NameNotInContext, "something").WithArguments("something").WithLocation(22, 54), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,59): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,72): error CS1002: ; expected // await Foo.Bar(1, 2) Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(23, 72), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt index bc12cfc2123..fb37c7848d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt index f982a971eb6..6af791b25a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_DesignTime.mappings.txt @@ -1,81 +1,81 @@ Source Location: (192:9,39 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (1464:33,39 [11] ) +Generated Location: (1490:33,39 [11] ) |await Foo()| Source Location: (247:10,38 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (1667:40,38 [11] ) +Generated Location: (1693:40,38 [11] ) |await Foo()| Source Location: (304:11,39 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo(); | -Generated Location: (1871:47,39 [14] ) +Generated Location: (1897:47,39 [14] ) | await Foo(); | Source Location: (371:12,46 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (2084:54,46 [1] ) +Generated Location: (2110:54,46 [1] ) | | Source Location: (376:12,51 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo()| -Generated Location: (2289:61,51 [11] ) +Generated Location: (2315:61,51 [11] ) |await Foo()| Source Location: (391:12,66 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (2520:68,66 [1] ) +Generated Location: (2546:68,66 [1] ) | | Source Location: (448:13,49 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await| -Generated Location: (2723:75,49 [5] ) +Generated Location: (2749:75,49 [5] ) |await| Source Location: (578:18,42 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo(1, 2)| -Generated Location: (2924:82,42 [15] ) +Generated Location: (2950:82,42 [15] ) |await Foo(1, 2)| Source Location: (650:19,51 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo.Bar(1, 2)| -Generated Location: (3144:89,51 [19] ) +Generated Location: (3170:89,51 [19] ) |await Foo.Bar(1, 2)| Source Location: (716:20,41 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo("bob", true)| -Generated Location: (3358:96,41 [22] ) +Generated Location: (3384:96,41 [22] ) |await Foo("bob", true)| Source Location: (787:21,42 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo(something, hello: "world"); | -Generated Location: (3576:103,42 [39] ) +Generated Location: (3602:103,42 [39] ) | await Foo(something, hello: "world"); | Source Location: (884:22,51 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | await Foo.Bar(1, 2) | -Generated Location: (3819:110,51 [21] ) +Generated Location: (3845:110,51 [21] ) | await Foo.Bar(1, 2) | Source Location: (961:23,49 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (4042:117,49 [1] ) +Generated Location: (4068:117,49 [1] ) | | Source Location: (966:23,54 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await Foo(boolValue: false)| -Generated Location: (4250:124,54 [27] ) +Generated Location: (4276:124,54 [27] ) |await Foo(boolValue: false)| Source Location: (997:23,85 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) | | -Generated Location: (4516:131,85 [1] ) +Generated Location: (4542:131,85 [1] ) | | Source Location: (1057:24,52 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) |await ("wrrronggg")| -Generated Location: (4722:138,52 [19] ) +Generated Location: (4748:138,52 [19] ) |await ("wrrronggg")| Source Location: (12:0,12 [76] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml) @@ -85,7 +85,7 @@ Source Location: (12:0,12 [76] TestFiles/IntegrationTests/CodeGenerationIntegrat return "Bar"; } | -Generated Location: (4955:147,12 [76] ) +Generated Location: (4981:147,12 [76] ) | public async Task Foo() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs index b14ba777995..1c0297867fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "347cf5b257c3885845256697175dd94c0ef0bef29e4fca7e4ec1a009ff29d9a6" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt index 689f9027e75..2a1cc187c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.cs-diagnostics.txt @@ -9,7 +9,7 @@ Diagnostic(ErrorCode.ERR_InvalidExprTerm, "").WithArguments(")").WithLocation(14 Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(19, 49), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(20,58): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(20, 58), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(21,48): error CS1501: No overload for method 'Foo' takes 2 arguments // await Foo("bob", true) Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocation(21, 48), @@ -18,7 +18,7 @@ Diagnostic(ErrorCode.ERR_BadArgCount, "Foo").WithArguments("Foo", "2").WithLocat Diagnostic(ErrorCode.ERR_NameNotInContext, "something").WithArguments("something").WithLocation(22, 54), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,59): error CS0119: 'TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()' is a method, which is not valid in the given context // await Foo.Bar(1, 2) -Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), +Diagnostic(ErrorCode.ERR_BadSKunknown, "Foo").WithArguments("AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await.Foo()", "method").WithLocation(23, 59), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await.cshtml(23,72): error CS1002: ; expected // await Foo.Bar(1, 2) Diagnostic(ErrorCode.ERR_SemicolonExpected, "").WithLocation(23, 72), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt index dc8a7217ddb..0ec037d4b56 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Await_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Await - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (91:6,0 [100] Await.cshtml) LazyIntermediateToken - (91:6,0 [2] Await.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs index 813abd42c27..4cedf81e7ad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt index dd8c964d897..e0c5eb50cef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt index 1e0fdaa5abf..e1decd1dc69 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1895:34,37 [17] ) +Generated Location: (1921:34,37 [17] ) |"*, TestAssembly"| Source Location: (220:5,38 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |ViewBag.DefaultInterval| -Generated Location: (2816:55,38 [23] ) +Generated Location: (2842:55,38 [23] ) |ViewBag.DefaultInterval| Source Location: (303:6,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml) |true| -Generated Location: (3628:69,42 [4] ) +Generated Location: (3654:69,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs index bce2a46e832..a59d14a5a71 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt index 616179e17be..0c8fd38c72d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt index b31f7e030d7..b853caca4ce 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (17:0,17 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"THS"| -Generated Location: (1922:34,37 [5] ) +Generated Location: (1948:34,37 [5] ) |"THS"| Source Location: (38:1,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |"*, TestAssembly"| -Generated Location: (2204:44,37 [17] ) +Generated Location: (2230:44,37 [17] ) |"*, TestAssembly"| Source Location: (226:7,43 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml) |true| -Generated Location: (3120:65,43 [4] ) +Generated Location: (3146:65,43 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs index 0221050c13c..efb984760a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e26ec84b1a01b76c3d10ce2cba2205ab75c8b761b2507c37a6efbfe65c779b33" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "checkbox", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt index 5328116dfee..52f73ff911e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Prefixed_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_Prefixed - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs index 567029faed2..7fd152a6938 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt index 0b5c468e147..a99dc8eff04 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt index 293d9af037a..a9fdd47debb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1943:34,37 [17] ) +Generated Location: (1969:34,37 [17] ) |"*, TestAssembly"| Source Location: (50:1,17 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |"doesntmatter, nice"| -Generated Location: (2244:44,37 [20] ) +Generated Location: (2270:44,37 [20] ) |"doesntmatter, nice"| Source Location: (234:7,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml) |true| -Generated Location: (3772:72,42 [4] ) +Generated Location: (3798:72,42 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs index 1393a8a5025..d31e52b4fe3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "3c3f70086ebb07abc64ab51a5ec8d70be530fb87bb11790ef3989464e5532b55" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt index 786f4e2e2c1..9225bc581ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_RemoveTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers_RemoveTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs index 402316266c1..c4b86a40a45 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c8793c171f4a151a33e212951ef178accfcfb85800b349fdef9ce896e61f314e" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("data", new global::Microsoft.AspNetCore.Html.HtmlString("-delay1000"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt index 5285dd66289..4914fe4eb63 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/BasicTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_BasicTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - data - -delay1000 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_2 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs index a35459d6ee6..eb50361ca56 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt index 1f837ad032c..b9a6925378a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt index aaa647893d2..4210dc29750 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_DesignTime.mappings.txt @@ -2,7 +2,7 @@ | int i = 1; | -Generated Location: (1429:33,2 [18] ) +Generated Location: (1455:33,2 [18] ) | int i = 1; | @@ -10,20 +10,20 @@ Generated Location: (1429:33,2 [18] ) Source Location: (26:4,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |while(i <= 10) { | -Generated Location: (1599:41,1 [22] ) +Generated Location: (1625:41,1 [22] ) |while(i <= 10) { | Source Location: (69:5,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |i| -Generated Location: (1799:49,25 [1] ) +Generated Location: (1825:49,25 [1] ) |i| Source Location: (75:5,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | i += 1; }| -Generated Location: (1985:56,31 [16] ) +Generated Location: (2011:56,31 [16] ) | i += 1; }| @@ -31,14 +31,14 @@ Generated Location: (1985:56,31 [16] ) Source Location: (96:9,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |if(i == 11) { | -Generated Location: (2156:65,1 [19] ) +Generated Location: (2182:65,1 [19] ) |if(i == 11) { | Source Location: (140:10,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (2358:73,29 [3] ) +Generated Location: (2384:73,29 [3] ) | }| @@ -46,7 +46,7 @@ Source Location: (148:13,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegra |switch(i) { case 11: | -Generated Location: (2516:81,1 [35] ) +Generated Location: (2542:81,1 [35] ) |switch(i) { case 11: | @@ -56,7 +56,7 @@ Source Location: (219:15,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegr break; default: | -Generated Location: (2749:90,44 [40] ) +Generated Location: (2775:90,44 [40] ) | break; default: @@ -66,7 +66,7 @@ Source Location: (288:18,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegr | break; }| -Generated Location: (2980:100,37 [19] ) +Generated Location: (3006:100,37 [19] ) | break; }| @@ -74,26 +74,26 @@ Generated Location: (2980:100,37 [19] ) Source Location: (312:22,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |for(int j = 1; j <= 10; j += 2) { | -Generated Location: (3154:109,1 [39] ) +Generated Location: (3180:109,1 [39] ) |for(int j = 1; j <= 10; j += 2) { | Source Location: (378:23,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |j| -Generated Location: (3378:117,31 [1] ) +Generated Location: (3404:117,31 [1] ) |j| Source Location: (384:23,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (3571:124,37 [3] ) +Generated Location: (3597:124,37 [3] ) | }| Source Location: (392:26,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |try { | -Generated Location: (3729:132,1 [11] ) +Generated Location: (3755:132,1 [11] ) |try { | @@ -101,39 +101,39 @@ Source Location: (438:27,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegr | } catch(Exception ex) { | -Generated Location: (3933:140,39 [31] ) +Generated Location: (3959:140,39 [31] ) | } catch(Exception ex) { | Source Location: (500:29,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |ex.Message| -Generated Location: (4153:149,35 [10] ) +Generated Location: (4179:149,35 [10] ) |ex.Message| Source Location: (515:29,50 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (4368:156,50 [3] ) +Generated Location: (4394:156,50 [3] ) | }| Source Location: (535:32,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |i| -Generated Location: (4538:164,13 [1] ) +Generated Location: (4564:164,13 [1] ) |i| Source Location: (545:34,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) |lock(new object()) { | -Generated Location: (4695:171,1 [26] ) +Generated Location: (4721:171,1 [26] ) |lock(new object()) { | Source Location: (618:35,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml) | }| -Generated Location: (4926:179,51 [3] ) +Generated Location: (4952:179,51 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs index 4c9c14d6453..152f3fba272 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "7fc1108b4536c02783f218bd311d6a6202c6f3c6e438a6840e22e53a2efde68d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt index 229a4bc4796..c8d18bd5e40 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Blocks_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Blocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [18] Blocks.cshtml) LazyIntermediateToken - (2:0,2 [18] Blocks.cshtml) - CSharp - \n int i = 1;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs index 3cc09bc5ca0..0097ccd496b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt index 8308b1d58cd..c5bbb5cf5fd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt index e9fbf19e162..19c393663d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_DesignTime.mappings.txt @@ -6,7 +6,7 @@ }; | -Generated Location: (1984:39,6 [187] ) +Generated Location: (2010:39,6 [187] ) | var nameLookup = new Dictionary() { @@ -23,7 +23,7 @@ Source Location: (246:7,53 [253] TestFiles/IntegrationTests/CodeGenerationIntegr double AvogadroConstant = 6.022_140_857_747_474e23; decimal GoldenRatio = 1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M; | -Generated Location: (2378:52,53 [253] ) +Generated Location: (2404:52,53 [253] ) | int Sixteen = 0b0001_0000; @@ -40,7 +40,7 @@ Source Location: (509:15,5 [159] TestFiles/IntegrationTests/CodeGenerationIntegr // Do Something } }| -Generated Location: (2791:65,5 [159] ) +Generated Location: (2817:65,5 [159] ) |if (nameLookup.TryGetValue("John Doe", out var entry)) { if (entry.Extra is bool alive) @@ -51,12 +51,12 @@ Generated Location: (2791:65,5 [159] ) Source Location: (718:23,39 [62] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) |1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| -Generated Location: (3144:78,39 [62] ) +Generated Location: (3170:78,39 [62] ) |1.618_033_988_749_894_848_204_586_834_365_638_117_720_309_179M| Source Location: (816:27,10 [34] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) |(First: "John", Last: "Doe").First| -Generated Location: (3372:85,10 [34] ) +Generated Location: (3398:85,10 [34] ) |(First: "John", Last: "Doe").First| Source Location: (891:30,5 [291] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml) @@ -72,7 +72,7 @@ Source Location: (891:30,5 [291] TestFiles/IntegrationTests/CodeGenerationIntegr // Do even more of something break; }| -Generated Location: (3567:92,5 [291] ) +Generated Location: (3593:92,5 [291] ) |switch (entry.Extra) { case int age: diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs index 95477dd0bdb..78e407e146a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a2b132455b8159d1094743b389f41b79cabc421ed6d5972456b799596f28f035" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt index 648473989c3..94404ac098b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp7_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp7 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs index f969d0fd6c2..7ffd58a7ca1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -20,7 +20,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt index b373f7b031a..f48c4d06729 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -10,7 +10,7 @@ UsingDirective - (1:0,1 [32] CSharp8.cshtml) - System.Collections.Generic RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt index 4f44d6d810c..25a1fcb62ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (1:0,1 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |using System.Collections.Generic| -Generated Location: (501:14,0 [32] ) +Generated Location: (518:14,0 [32] ) |using System.Collections.Generic| Source Location: (39:2,2 [396] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -25,7 +25,7 @@ Source Location: (39:2,2 [396] TestFiles/IntegrationTests/CodeGenerationIntegrat return TestEnum.First; } | -Generated Location: (1535:37,2 [396] ) +Generated Location: (1561:37,2 [396] ) | IAsyncEnumerable GetAsyncEnumerable() { @@ -50,12 +50,12 @@ Generated Location: (1535:37,2 [396] ) Source Location: (441:24,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |words[1..2]| -Generated Location: (2090:63,6 [11] ) +Generated Location: (2116:63,6 [11] ) |words[1..2]| Source Location: (456:25,2 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |words[^2..^0]| -Generated Location: (2263:70,6 [13] ) +Generated Location: (2289:70,6 [13] ) |words[^2..^0]| Source Location: (476:27,2 [121] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -65,7 +65,7 @@ Source Location: (476:27,2 [121] TestFiles/IntegrationTests/CodeGenerationIntegr TestEnum.Second => "The Second!", _ => "The others", }| -Generated Location: (2438:77,6 [121] ) +Generated Location: (2464:77,6 [121] ) |testEnum switch { TestEnum.First => "The First!", @@ -77,36 +77,36 @@ Source Location: (603:34,1 [56] TestFiles/IntegrationTests/CodeGenerationIntegra |await foreach (var val in GetAsyncEnumerable()) { | -Generated Location: (2716:89,1 [56] ) +Generated Location: (2742:89,1 [56] ) |await foreach (var val in GetAsyncEnumerable()) { | Source Location: (660:36,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |val| -Generated Location: (2933:98,6 [3] ) +Generated Location: (2959:98,6 [3] ) |val| Source Location: (663:36,8 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) | }| -Generated Location: (3100:105,8 [3] ) +Generated Location: (3126:105,8 [3] ) | }| Source Location: (671:39,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |Person!.Name| -Generated Location: (3264:113,6 [12] ) +Generated Location: (3290:113,6 [12] ) |Person!.Name| Source Location: (686:40,1 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |People![0]!.Name![1]| -Generated Location: (3438:120,6 [20] ) +Generated Location: (3464:120,6 [20] ) |People![0]!.Name![1]| Source Location: (709:41,1 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) |DoSomething!(Person!)| -Generated Location: (3620:127,6 [21] ) +Generated Location: (3646:127,6 [21] ) |DoSomething!(Person!)| Source Location: (746:43,12 [480] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml) @@ -134,7 +134,7 @@ Source Location: (746:43,12 [480] TestFiles/IntegrationTests/CodeGenerationInteg public string? Name { get; set; } } | -Generated Location: (3858:136,12 [480] ) +Generated Location: (3884:136,12 [480] ) | enum TestEnum { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs index f8268b0cd78..7e11f565e73 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4c55c366b179d82f3d2800004985646e9bf0edbf993e2f4a94cbb70079823905" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -23,7 +23,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt index 07cef4d143d..bb528f13498 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CSharp8_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (67:2,1 [27] ) - global::System.Linq UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CSharp8 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (35:1,0 [2] CSharp8.cshtml) LazyIntermediateToken - (35:1,0 [2] CSharp8.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs index 55930c96a43..ac3817a6e41 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt index 92a30b69fac..f9f02115c98 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt index 6e5397874cf..69db1115a6a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (2:0,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml) || -Generated Location: (1453:33,2 [0] ) +Generated Location: (1479:33,2 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs index 43761ebc530..1ea22d8d369 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f1213d84263417aa717c6a0a201077dbb0fede3e19230a7ca231bc16735c7119" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt index 46ed83af606..b59b9bac1d8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockAtEOF_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [0] CodeBlockAtEOF.cshtml) LazyIntermediateToken - (2:0,2 [0] CodeBlockAtEOF.cshtml) - CSharp - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs index 1dce3d1b292..116237cce97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt index 0b3b55dff00..bf304bf85e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt index 3199ac454f0..4cec43ff035 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_DesignTime.mappings.txt @@ -1,26 +1,26 @@ Source Location: (2:0,2 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | var a = 1; | -Generated Location: (1483:33,2 [17] ) +Generated Location: (1509:33,2 [17] ) | var a = 1; | Source Location: (35:1,31 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | var b = 1; | -Generated Location: (1702:41,31 [22] ) +Generated Location: (1728:41,31 [22] ) | var b = 1; | Source Location: (69:2,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) |a+b| -Generated Location: (1924:49,29 [3] ) +Generated Location: (1950:49,29 [3] ) |a+b| Source Location: (80:2,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml) | | -Generated Location: (2139:56,40 [2] ) +Generated Location: (2165:56,40 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs index 7f668787152..217b68c331c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e8683fb69fb02cf452dac1db41d32e64f144a321993e7b85cd64971a7791cbc6" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt index 8f487442e4c..b3d714dc1dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlockWithTextElement_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlockWithTextElement - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [17] CodeBlockWithTextElement.cshtml) LazyIntermediateToken - (2:0,2 [17] CodeBlockWithTextElement.cshtml) - CSharp - \n var a = 1; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs index 96aef18f567..4684c3b37fc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt index 288c22a3821..dcfcf916fca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt index 3f70eea5943..55124aae89b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_DesignTime.mappings.txt @@ -4,7 +4,7 @@ Output.Write("

Hello from C#, #" + i.ToString() + "

"); } | -Generated Location: (1438:33,2 [115] ) +Generated Location: (1464:33,2 [115] ) | for(int i = 1; i <= 10; i++) { Output.Write("

Hello from C#, #" + i.ToString() + "

"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs index 2ff6258f254..a4af83b4488 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "71c9e37483da0d198df8bd194ad927f8340b7cfe40ab63cf3ce1dcd9d2a2904d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt index 863496486a1..5fb10616cde 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CodeBlock_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [115] CodeBlock.cshtml) LazyIntermediateToken - (2:0,2 [115] CodeBlock.cshtml) - CSharp - \n for(int i = 1; i <= 10; i++) {\n Output.Write("

Hello from C#, #" + i.ToString() + "

");\n }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs index 0764134d992..9ee02ac7722 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt index 5629bcc9adb..37adc76a699 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt index 084d1f475d6..1e00f4f822d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1901:34,37 [17] ) +Generated Location: (1927:34,37 [17] ) |"*, TestAssembly"| Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) @@ -9,7 +9,7 @@ Source Location: (36:2,1 [52] TestFiles/IntegrationTests/CodeGenerationIntegrati var checkbox = "checkbox"; | -Generated Location: (2408:51,1 [52] ) +Generated Location: (2434:51,1 [52] ) |if (true) { var checkbox = "checkbox"; @@ -18,39 +18,39 @@ Generated Location: (2408:51,1 [52] ) Source Location: (147:7,16 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (2752:63,33 [1] ) +Generated Location: (2778:63,33 [1] ) |@| Source Location: (149:7,18 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) || -Generated Location: (2753:63,34 [0] ) +Generated Location: (2779:63,34 [0] ) || Source Location: (149:7,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@| -Generated Location: (2753:63,34 [1] ) +Generated Location: (2779:63,34 [1] ) |@| Source Location: (150:7,19 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (2754:63,35 [1] ) +Generated Location: (2780:63,35 [1] ) |(| Source Location: (151:7,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |1+2| -Generated Location: (2755:63,36 [3] ) +Generated Location: (2781:63,36 [3] ) |1+2| Source Location: (154:7,23 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (2758:63,39 [1] ) +Generated Location: (2784:63,39 [1] ) |)| Source Location: (273:10,13 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if (false) { | -Generated Location: (3014:71,13 [43] ) +Generated Location: (3040:71,13 [43] ) |if (false) { | @@ -61,7 +61,7 @@ Source Location: (399:12,99 [66] TestFiles/IntegrationTests/CodeGenerationIntegr else { | -Generated Location: (3924:87,99 [66] ) +Generated Location: (3950:87,99 [66] ) | } else @@ -70,159 +70,159 @@ Generated Location: (3924:87,99 [66] ) Source Location: (495:16,46 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checkbox| -Generated Location: (4409:100,46 [8] ) +Generated Location: (4435:100,46 [8] ) |checkbox| Source Location: (512:16,63 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true| -Generated Location: (4800:109,63 [4] ) +Generated Location: (4826:109,63 [4] ) |true| Source Location: (523:16,74 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (5291:119,74 [18] ) +Generated Location: (5317:119,74 [18] ) | | Source Location: (556:17,31 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |true ? "checkbox" : "anything"| -Generated Location: (5713:129,31 [30] ) +Generated Location: (5739:129,31 [30] ) |true ? "checkbox" : "anything"| Source Location: (591:17,66 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | | -Generated Location: (6205:139,66 [18] ) +Generated Location: (6231:139,66 [18] ) | | Source Location: (623:18,30 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |if(true) { | -Generated Location: (6626:149,30 [11] ) +Generated Location: (6652:149,30 [11] ) |if(true) { | Source Location: (655:18,62 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | } else { | -Generated Location: (6864:156,62 [10] ) +Generated Location: (6890:156,62 [10] ) | } else { | Source Location: (686:18,93 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (7132:163,93 [2] ) +Generated Location: (7158:163,93 [2] ) | }| Source Location: (690:18,97 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (7626:173,97 [15] ) +Generated Location: (7652:173,97 [15] ) | }| Source Location: (212:8,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTime.Now| -Generated Location: (7932:182,32 [12] ) +Generated Location: (7958:182,32 [12] ) |DateTime.Now| Source Location: (832:22,14 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | var @object = false;| -Generated Location: (8200:190,14 [21] ) +Generated Location: (8226:190,14 [21] ) | var @object = false;| Source Location: (885:23,29 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (8636:199,42 [1] ) +Generated Location: (8662:199,42 [1] ) |(| Source Location: (886:23,30 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |@object| -Generated Location: (8637:199,43 [7] ) +Generated Location: (8663:199,43 [7] ) |@object| Source Location: (893:23,37 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (8644:199,50 [1] ) +Generated Location: (8670:199,50 [1] ) |)| Source Location: (760:21,39 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| -Generated Location: (9020:208,38 [30] ) +Generated Location: (9046:208,38 [30] ) |DateTimeOffset.Now.Year - 1970| Source Location: (1025:26,61 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (9560:218,60 [1] ) +Generated Location: (9586:218,60 [1] ) |(| Source Location: (1026:26,62 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (9561:218,61 [30] ) +Generated Location: (9587:218,61 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1056:26,92 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (9591:218,91 [1] ) +Generated Location: (9617:218,91 [1] ) |)| Source Location: (928:25,16 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |-1970 + @DateTimeOffset.Now.Year| -Generated Location: (9962:227,33 [32] ) +Generated Location: (9988:227,33 [32] ) |-1970 + @DateTimeOffset.Now.Year| Source Location: (1155:29,28 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year > 2014| -Generated Location: (10486:237,42 [30] ) +Generated Location: (10512:237,42 [30] ) |DateTimeOffset.Now.Year > 2014| Source Location: (1093:28,16 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |DateTimeOffset.Now.Year - 1970| -Generated Location: (10886:246,33 [30] ) +Generated Location: (10912:246,33 [30] ) |DateTimeOffset.Now.Year - 1970| Source Location: (1283:32,28 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | @( DateTimeOffset.Now.Year ) > 2014 | -Generated Location: (11408:256,42 [43] ) +Generated Location: (11434:256,42 [43] ) | @( DateTimeOffset.Now.Year ) > 2014 | Source Location: (1220:31,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |(| -Generated Location: (11821:265,33 [1] ) +Generated Location: (11847:265,33 [1] ) |(| Source Location: (1221:31,18 [29] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |"My age is this long.".Length| -Generated Location: (11822:265,34 [29] ) +Generated Location: (11848:265,34 [29] ) |"My age is this long.".Length| Source Location: (1250:31,47 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (11851:265,63 [1] ) +Generated Location: (11877:265,63 [1] ) |)| Source Location: (1355:34,9 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |someMethod(| -Generated Location: (12103:273,9 [11] ) +Generated Location: (12129:273,9 [11] ) |someMethod(| Source Location: (1410:34,64 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |checked| -Generated Location: (12583:278,63 [7] ) +Generated Location: (12609:278,63 [7] ) |checked| Source Location: (1375:34,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |123| -Generated Location: (12944:287,33 [3] ) +Generated Location: (12970:287,33 [3] ) |123| Source Location: (1424:34,78 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) |)| -Generated Location: (13072:294,1 [1] ) +Generated Location: (13098:294,1 [1] ) |)| Source Location: (1469:36,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml) | }| -Generated Location: (13619:310,10 [3] ) +Generated Location: (13645:310,10 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs index 513c0353eae..2231a483d54 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1f3b8300659fe8a9bf41b8b1b87fbc9ea296962d88df30817150779b3823b339" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt index 43dfcf928a3..dffaa409027 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ComplexTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ComplexTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - value - - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - placeholder - Enter in a new time... - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs index d91b68b31f0..d8e2ad4f31a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt index 1e6a91531c1..652d1a3c1a8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt index 6351ea88ec2..d5cd59517f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_DesignTime.mappings.txt @@ -4,7 +4,7 @@ var cls = "bar"; var s = "str"; | -Generated Location: (2043:39,2 [68] ) +Generated Location: (2069:39,2 [68] ) | var ch = true; var cls = "bar"; @@ -13,260 +13,260 @@ Generated Location: (2043:39,2 [68] ) Source Location: (74:4,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (2288:50,8 [1] ) +Generated Location: (2314:50,8 [1] ) |s| Source Location: (87:4,21 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (2480:57,21 [6] ) +Generated Location: (2506:57,21 [6] ) | | Source Location: (97:5,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (2663:65,8 [1] ) +Generated Location: (2689:65,8 [1] ) |s| Source Location: (107:5,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (2852:72,18 [3] ) +Generated Location: (2878:72,18 [3] ) |cls| Source Location: (114:5,25 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (3050:79,25 [6] ) +Generated Location: (3076:79,25 [6] ) | | Source Location: (124:6,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (3233:87,8 [1] ) +Generated Location: (3259:87,8 [1] ) |s| Source Location: (136:6,20 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (3424:94,20 [3] ) +Generated Location: (3450:94,20 [3] ) |cls| Source Location: (143:6,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (3624:101,27 [6] ) +Generated Location: (3650:101,27 [6] ) | | Source Location: (153:7,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (3807:109,8 [1] ) +Generated Location: (3833:109,8 [1] ) |s| Source Location: (163:7,18 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (3996:116,18 [3] ) +Generated Location: (4022:116,18 [3] ) |cls| Source Location: (172:7,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (4196:123,27 [6] ) +Generated Location: (4222:123,27 [6] ) | | Source Location: (202:8,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (4399:131,28 [1] ) +Generated Location: (4425:131,28 [1] ) |s| Source Location: (214:8,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |ch| -Generated Location: (4610:138,40 [2] ) +Generated Location: (4636:138,40 [2] ) |ch| Source Location: (220:8,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (4828:145,46 [6] ) +Generated Location: (4854:145,46 [6] ) | | Source Location: (250:9,28 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (5032:153,28 [1] ) +Generated Location: (5058:153,28 [1] ) |s| Source Location: (264:9,42 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |ch| -Generated Location: (5246:160,42 [2] ) +Generated Location: (5272:160,42 [2] ) |ch| Source Location: (270:9,48 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (5467:167,48 [6] ) +Generated Location: (5493:167,48 [6] ) | | Source Location: (280:10,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (5651:175,8 [1] ) +Generated Location: (5677:175,8 [1] ) |s| Source Location: (290:10,18 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |if(cls != null) { | -Generated Location: (5841:182,18 [18] ) +Generated Location: (5867:182,18 [18] ) |if(cls != null) { | Source Location: (309:10,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |cls| -Generated Location: (6066:189,37 [3] ) +Generated Location: (6092:189,37 [3] ) |cls| Source Location: (312:10,40 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | }| -Generated Location: (6280:196,40 [2] ) +Generated Location: (6306:196,40 [2] ) | }| Source Location: (318:10,46 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (6498:203,46 [6] ) +Generated Location: (6524:203,46 [6] ) | | Source Location: (343:11,23 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (6948:213,23 [6] ) +Generated Location: (6974:213,23 [6] ) | | Source Location: (358:12,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (7137:221,13 [1] ) +Generated Location: (7163:221,13 [1] ) |s| Source Location: (366:12,21 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| -Generated Location: (7330:228,21 [44] ) +Generated Location: (7356:228,21 [44] ) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| Source Location: (444:12,99 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (7644:235,99 [6] ) +Generated Location: (7670:235,99 [6] ) | | Source Location: (454:13,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (7828:243,8 [1] ) +Generated Location: (7854:243,8 [1] ) |s| Source Location: (464:13,18 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (8018:250,18 [4] ) +Generated Location: (8044:250,18 [4] ) |null| Source Location: (472:13,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (8219:257,26 [6] ) +Generated Location: (8245:257,26 [6] ) | | Source Location: (489:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (8410:265,15 [4] ) +Generated Location: (8436:265,15 [4] ) |null| Source Location: (496:14,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (8607:272,22 [1] ) +Generated Location: (8633:272,22 [1] ) |s| Source Location: (500:14,26 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (8805:279,26 [8] ) +Generated Location: (8831:279,26 [8] ) | | Source Location: (526:16,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (9005:288,22 [1] ) +Generated Location: (9031:288,22 [1] ) |s| Source Location: (536:16,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (9209:295,32 [4] ) +Generated Location: (9235:295,32 [4] ) |null| Source Location: (547:16,43 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (9427:302,43 [8] ) +Generated Location: (9453:302,43 [8] ) | | Source Location: (560:18,9 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s + s| -Generated Location: (9614:311,9 [5] ) +Generated Location: (9640:311,9 [5] ) |s + s| Source Location: (575:18,24 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (9814:318,24 [4] ) +Generated Location: (9840:318,24 [4] ) |null| Source Location: (586:18,35 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (10024:325,35 [6] ) +Generated Location: (10050:325,35 [6] ) | | Source Location: (597:19,9 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |if (s.Length != 0) { | -Generated Location: (10209:333,9 [21] ) +Generated Location: (10235:333,9 [21] ) |if (s.Length != 0) { | Source Location: (619:19,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |s| -Generated Location: (10431:340,31 [1] ) +Generated Location: (10457:340,31 [1] ) |s| Source Location: (620:19,32 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | }| -Generated Location: (10635:347,32 [2] ) +Generated Location: (10661:347,32 [2] ) | }| Source Location: (632:19,44 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (10851:354,44 [4] ) +Generated Location: (10877:354,44 [4] ) |null| Source Location: (643:19,55 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (11081:361,55 [6] ) +Generated Location: (11107:361,55 [6] ) | | Source Location: (664:20,19 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) |null| -Generated Location: (11276:369,19 [4] ) +Generated Location: (11302:369,19 [4] ) |null| Source Location: (675:20,30 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml) | | -Generated Location: (11481:376,30 [2] ) +Generated Location: (11507:376,30 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs index bfdfcbda387..153ac8d223e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ee976c57374bafda343bd6b2086b223381f842016566d5a83498a6d0cbec2f54" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt index a3910916ddd..3d7276f2fd7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes2_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes2 - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs index 569b502fc05..4718cc66817 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt index bcdf748d694..a4919b59b3c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt index 46e2d14236f..5f732519386 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_DesignTime.mappings.txt @@ -3,7 +3,7 @@ var ch = true; var cls = "bar"; | -Generated Location: (2040:39,2 [48] ) +Generated Location: (2066:39,2 [48] ) | var ch = true; var cls = "bar"; @@ -12,139 +12,139 @@ Generated Location: (2040:39,2 [48] ) Source Location: (66:3,20 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (2276:49,20 [6] ) +Generated Location: (2302:49,20 [6] ) | | Source Location: (83:4,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (2465:57,15 [3] ) +Generated Location: (2491:57,15 [3] ) |cls| Source Location: (90:4,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (2659:64,22 [6] ) +Generated Location: (2685:64,22 [6] ) | | Source Location: (111:5,19 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (2852:72,19 [3] ) +Generated Location: (2878:72,19 [3] ) |cls| Source Location: (118:5,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3050:79,26 [6] ) +Generated Location: (3076:79,26 [6] ) | | Source Location: (135:6,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (3239:87,15 [3] ) +Generated Location: (3265:87,15 [3] ) |cls| Source Location: (146:6,26 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3437:94,26 [6] ) +Generated Location: (3463:94,26 [6] ) | | Source Location: (185:7,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |ch| -Generated Location: (3648:102,37 [2] ) +Generated Location: (3674:102,37 [2] ) |ch| Source Location: (191:7,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (3862:109,43 [6] ) +Generated Location: (3888:109,43 [6] ) | | Source Location: (234:8,41 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |ch| -Generated Location: (4077:117,41 [2] ) +Generated Location: (4103:117,41 [2] ) |ch| Source Location: (240:8,47 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (4295:124,47 [6] ) +Generated Location: (4321:124,47 [6] ) | | Source Location: (257:9,15 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |if(cls != null) { | -Generated Location: (4485:132,15 [18] ) +Generated Location: (4511:132,15 [18] ) |if(cls != null) { | Source Location: (276:9,34 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |cls| -Generated Location: (4706:139,34 [3] ) +Generated Location: (4732:139,34 [3] ) |cls| Source Location: (279:9,37 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | }| -Generated Location: (4916:146,37 [2] ) +Generated Location: (4942:146,37 [2] ) | }| Source Location: (285:9,43 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (5130:153,43 [6] ) +Generated Location: (5156:153,43 [6] ) | | Source Location: (309:10,22 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (5578:163,22 [6] ) +Generated Location: (5604:163,22 [6] ) | | Source Location: (329:11,18 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| -Generated Location: (5771:171,18 [44] ) +Generated Location: (5797:171,18 [44] ) |Url.Content("~/Scripts/jquery-1.6.2.min.js")| Source Location: (407:11,96 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6081:178,96 [6] ) +Generated Location: (6107:178,96 [6] ) | | Source Location: (427:12,18 [60] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| -Generated Location: (6274:186,18 [60] ) +Generated Location: (6300:186,18 [60] ) |Url.Content("~/Scripts/modernizr-2.0.6-development-only.js")| Source Location: (521:12,112 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6616:193,112 [6] ) +Generated Location: (6642:193,112 [6] ) | | Source Location: (638:13,115 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (6906:201,115 [6] ) +Generated Location: (6932:201,115 [6] ) | | Source Location: (655:14,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) |null| -Generated Location: (7096:209,15 [4] ) +Generated Location: (7122:209,15 [4] ) |null| Source Location: (663:14,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml) | | -Generated Location: (7293:216,23 [2] ) +Generated Location: (7319:216,23 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs index c1bbb67fd09..7352b7eef17 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ea68cb71b106404af0072bb70c04f6d73d165cf4aabc5d838b668d681625b53c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/Foo"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt index 5e343b65339..5537c044784 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ConditionalAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ConditionalAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - href - ~/Foo - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs index 6b8b6332059..460df69b0ac 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt index d1e1b7b2bbb..a41230d2a4c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.ATagHelper - __TestNamespace_ATagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt index c9ac98daec0..45c8500c3a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (2238:37,37 [17] ) +Generated Location: (2264:37,37 [17] ) |"*, TestAssembly"| Source Location: (156:5,12 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (3786:64,12 [5] ) +Generated Location: (3812:64,12 [5] ) |false| Source Location: (237:7,11 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (4165:73,11 [5] ) +Generated Location: (4191:73,11 [5] ) |false| Source Location: (333:9,25 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml) |false| -Generated Location: (4744:84,25 [5] ) +Generated Location: (4770:84,25 [5] ) |false| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs index 42a9dffd1e3..57b193b8358 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b0b4eb8b8ddbffa2284ca831845a2ffaacd3d0599bf4242794848b4210903a3b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("href", new global::Microsoft.AspNetCore.Html.HtmlString("~/"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt index 3468d006363..3800a207ac7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/CssSelectorTagHelperAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_CssSelectorTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - href - ~/ - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - href - ~/hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - href - ~/?hello=world - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs index 0cee17ac0f8..dd6691489c0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt index 869b681ff3f..8f81b39d924 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt index 90e59b7be2d..e2c5e7cf3dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (173:11,9 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Footer| -Generated Location: (1206:26,22 [6] ) +Generated Location: (1232:26,22 [6] ) |Footer| Source Location: (20:1,13 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |for(int i = 1; i <= 10; i++) { | -Generated Location: (1715:43,13 [36] ) +Generated Location: (1741:43,13 [36] ) |for(int i = 1; i <= 10; i++) { | Source Location: (74:2,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |i| -Generated Location: (1930:51,22 [1] ) +Generated Location: (1956:51,22 [1] ) |i| Source Location: (79:2,27 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) | }| -Generated Location: (2116:58,27 [15] ) +Generated Location: (2142:58,27 [15] ) | }| Source Location: (113:7,2 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(Bar.Baz)| -Generated Location: (2294:66,6 [12] ) +Generated Location: (2320:66,6 [12] ) |Foo(Bar.Baz)| Source Location: (129:8,1 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |Foo(| -Generated Location: (2470:73,6 [4] ) +Generated Location: (2496:73,6 [4] ) |Foo(| Source Location: (142:8,14 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |baz| -Generated Location: (2694:76,14 [3] ) +Generated Location: (2720:76,14 [3] ) |baz| Source Location: (153:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |)| -Generated Location: (2754:82,1 [1] ) +Generated Location: (2780:82,1 [1] ) |)| Source Location: (204:13,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml) |bar| -Generated Location: (2992:90,6 [3] ) +Generated Location: (3018:90,6 [3] ) |bar| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs index 3e4d5adae63..38d5316861c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "81bc9372da7d25ed6342dfd5b1067004013e6b4791921ce725e71f4c9eb90f85" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt index bcade08ec7c..d9c96bec741 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DesignTime_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DesignTime - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [7] DesignTime.cshtml) LazyIntermediateToken - (0:0,0 [4] DesignTime.cshtml) - Html -
#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt index d9f2bbc2f60..0c716bae0fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt index 9fa8793cc23..8f0e77bc16c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1934:34,37 [17] ) +Generated Location: (1960:34,37 [17] ) |"*, TestAssembly"| Source Location: (146:4,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (3285:60,42 [4] ) +Generated Location: (3311:60,42 [4] ) |true| Source Location: (222:5,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |true| -Generated Location: (3941:72,42 [4] ) +Generated Location: (3967:72,42 [4] ) |true| Source Location: (43:2,8 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml) |3| -Generated Location: (4325:81,33 [1] ) +Generated Location: (4351:81,33 [1] ) |3| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs index 02d1285c41e..2535b9757c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d45c3cbf5538f23158a297cf78d066fb3d191fc8c062d4e8879f387591564a6b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "button", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt index 574b02ba84b..19d2527db62 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateAttributeTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - button - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - TYPE - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs index a943f1ac1d7..1a68fb4fde6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt index c152eb2adf9..fb07d41cd6c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt index 484e1c1bd98..ed02bd13a35 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1848:33,37 [17] ) +Generated Location: (1874:33,37 [17] ) |"*, TestAssembly"| Source Location: (67:2,32 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml) |true| -Generated Location: (2768:54,41 [4] ) +Generated Location: (2794:54,41 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs index 9187b068bd6..e9136ccf8e3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "739b3bb42f48ad64d3010068758f57fb6fd25db64a98ab4b4ebd02099e856a56" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "checkbox", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt index 4c64ca624b4..f65e29ebcdd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DuplicateTargetTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DuplicateTargetTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs index ec0a31f34c0..e705fa17878 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt index 446cdaa397b..df9640abd44 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt index fbb4920baee..82ee2fb1c8a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_DesignTime.mappings.txt @@ -1,155 +1,155 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1762:32,37 [17] ) +Generated Location: (1788:32,37 [17] ) |"*, TestAssembly"| Source Location: (59:2,24 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2404:50,24 [12] ) +Generated Location: (2430:50,24 [12] ) |DateTime.Now| Source Location: (96:4,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (2786:59,17 [12] ) +Generated Location: (2812:59,17 [12] ) |if (true) { | Source Location: (109:4,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (3001:66,30 [12] ) +Generated Location: (3027:66,30 [12] ) |string.Empty| Source Location: (121:4,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (3229:73,42 [10] ) +Generated Location: (3255:73,42 [10] ) | } else { | Source Location: (132:4,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (3465:80,53 [5] ) +Generated Location: (3491:80,53 [5] ) |false| Source Location: (137:4,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (3702:87,58 [2] ) +Generated Location: (3728:87,58 [2] ) | }| Source Location: (176:6,22 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (4078:96,22 [12] ) +Generated Location: (4104:96,22 [12] ) |DateTime.Now| Source Location: (214:6,60 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (4390:104,60 [12] ) +Generated Location: (4416:104,60 [12] ) |DateTime.Now| Source Location: (256:8,15 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (4770:113,15 [13] ) +Generated Location: (4796:113,15 [13] ) |long.MinValue| Source Location: (271:8,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (4987:120,30 [12] ) +Generated Location: (5013:120,30 [12] ) |if (true) { | Source Location: (284:8,43 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (5215:127,43 [12] ) +Generated Location: (5241:127,43 [12] ) |string.Empty| Source Location: (296:8,55 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (5456:134,55 [10] ) +Generated Location: (5482:134,55 [10] ) | } else { | Source Location: (307:8,66 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (5705:141,66 [5] ) +Generated Location: (5731:141,66 [5] ) |false| Source Location: (312:8,71 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (5955:148,71 [2] ) +Generated Location: (5981:148,71 [2] ) | }| Source Location: (316:8,75 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (6205:155,75 [12] ) +Generated Location: (6231:155,75 [12] ) |int.MaxValue| Source Location: (348:9,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (6475:163,17 [13] ) +Generated Location: (6501:163,17 [13] ) |long.MinValue| Source Location: (363:9,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (6695:170,32 [12] ) +Generated Location: (6721:170,32 [12] ) |if (true) { | Source Location: (376:9,45 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (6926:177,45 [12] ) +Generated Location: (6952:177,45 [12] ) |string.Empty| Source Location: (388:9,57 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (7170:184,57 [10] ) +Generated Location: (7196:184,57 [10] ) | } else { | Source Location: (399:9,68 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (7422:191,68 [5] ) +Generated Location: (7448:191,68 [5] ) |false| Source Location: (404:9,73 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (7675:198,73 [2] ) +Generated Location: (7701:198,73 [2] ) | }| Source Location: (408:9,77 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (7928:205,77 [12] ) +Generated Location: (7954:205,77 [12] ) |int.MaxValue| Source Location: (445:11,17 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |long.MinValue| -Generated Location: (8311:214,17 [13] ) +Generated Location: (8337:214,17 [13] ) |long.MinValue| Source Location: (460:11,32 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |DateTime.Now| -Generated Location: (8531:221,32 [12] ) +Generated Location: (8557:221,32 [12] ) |DateTime.Now| Source Location: (492:11,64 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |int.MaxValue| -Generated Location: (8782:228,64 [12] ) +Generated Location: (8808:228,64 [12] ) |int.MaxValue| Source Location: (529:13,17 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |if (true) { | -Generated Location: (9165:237,17 [12] ) +Generated Location: (9191:237,17 [12] ) |if (true) { | Source Location: (542:13,30 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |string.Empty| -Generated Location: (9381:244,30 [12] ) +Generated Location: (9407:244,30 [12] ) |string.Empty| Source Location: (554:13,42 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | } else { | -Generated Location: (9610:251,42 [10] ) +Generated Location: (9636:251,42 [10] ) | } else { | Source Location: (565:13,53 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) |false| -Generated Location: (9847:258,53 [5] ) +Generated Location: (9873:258,53 [5] ) |false| Source Location: (570:13,58 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml) | }| -Generated Location: (10085:265,58 [2] ) +Generated Location: (10111:265,58 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs index 151e828a910..81377e037e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4c214203eb338caf0f877accd57cbda70c9002c9f35b3b48b9bdecc4811fdc6b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt index b7fcc6f58bf..267b78e1983 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/DynamicAttributeTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_DynamicAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs index 226b64fc72f..28908b71ba5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt index 904b2f9d7c2..4dbc2c08726 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt index 958efd00e64..76535bef739 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1923:34,38 [15] ) +Generated Location: (1949:34,38 [15] ) |*, TestAssembly| Source Location: (66:3,26 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (2829:55,42 [0] ) +Generated Location: (2855:55,42 [0] ) || Source Location: (126:5,30 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (3471:67,42 [0] ) +Generated Location: (3497:67,42 [0] ) || Source Location: (92:4,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml) || -Generated Location: (3847:76,33 [0] ) +Generated Location: (3873:76,33 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs index 172586535bc..47532ab4c99 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c4d761efb25f1145e3bafb0566e5b4889a0d28f01dcbeaa9f36bce4ee9cc026d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt index 8576c78b969..703dc6dde0b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyAttributeTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs index 5bea3a23350..550c145c6a2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt index 461556fa047..93e01fddb1b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt index e6735cb40f1..e636f88cf1c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml) || -Generated Location: (1453:33,2 [0] ) +Generated Location: (1479:33,2 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs index e4108a2bec7..2c439670fa6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "16b0a230405bddf39e1d1cb49449db91ec2b2ebc7f619f5f3ae013391cc2307f" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt index 01291b49098..e427287c554 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyCodeBlock_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyCodeBlock.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyCodeBlock.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs index 6cab863c365..639b66b487d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt index 8e71bfcab23..29bcd1fe25f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt index 3819be7ae9e..71c7b3da6cd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs index 3885320435c..5da11f24b59 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "004fdbe7564de7fa0982c2502bef8fedcb3d887b445c425221784d3402ab9a19" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt index 9f1792bdc67..b6249f71638 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyExplicitExpression_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyExplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyExplicitExpression.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs index 54002fc43c8..9d5c0d4c77a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt index 5cd13e99059..22ad9da3b97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt index 9147bf1a63d..a3e71fbcd1b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) | | -Generated Location: (1498:33,2 [6] ) +Generated Location: (1524:33,2 [6] ) | | Source Location: (9:1,5 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) || -Generated Location: (1686:41,6 [0] ) +Generated Location: (1712:41,6 [0] ) || Source Location: (9:1,5 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml) | | -Generated Location: (1868:48,5 [2] ) +Generated Location: (1894:48,5 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs index 05789d9df8d..caec95f7a73 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "af161186fc847e3b1cff0dd7b9c1f0535ff384409c6559dbf0799a8c3407d342" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt index 0b72a52b1b2..11f58107e2c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpressionInCode_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) LazyIntermediateToken - (2:0,2 [6] EmptyImplicitExpressionInCode.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs index 2d5fcca8d19..92fafd86bd2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt index d2e8477cebc..f328d60f2e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt index faf46353bbc..618f7b466d0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (19:2,1 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs index 40120aee815..195230c8308 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9af7ee6893210f3b4ab21bd93a76eaed1540b45b34c6ccbef4c980fd5f3c9f8c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt index 35e11fc00c0..ee8555695bf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EmptyImplicitExpression_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EmptyImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] EmptyImplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [18] EmptyImplicitExpression.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs index 9e17c235572..c3faf60048d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt index 682576e5ec7..3bd1127535b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt index 6784cb1636d..723af2531c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_DesignTime.mappings.txt @@ -1,49 +1,49 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1818:33,37 [17] ) +Generated Location: (1844:33,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) | var enumValue = MyEnum.MyValue; | -Generated Location: (2323:50,2 [39] ) +Generated Location: (2349:50,2 [39] ) | var enumValue = MyEnum.MyValue; | Source Location: (96:6,15 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MyValue| -Generated Location: (2772:60,39 [14] ) +Generated Location: (2798:60,39 [14] ) |MyEnum.MyValue| Source Location: (131:7,15 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyEnum.MySecondValue| -Generated Location: (3251:70,15 [20] ) +Generated Location: (3277:70,15 [20] ) |MyEnum.MySecondValue| Source Location: (171:8,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (3853:80,132 [7] ) +Generated Location: (3879:80,132 [7] ) |MyValue| Source Location: (198:9,14 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MySecondValue| -Generated Location: (4443:90,132 [13] ) +Generated Location: (4469:90,132 [13] ) |MySecondValue| Source Location: (224:9,40 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |MyValue| -Generated Location: (4757:97,138 [7] ) +Generated Location: (4783:97,138 [7] ) |MyValue| Source Location: (251:10,15 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (5254:107,39 [9] ) +Generated Location: (5280:107,39 [9] ) |enumValue| Source Location: (274:10,38 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml) |enumValue| -Generated Location: (5471:114,45 [9] ) +Generated Location: (5497:114,45 [9] ) |enumValue| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs index 34161e8ccd5..232a196a398 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "77f2d2a6c05eb6fd6b50ca4e425c887ee527eddaca21ae01f7c0288ab53bff45" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt index 8a79d57bf54..f5017c5096b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EnumTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EnumTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs index 19702e4b4d3..51eea673edd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt index 3ee270e2db6..5906dc0ac97 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt index 83511484f63..ede2743a1c6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |"*, TestAssembly"| -Generated Location: (1707:32,37 [17] ) +Generated Location: (1733:32,37 [17] ) |"*, TestAssembly"| Source Location: (48:2,13 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |new string("1, 2")| -Generated Location: (2315:50,27 [18] ) +Generated Location: (2341:50,27 [18] ) |new string("1, 2")| Source Location: (84:3,12 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |new string("1, 2")| -Generated Location: (2676:59,27 [18] ) +Generated Location: (2702:59,27 [18] ) |new string("1, 2")| Source Location: (120:4,12 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml) |"0" + new @String("1 2")| -Generated Location: (3037:68,27 [24] ) +Generated Location: (3063:68,27 [24] ) |"0" + new @String("1 2")| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs index c752c653108..4efc9b94f06 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "e4df6041980536333164e3380678ce837699cd137aff68cc9358167dcaafba83" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt index edd8d1f9c18..fd56752764d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedExpression_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs index cf4e5e36ebf..a419af478f5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt index c6046b8773f..3d40be628b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt index f32e9f0cae4..22d6efb6abf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |"*, TestAssembly"| -Generated Location: (1707:32,37 [17] ) +Generated Location: (1733:32,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [163] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) @@ -10,7 +10,7 @@ Source Location: (37:2,2 [163] TestFiles/IntegrationTests/CodeGenerationIntegrat var obj = new { age = (object)1 }; var item = new { Items = new System.List() { "one", "two" } }; | -Generated Location: (2215:49,2 [163] ) +Generated Location: (2241:49,2 [163] ) | var count = "1"; var alive = true; @@ -20,26 +20,26 @@ Generated Location: (2215:49,2 [163] ) Source Location: (215:8,12 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |Convert.ToInt32(@count)| -Generated Location: (2642:61,27 [23] ) +Generated Location: (2668:61,27 [23] ) |Convert.ToInt32(@count)| Source Location: (247:8,44 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |!@alive| -Generated Location: (2874:68,44 [7] ) +Generated Location: (2900:68,44 [7] ) |!@alive| Source Location: (272:9,12 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |(int)@obj.age| -Generated Location: (3225:77,27 [13] ) +Generated Location: (3251:77,27 [13] ) |(int)@obj.age| Source Location: (292:9,32 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |new { @params = 1 }| -Generated Location: (3436:84,32 [19] ) +Generated Location: (3462:84,32 [19] ) |new { @params = 1 }| Source Location: (343:10,26 [124] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml) |(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))| -Generated Location: (3838:93,66 [124] ) +Generated Location: (3864:93,66 [124] ) |(@item. Items.Where(i=>i.Contains("one")). Count()>0, @item. Items.FirstOrDefault(i=>i.Contains("one"))?. Replace("one",""))| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs index b97277b2108..b66bf880cca 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8fc172b55ced462a1746f1082869701d161cf36fd24dacd8d9fa98cc66d744ad" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt index c8898d923fe..83388c3f1b1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedIdentifier_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedIdentifier - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs index c71d28813bd..9e69f9f5952 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt index 81c25965b2f..7e66b754497 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt index 17ed97342eb..c6a1605a4ef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1824:33,38 [15] ) +Generated Location: (1850:33,38 [15] ) |*, TestAssembly| Source Location: (106:3,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2358:50,29 [12] ) +Generated Location: (2384:50,29 [12] ) |DateTime.Now| Source Location: (204:5,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |DateTime.Now| -Generated Location: (2794:59,51 [12] ) +Generated Location: (2820:59,51 [12] ) |DateTime.Now| Source Location: (227:5,74 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml) |true| -Generated Location: (3199:68,74 [4] ) +Generated Location: (3225:68,74 [4] ) |true| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs index e2a818c275d..f8540d50f2f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "602b63a03b7490d9350a834c628e36b03134479ea417de4aca379f59b8089f35" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt index 340e6c5aae1..c8aef1bcb8e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/EscapedTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_EscapedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs index 414aec818d3..2c34634b8da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt index 40a90bb5cdf..fbef1cc35bc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt index 3e3ed234a2c..d5137abad3b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (20:2,2 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs index c89b963cd18..3e5132077de 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "32bee45d8028059ac44a7f812a2749196ee1be1683ed25d4e21d8d13f47da75c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt index 3ec37e6097b..527966f5c29 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionAtEOF_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) LazyIntermediateToken - (0:0,0 [18] ExplicitExpressionAtEOF.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs index 2ac3883efaa..8dcdd3620af 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt index 374999b63c4..d3c672320d5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt index e571b69ca9f..97e36eed7ba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml) || -Generated Location: (1606:35,1 [0] ) +Generated Location: (1632:35,1 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs index 980633f89fd..280ffcd6db8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d6b6b46422180a2d5485fc829481edf617295af5ea333631211aa0c2c472d178" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt index c5be1147976..ccb93547bd8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpressionWithMarkup_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpressionWithMarkup - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [5] ExplicitExpressionWithMarkup.cshtml) LazyIntermediateToken - (0:0,0 [4] ExplicitExpressionWithMarkup.cshtml) - Html -
#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt index ae7b489a819..a90513cbdf7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt index 4a36f0b924f..d20d160807b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (10:0,10 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml) |1+1| -Generated Location: (1473:33,10 [3] ) +Generated Location: (1499:33,10 [3] ) |1+1| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs index d3b33f67196..3676d6ece1f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "127c2e4532452a01cb38d7d47d12b143d778f204179f089dd1851ea16c19af0a" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt index 1eeaa7edc17..3efb69e7414 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExplicitExpression_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [8] ExplicitExpression.cshtml) LazyIntermediateToken - (0:0,0 [8] ExplicitExpression.cshtml) - Html - 1 + 1 = diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs index fd65c220d47..4e180f5a809 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt index 2872b891b6e..337df7737a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt index 844305443a9..6a6ea24f261 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_DesignTime.mappings.txt @@ -3,7 +3,7 @@ object foo = null; string bar = "Foo"; | -Generated Location: (1462:33,2 [51] ) +Generated Location: (1488:33,2 [51] ) | object foo = null; string bar = "Foo"; @@ -12,20 +12,20 @@ Generated Location: (1462:33,2 [51] ) Source Location: (59:5,1 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |if(foo != null) { | -Generated Location: (1676:42,1 [23] ) +Generated Location: (1702:42,1 [23] ) |if(foo != null) { | Source Location: (83:6,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |foo| -Generated Location: (1869:50,6 [3] ) +Generated Location: (1895:50,6 [3] ) |foo| Source Location: (86:6,8 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | } else { | -Generated Location: (2045:57,8 [16] ) +Generated Location: (2071:57,8 [16] ) | } else { | @@ -33,26 +33,26 @@ Generated Location: (2045:57,8 [16] ) Source Location: (121:8,23 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | }| -Generated Location: (2248:66,23 [3] ) +Generated Location: (2274:66,23 [3] ) | }| Source Location: (134:12,1 [38] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |if(!String.IsNullOrEmpty(bar)) { | -Generated Location: (2417:74,1 [38] ) +Generated Location: (2443:74,1 [38] ) |if(!String.IsNullOrEmpty(bar)) { | Source Location: (174:13,6 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) |bar.Replace("F", "B")| -Generated Location: (2626:82,6 [21] ) +Generated Location: (2652:82,6 [21] ) |bar.Replace("F", "B")| Source Location: (196:13,28 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml) | }| -Generated Location: (2841:89,28 [3] ) +Generated Location: (2867:89,28 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs index 9ec272bb776..5033d43fda0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c9cc7d097735e4074bc4f71cd46101fc821fdb0592f90d491f09fdecddf3caf3" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt index d5677645b4e..52e6fac4718 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ExpressionsInCode_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ExpressionsInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [51] ExpressionsInCode.cshtml) LazyIntermediateToken - (2:0,2 [51] ExpressionsInCode.cshtml) - CSharp - \n object foo = null;\n string bar = "Foo";\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs index 8c747a197f2..dea191752cf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt index 6c4a32046c5..30b7218368c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt index 9c3dce835be..e0f664757d1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_DesignTime.mappings.txt @@ -4,7 +4,7 @@ string foo(string input) { return input + "!"; } | -Generated Location: (1533:35,12 [55] ) +Generated Location: (1559:35,12 [55] ) | string foo(string input) { return input + "!"; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs index f1d1aa5a210..820f83e5671 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "efea5780300288b4c0a438cb8dbd885088680963b3e2ceab4416264993e99884" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt index 67bc1c2d297..b2091f476a1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlockMinimal_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlockMinimal - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [4] FunctionsBlockMinimal.cshtml) LazyIntermediateToken - (0:0,0 [4] FunctionsBlockMinimal.cshtml) - Html - \n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs index ee2143678a2..349f53a914b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt index 3c830d841ec..8fa7fe03939 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt index 42c5eeb452c..5dd526ec510 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_DesignTime.mappings.txt @@ -1,13 +1,13 @@ Source Location: (167:11,25 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml) |RandomInt()| -Generated Location: (1477:33,25 [11] ) +Generated Location: (1503:33,25 [11] ) |RandomInt()| Source Location: (12:0,12 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml) | | -Generated Location: (1711:42,12 [4] ) +Generated Location: (1737:42,12 [4] ) | | @@ -19,7 +19,7 @@ Source Location: (33:4,12 [104] TestFiles/IntegrationTests/CodeGenerationIntegra return _rand.Next(); } | -Generated Location: (1886:50,12 [104] ) +Generated Location: (1912:50,12 [104] ) | Random _rand = new Random(); private int RandomInt() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs index 31228bf1917..d82a603126e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "87718d380117c487f66665bd4c191fcab3bbf6821e64caa809bf2fd1ad6af664" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt index ec88a1948dd..4fa36b8f439 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/FunctionsBlock_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_FunctionsBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (19:3,0 [2] FunctionsBlock.cshtml) LazyIntermediateToken - (19:3,0 [2] FunctionsBlock.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs index e82bc796b51..d6ad1397883 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt index 959e6765dd3..55a0f83aa61 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt index 6ef7c1f39ba..608aac72830 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_DesignTime.mappings.txt @@ -1,14 +1,14 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml) | | -Generated Location: (1462:33,2 [6] ) +Generated Location: (1488:33,2 [6] ) | | Source Location: (9:1,5 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml) |@Da | -Generated Location: (1637:41,5 [5] ) +Generated Location: (1663:41,5 [5] ) |@Da | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs index 687f861d929..ab0bc0232aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f28b1d44c575d208cd85ccdfcbacce93cf352fed0b4626a5450b19c7aee40d04" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt index 263870234ea..929394c228e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HiddenSpansInCode_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HiddenSpansInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] HiddenSpansInCode.cshtml) LazyIntermediateToken - (2:0,2 [6] HiddenSpansInCode.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs index 9b1cfc015e5..16d6ef39aa7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt index 2d897baddc7..e78cd9b7063 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs index 81126e4108e..f7abc1d3221 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "27a85171d5a386c4f1b5ff7df75346b702207bfa961bbf3b5418584132a09c45" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/images/submit.png"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt index 1b51c61a054..e4654c94a1f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Double_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Double - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - src - ~/images/submit.png - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs index e61df7570d9..3e18757d068 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt index 9ed95001eae..8d278471394 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs index b88b00e29fe..b5459d7a2f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "88d08131b744c1b898ea33808f9b0ed6339ccaab3836730b144161c70d193e61" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("src", new global::Microsoft.AspNetCore.Html.HtmlString("~/images/submit.png"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt index 2ab5c3cbf12..134680c52ef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/HtmlCommentWithQuote_Single_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_HtmlCommentWithQuote_Single - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - src - ~/images/submit.png - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.UrlResolutionTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_UrlResolutionTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs index 4a0caf4adb8..0cfe4b54156 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt index 66b9e8d4bf6..cab993cd2a3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt index d35dc5551cb..5bb82ae1446 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_DesignTime.mappings.txt @@ -1,13 +1,13 @@ Source Location: (12:0,12 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml) |IDisposable| -Generated Location: (1196:26,0 [11] ) +Generated Location: (1222:26,0 [11] ) |IDisposable| Source Location: (39:2,12 [38] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml) | void IDisposable.Dispose() { } | -Generated Location: (1774:45,12 [38] ) +Generated Location: (1800:45,12 [38] ) | void IDisposable.Dispose() { } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs index 78674d755a5..32c9e48e122 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "668986313132d43ea69290e3a9fa026efcdd9b84e34b0fe6ef95f8096bd84385" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage, IDisposable #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt index 2ef71d6d5cf..4b58651fc9b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Implements_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Implements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - IDisposable MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (25:1,0 [2] Implements.cshtml) LazyIntermediateToken - (25:1,0 [2] Implements.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs index 1342f541587..b3ec3672d80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt index f48c7b4e954..94746ecc0c6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt index ab19a0ce624..a1f0e38e90c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (19:2,1 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml) || -Generated Location: (1484:33,6 [0] ) +Generated Location: (1510:33,6 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs index 7bb72dc5082..c065446ece7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c51c63579e91e34ccd7908daa20ee621d57df811c127c4675d2c49479e67358c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt index 309d0b5718e..539ac7bb2c4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpressionAtEOF_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpressionAtEOF - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) LazyIntermediateToken - (0:0,0 [18] ImplicitExpressionAtEOF.cshtml) - Html - This is markup\n\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs index 51fd4390be3..efab73b7b9f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt index 2e6a3381dfd..39c19dcb1ea 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt index da632e401d2..eea01762490 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (1:0,1 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) |for(int i = 1; i <= 10; i++) { | -Generated Location: (1464:33,1 [36] ) +Generated Location: (1490:33,1 [36] ) |for(int i = 1; i <= 10; i++) { | Source Location: (55:1,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) |i| -Generated Location: (1687:41,22 [1] ) +Generated Location: (1713:41,22 [1] ) |i| Source Location: (60:1,27 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml) | }| -Generated Location: (1881:48,27 [3] ) +Generated Location: (1907:48,27 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs index 92a056800f6..a5c779d4f19 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a9ffb11684d26004cfb4c9d3c57f6e1b1ecfce9046379ae96dc044b20960a06c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt index 1ffcfd3f3ea..6735e6751cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ImplicitExpression_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ImplicitExpression - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [32] ImplicitExpression.cshtml) LazyIntermediateToken - (1:0,1 [32] ImplicitExpression.cshtml) - CSharp - for(int i = 1; i <= 10; i++) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs index 2f78e9c6151..27f3a9b0858 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt index e5c52cc4a0f..5748fd781a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt index 3592e35d473..df9147119c3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_DesignTime.mappings.txt @@ -1,70 +1,70 @@ Source Location: (100:2,13 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1251:26,38 [0] ) +Generated Location: (1277:26,38 [0] ) || Source Location: (116:3,14 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (1526:36,38 [0] ) +Generated Location: (1552:36,38 [0] ) || Source Location: (132:4,14 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (1800:46,37 [1] ) +Generated Location: (1826:46,37 [1] ) |"| Source Location: (153:6,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2075:56,38 [0] ) +Generated Location: (2101:56,38 [0] ) || Source Location: (172:7,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2350:66,38 [0] ) +Generated Location: (2376:66,38 [0] ) || Source Location: (191:8,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (2624:76,37 [1] ) +Generated Location: (2650:76,37 [1] ) |"| Source Location: (212:10,16 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (2900:86,38 [0] ) +Generated Location: (2926:86,38 [0] ) || Source Location: (231:11,17 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3176:96,38 [0] ) +Generated Location: (3202:96,38 [0] ) || Source Location: (250:12,17 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) |"| -Generated Location: (3451:106,37 [1] ) +Generated Location: (3477:106,37 [1] ) |"| Source Location: (276:15,10 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3689:116,0 [0] ) +Generated Location: (3715:116,0 [0] ) || Source Location: (326:21,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (3926:126,0 [0] ) +Generated Location: (3952:126,0 [0] ) || Source Location: (264:14,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4428:143,9 [0] ) +Generated Location: (4454:143,9 [0] ) || Source Location: (315:20,8 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4604:150,8 [0] ) +Generated Location: (4630:150,8 [0] ) || Source Location: (354:24,12 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml) || -Generated Location: (4784:157,12 [0] ) +Generated Location: (4810:157,12 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs index a76c039ab73..c9c21931222 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "eb06c7c88327837013a4b8bbc01e69455dd31e066c651c88da5da9887b37f4d9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt index a4a712b6eaa..382efa77cf1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteDirectives_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteDirectives - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (85:1,0 [2] IncompleteDirectives.cshtml) LazyIntermediateToken - (85:1,0 [2] IncompleteDirectives.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs index b1665ab5c50..6d762434b2f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.ir.txt index cd6441f37bf..b9dfbff67d1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt index 084a27d11d7..4f74c5c66aa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1733:32,37 [17] ) +Generated Location: (1759:32,37 [17] ) |"*, TestAssembly"| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs index e279225f6e1..e6dc0ec271f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a6b7468c33484ceae637f17ae6158b1c7c2616a22178d1fe8cb48f2e85f5295c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString(""), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt index fd71f41bf09..6697abe38fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/IncompleteTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_IncompleteTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs index 037caca0dec..4ecd293dd78 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt index b8a831fb568..aa306a32a06 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.cs-diagnostics.txt @@ -10,12 +10,12 @@ Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").Wit // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(3,7): error CS0103: The name 'foo' does not exist in the current context // __o = foo(); Diagnostic(ErrorCode.ERR_NameNotInContext, "foo").WithArguments("foo").WithLocation(3, 7), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,86): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(19, 86), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,94): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(19, 94), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,98): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(19, 98) \ No newline at end of file +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,95): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(19, 95), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,103): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(19, 103), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(19,107): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(19, 107) \ No newline at end of file diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt index 0befe19386a..92d236e6f5e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt index 37840d94cda..d40e6fc3abc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (10:0,10 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo.bar>.boz| -Generated Location: (1141:26,0 [21] ) +Generated Location: (1167:26,0 [21] ) |foo.bar>.boz| Source Location: (36:2,1 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml) |foo()| -Generated Location: (1672:43,6 [5] ) +Generated Location: (1698:43,6 [5] ) |foo()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs index 02607f6274f..7894a068a68 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f2e8261f6a1dc47ca6ea0cb9335f0a2b8b0b18bc9f1fc43b6c3a7764e3ac7f75" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt index cfba402fdec..bf21394ac74 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.cs-diagnostics.txt @@ -1,15 +1,15 @@ // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(3,2): error CS0103: The name 'foo' does not exist in the current context // foo() Diagnostic(ErrorCode.ERR_NameNotInContext, "foo").WithArguments("foo").WithLocation(3, 2), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,86): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(21, 86), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,94): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(21, 94), -// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,98): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) -// public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz -Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(21, 98), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,95): error CS0246: The type or namespace name 'foo' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "foo").WithArguments("foo").WithLocation(21, 95), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,103): error CS0246: The type or namespace name 'baz<>' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "baz").WithArguments("baz<>").WithLocation(21, 103), +// TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(21,107): error CS0246: The type or namespace name 'biz' could not be found (are you missing a using directive or an assembly reference?) +// internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits : foo.bar>.boz +Diagnostic(ErrorCode.ERR_SingleTypeNameNotFound, "biz").WithArguments("biz").WithLocation(21, 107), // TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits.cshtml(27,13): error CS0103: The name 'WriteLiteral' does not exist in the current context // WriteLiteral("\r\n"); Diagnostic(ErrorCode.ERR_NameNotInContext, "WriteLiteral").WithArguments("WriteLiteral").WithLocation(27, 13), diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt index bcda0ccbb52..2e6bf46ae2c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Inherits_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Inherits - foo.bar>.boz - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (33:1,0 [2] Inherits.cshtml) LazyIntermediateToken - (33:1,0 [2] Inherits.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs index 09e8c2776b4..d2eafe6c0dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt index 5f61fc6cb42..7fe620ea765 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt index 2e328813770..c32278526e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (9:0,9 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |Link| -Generated Location: (1211:26,22 [4] ) +Generated Location: (1237:26,22 [4] ) |Link| Source Location: (44:1,14 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |if(link != null) { | -Generated Location: (1721:43,14 [19] ) +Generated Location: (1747:43,14 [19] ) |if(link != null) { | Source Location: (64:1,34 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) |link| -Generated Location: (1933:50,34 [4] ) +Generated Location: (1959:50,34 [4] ) |link| Source Location: (68:1,38 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | } else { | -Generated Location: (2135:57,38 [10] ) +Generated Location: (2161:57,38 [10] ) | } else { | Source Location: (92:1,62 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml) | }| -Generated Location: (2366:64,62 [2] ) +Generated Location: (2392:64,62 [2] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs index e8192805b25..35ab012a071 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d7855bb65d3e6db02c3a0fb02972366eb41151f780bf5b52f5c72a44a4591587" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt index 7d92d9337a1..cfc241aa1ba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/InlineBlocks_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_InlineBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync MalformedDirective - (0:0,0 [13] InlineBlocks.cshtml) - section DirectiveToken - (9:0,9 [4] InlineBlocks.cshtml) - Link diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs index fcc56226630..a03a3a7522b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt index 3bc691ae609..a2ae4a6f8b2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt index cd2fb2f7173..20095dd1784 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_DesignTime.mappings.txt @@ -2,7 +2,7 @@ | int i = 1; var foo = | -Generated Location: (1447:33,2 [32] ) +Generated Location: (1473:33,2 [32] ) | int i = 1; var foo = | @@ -10,39 +10,39 @@ Generated Location: (1447:33,2 [32] ) Source Location: (45:2,25 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |; | -Generated Location: (1806:45,25 [7] ) +Generated Location: (1832:45,25 [7] ) |; | Source Location: (68:4,0 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | | -Generated Location: (1972:53,0 [4] ) +Generated Location: (1998:53,0 [4] ) | | Source Location: (91:4,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | | -Generated Location: (2158:60,23 [2] ) +Generated Location: (2184:60,23 [2] ) | | Source Location: (99:7,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |while(i <= 10) { | -Generated Location: (2318:67,1 [22] ) +Generated Location: (2344:67,1 [22] ) |while(i <= 10) { | Source Location: (142:8,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |i| -Generated Location: (2524:75,25 [1] ) +Generated Location: (2550:75,25 [1] ) |i| Source Location: (148:8,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | i += 1; }| -Generated Location: (2716:82,31 [16] ) +Generated Location: (2742:82,31 [16] ) | i += 1; }| @@ -50,14 +50,14 @@ Generated Location: (2716:82,31 [16] ) Source Location: (169:12,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |if(i == 11) { | -Generated Location: (2893:91,1 [19] ) +Generated Location: (2919:91,1 [19] ) |if(i == 11) { | Source Location: (213:13,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (3101:99,29 [3] ) +Generated Location: (3127:99,29 [3] ) | }| @@ -65,7 +65,7 @@ Source Location: (221:16,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegra |switch(i) { case 11: | -Generated Location: (3265:107,1 [35] ) +Generated Location: (3291:107,1 [35] ) |switch(i) { case 11: | @@ -75,7 +75,7 @@ Source Location: (292:18,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegr break; default: | -Generated Location: (3504:116,44 [40] ) +Generated Location: (3530:116,44 [40] ) | break; default: @@ -85,7 +85,7 @@ Source Location: (361:21,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegr | break; }| -Generated Location: (3741:126,37 [19] ) +Generated Location: (3767:126,37 [19] ) | break; }| @@ -93,26 +93,26 @@ Generated Location: (3741:126,37 [19] ) Source Location: (385:25,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |for(int j = 1; j <= 10; j += 2) { | -Generated Location: (3921:135,1 [39] ) +Generated Location: (3947:135,1 [39] ) |for(int j = 1; j <= 10; j += 2) { | Source Location: (451:26,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |j| -Generated Location: (4151:143,31 [1] ) +Generated Location: (4177:143,31 [1] ) |j| Source Location: (457:26,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (4350:150,37 [3] ) +Generated Location: (4376:150,37 [3] ) | }| Source Location: (465:29,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |try { | -Generated Location: (4514:158,1 [11] ) +Generated Location: (4540:158,1 [11] ) |try { | @@ -120,34 +120,34 @@ Source Location: (511:30,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegr | } catch(Exception ex) { | -Generated Location: (4724:166,39 [31] ) +Generated Location: (4750:166,39 [31] ) | } catch(Exception ex) { | Source Location: (573:32,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |ex.Message| -Generated Location: (4950:175,35 [10] ) +Generated Location: (4976:175,35 [10] ) |ex.Message| Source Location: (588:32,50 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (5171:182,50 [3] ) +Generated Location: (5197:182,50 [3] ) | }| Source Location: (596:35,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) |lock(new object()) { | -Generated Location: (5335:190,1 [26] ) +Generated Location: (5361:190,1 [26] ) |lock(new object()) { | Source Location: (669:36,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml) | }| -Generated Location: (5572:198,51 [3] ) +Generated Location: (5598:198,51 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs index 40e2e0643f1..ab9a0c410f9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "995eb60d7343e6b2916ae503c3fc313ad9fc919ca39dcd50b386d27d2b53f80e" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt index 0a87315d8ce..0b8cbc6282e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Instrumented_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Instrumented - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [32] Instrumented.cshtml) LazyIntermediateToken - (2:0,2 [32] Instrumented.cshtml) - CSharp - \n int i = 1;\n var foo = diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs index c179a22082f..75a4260c698 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt index c7c6de0377f..1913a74d92a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt index f0a2f64bc89..eaf9d729129 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_DesignTime.mappings.txt @@ -2,21 +2,21 @@ | for(int i = 1; i <= 10; i++) { | -Generated Location: (1462:33,2 [46] ) +Generated Location: (1488:33,2 [46] ) | for(int i = 1; i <= 10; i++) { | Source Location: (69:2,29 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml) |i.ToString()| -Generated Location: (1701:42,29 [12] ) +Generated Location: (1727:42,29 [12] ) |i.ToString()| Source Location: (86:2,46 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml) | } | -Generated Location: (1924:49,46 [9] ) +Generated Location: (1950:49,46 [9] ) | } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs index 88b8940ba0b..d3c5f67937b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "8d4533fb0fc90f8228aa0b0c9ec2d1cb53d3ef9b2018884e3e906a63b2e7ec39" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt index 05d608baca2..4184ab65086 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MarkupInCodeBlock_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MarkupInCodeBlock - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [38] MarkupInCodeBlock.cshtml) LazyIntermediateToken - (2:0,2 [38] MarkupInCodeBlock.cshtml) - CSharp - \n for(int i = 1; i <= 10; i++) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs index 9e4ce6fb3f3..2dde3aac494 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt index 9d3e37d7020..e9de58a8aba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt index 2aa9e3b440a..9077efe7449 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1748:32,37 [17] ) +Generated Location: (1774:32,37 [17] ) |"*, TestAssembly"| Source Location: (35:1,2 [154] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) @@ -13,7 +13,7 @@ Source Location: (35:1,2 [154] TestFiles/IntegrationTests/CodeGenerationIntegrat void PrintName(Person person) { | -Generated Location: (2271:49,2 [154] ) +Generated Location: (2297:49,2 [154] ) | var people = new Person[] { @@ -26,26 +26,26 @@ Generated Location: (2271:49,2 [154] ) Source Location: (195:9,14 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |person.Name| -Generated Location: (2619:64,14 [11] ) +Generated Location: (2645:64,14 [11] ) |person.Name| Source Location: (212:9,31 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | } | -Generated Location: (2989:73,31 [9] ) +Generated Location: (3015:73,31 [9] ) | } | Source Location: (228:13,2 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | PrintName(people[0]); | -Generated Location: (3178:81,2 [23] ) +Generated Location: (3204:81,2 [23] ) | PrintName(people[0]); | Source Location: (256:14,2 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | await AnnounceBirthday(people[0]); | -Generated Location: (3383:88,2 [36] ) +Generated Location: (3409:88,2 [36] ) | await AnnounceBirthday(people[0]); | Source Location: (309:16,12 [106] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) @@ -54,7 +54,7 @@ Source Location: (309:16,12 [106] TestFiles/IntegrationTests/CodeGenerationInteg { var formatted = $"Mr. {person.Name}"; | -Generated Location: (3660:97,12 [106] ) +Generated Location: (3686:97,12 [106] ) | Task AnnounceBirthday(Person person) { @@ -63,14 +63,14 @@ Generated Location: (3660:97,12 [106] ) Source Location: (455:21,33 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |formatted| -Generated Location: (3979:108,33 [9] ) +Generated Location: (4005:108,33 [9] ) |formatted| Source Location: (487:22,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | | -Generated Location: (4322:117,14 [12] ) +Generated Location: (4348:117,14 [12] ) | | @@ -79,20 +79,20 @@ Source Location: (514:25,9 [66] TestFiles/IntegrationTests/CodeGenerationIntegra |for (var i = 0; i < person.Age / 10; i++) { | -Generated Location: (4523:126,9 [66] ) +Generated Location: (4549:126,9 [66] ) |for (var i = 0; i < person.Age / 10; i++) { | Source Location: (586:27,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) |i| -Generated Location: (4787:135,18 [1] ) +Generated Location: (4813:135,18 [1] ) |i| Source Location: (609:27,41 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml) | }| -Generated Location: (5010:142,41 [11] ) +Generated Location: (5036:142,41 [11] ) | }| @@ -105,7 +105,7 @@ Source Location: (635:29,13 [106] TestFiles/IntegrationTests/CodeGenerationInteg } | -Generated Location: (5214:150,13 [106] ) +Generated Location: (5240:150,13 [106] ) | if (person.Age < 20) @@ -127,7 +127,7 @@ Source Location: (764:36,31 [161] TestFiles/IntegrationTests/CodeGenerationInteg public int Age { get; set; } } | -Generated Location: (5531:164,31 [161] ) +Generated Location: (5557:164,31 [161] ) | return Task.CompletedTask; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs index 5731be96cfe..1d5994e1799 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "1d96ed32230877fcfe7acc2e22d4b1c519eb0ccd0599053409543ce8c5f65fa7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt index 675776b967d..bf538d697e7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocksWithTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocksWithTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs index cd0e88519d9..674c1816c46 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt index 4848082fc28..d10664be4af 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt index 113696b3432..aab1dffa975 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_DesignTime.mappings.txt @@ -8,7 +8,7 @@ void PrintName(Person person) { | -Generated Location: (1468:33,2 [153] ) +Generated Location: (1494:33,2 [153] ) | var people = new Person[] { @@ -21,26 +21,26 @@ Generated Location: (1468:33,2 [153] ) Source Location: (163:9,14 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |person.Name| -Generated Location: (1802:48,14 [11] ) +Generated Location: (1828:48,14 [11] ) |person.Name| Source Location: (180:9,31 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | } | -Generated Location: (2012:55,31 [9] ) +Generated Location: (2038:55,31 [9] ) | } | Source Location: (196:13,2 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | PrintName(people[0]) | -Generated Location: (2188:63,2 [22] ) +Generated Location: (2214:63,2 [22] ) | PrintName(people[0]) | Source Location: (223:14,2 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | AnnounceBirthday(people[0]); | -Generated Location: (2379:70,2 [30] ) +Generated Location: (2405:70,2 [30] ) | AnnounceBirthday(people[0]); | Source Location: (270:16,12 [106] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) @@ -49,7 +49,7 @@ Source Location: (270:16,12 [106] TestFiles/IntegrationTests/CodeGenerationInteg { var formatted = $"Mr. {person.Name}"; | -Generated Location: (2637:79,12 [106] ) +Generated Location: (2663:79,12 [106] ) | void AnnounceBirthday(Person person) { @@ -58,14 +58,14 @@ Generated Location: (2637:79,12 [106] ) Source Location: (416:21,33 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |formatted| -Generated Location: (2943:90,33 [9] ) +Generated Location: (2969:90,33 [9] ) |formatted| Source Location: (448:22,14 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | | -Generated Location: (3134:97,14 [12] ) +Generated Location: (3160:97,14 [12] ) | | @@ -74,20 +74,20 @@ Source Location: (475:25,9 [66] TestFiles/IntegrationTests/CodeGenerationIntegra |for (var i = 0; i < person.Age / 10; i++) { | -Generated Location: (3322:106,9 [66] ) +Generated Location: (3348:106,9 [66] ) |for (var i = 0; i < person.Age / 10; i++) { | Source Location: (547:27,18 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) |i| -Generated Location: (3573:115,18 [1] ) +Generated Location: (3599:115,18 [1] ) |i| Source Location: (570:27,41 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml) | }| -Generated Location: (3783:122,41 [11] ) +Generated Location: (3809:122,41 [11] ) | }| @@ -100,7 +100,7 @@ Source Location: (596:29,13 [87] TestFiles/IntegrationTests/CodeGenerationIntegr } | -Generated Location: (3974:130,13 [87] ) +Generated Location: (4000:130,13 [87] ) | if (person.Age < 20) @@ -120,7 +120,7 @@ Source Location: (706:36,31 [123] TestFiles/IntegrationTests/CodeGenerationInteg public int Age { get; set; } } | -Generated Location: (4259:144,31 [123] ) +Generated Location: (4285:144,31 [123] ) | } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs index 77cd0a8c861..c3477be6c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c38f4efc9c710292c9fc20d2f5c4cc6e8a91f4fa3ee60ec96c16617f506312b8" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt index 02571af85bf..0c2f37c479e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Markup_InCodeBlocks_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Markup_InCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2] Markup_InCodeBlocks.cshtml) LazyIntermediateToken - (0:0,0 [2] Markup_InCodeBlocks.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs index 873e8ac6fe6..aab5e594d80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt index 0d7a5cd634a..a3cdb435212 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt index 5a601c794e1..ae8ed32dc80 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1887:34,37 [17] ) +Generated Location: (1913:34,37 [17] ) |"*, TestAssembly"| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs index b50b06f40ef..ba5a565e288 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "87fe59d78f3e03370f30b0eb9f80c503873502b116dbdb3beff6cd9fc190f718" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("btn"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt index 625051d43ca..f312c1235f2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/MinimizedTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_MinimizedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - btn - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - input-bound-required-string - hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_2 - catchall-bound-string - world - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs index e15283b1037..cc83672596c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt index 7c34b7cedbb..259ae720db2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt index 62f2a807b71..0aee8a2131f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_DesignTime.mappings.txt @@ -1,7 +1,7 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | | -Generated Location: (1447:33,2 [6] ) +Generated Location: (1473:33,2 [6] ) | | @@ -9,27 +9,27 @@ Source Location: (9:1,5 [53] TestFiles/IntegrationTests/CodeGenerationIntegratio |foreach (var result in (dynamic)Url) { | -Generated Location: (1617:41,5 [53] ) +Generated Location: (1643:41,5 [53] ) |foreach (var result in (dynamic)Url) { | Source Location: (82:4,13 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) |result.SomeValue| -Generated Location: (1842:50,13 [16] ) +Generated Location: (1868:50,13 [16] ) |result.SomeValue| Source Location: (115:5,14 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | }| -Generated Location: (2032:57,14 [7] ) +Generated Location: (2058:57,14 [7] ) | }| Source Location: (122:6,5 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml) | | -Generated Location: (2203:65,5 [2] ) +Generated Location: (2229:65,5 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs index e15cf32a54d..4f7e209358b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "c1273eb7fee44c32ab00da03db6ac9a1bf83c1c3b09f32fb242db42978fc4d17" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt index 9bc4e74122e..96ff78d1d44 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCSharp_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCSharp - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] NestedCSharp.cshtml) LazyIntermediateToken - (2:0,2 [6] NestedCSharp.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs index d8e34503130..5471dc97123 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt index 479d622b168..1f5dcd77898 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt index b39b05aa8b1..aa75a4345e9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_DesignTime.mappings.txt @@ -1,21 +1,21 @@ Source Location: (1:0,1 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) |if(foo) { | -Generated Location: (1458:33,1 [15] ) +Generated Location: (1484:33,1 [15] ) |if(foo) { | Source Location: (17:1,5 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) |if(bar) { }| -Generated Location: (1641:41,5 [16] ) +Generated Location: (1667:41,5 [16] ) |if(bar) { }| Source Location: (33:2,5 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml) | }| -Generated Location: (1825:49,5 [3] ) +Generated Location: (1851:49,5 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs index c842d7e180b..55a466d78b1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "13a85602fed2597baf956e658c5cf96a52e1734ae6cd4674854366bf90b84fb7" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt index 03dfaeb62a8..391ddbd747b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedCodeBlocks_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedCodeBlocks - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [15] NestedCodeBlocks.cshtml) LazyIntermediateToken - (1:0,1 [15] NestedCodeBlocks.cshtml) - CSharp - if(foo) {\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs index 1186f4f7467..13d75ef1727 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.ir.txt index ed28aa6924a..36f8e5d6a76 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt index eb235a44560..60c32e9c2be 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_DesignTime.mappings.txt @@ -1,29 +1,29 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1925:34,37 [17] ) +Generated Location: (1951:34,37 [17] ) |"*, TestAssembly"| Source Location: (195:5,13 [46] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |for(var i = 0; i < 5; i++) { | -Generated Location: (2452:51,13 [46] ) +Generated Location: (2478:51,13 [46] ) |for(var i = 0; i < 5; i++) { | Source Location: (339:7,50 [23] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |ViewBag.DefaultInterval| -Generated Location: (2928:61,50 [23] ) +Generated Location: (2954:61,50 [23] ) |ViewBag.DefaultInterval| Source Location: (389:7,100 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) |true| -Generated Location: (3372:70,100 [4] ) +Generated Location: (3398:70,100 [4] ) |true| Source Location: (422:8,25 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml) | }| -Generated Location: (3650:78,25 [15] ) +Generated Location: (3676:78,25 [15] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs index 31d02abb628..76f87cd8769 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b9d3f6bab7b7ca5370c7dfdbb23e59170c95a39498a14d92a3821296aaf9dba2" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", "text", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.ir.txt index 9b3b3b9980d..45b4d2c478f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedScriptTagTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedScriptTagTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - data-delay - 1000 - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs index 075b9db1a57..10e49125914 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt index ebe381ddd7f..7ded8231849 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::SpanTagHelper - __SpanTagHelper FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt index eb3034aa72d..d9081e33c78 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1815:34,38 [15] ) +Generated Location: (1841:34,38 [15] ) |*, TestAssembly| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs index 365a283c546..95e694a4651 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "b70a83d84fae87fa6d03261b1a7b2f7cadddf84ab4b9ca15836fe03a1a38b59c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt index da62924f023..5b54da81c19 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NestedTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NestedTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - unbound - foo - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.cs index 781297722d9..127724064ae 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.ir.txt index 5b81ae13b99..8cfe2c38506 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.mappings.txt index a045d59b3cc..c8a52a88748 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_DesignTime.mappings.txt @@ -2,7 +2,7 @@ | int i = 1; | -Generated Location: (1450:33,2 [18] ) +Generated Location: (1476:33,2 [18] ) | int i = 1; | @@ -10,20 +10,20 @@ Generated Location: (1450:33,2 [18] ) Source Location: (26:4,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |while(i <= 10) { | -Generated Location: (1627:41,1 [22] ) +Generated Location: (1653:41,1 [22] ) |while(i <= 10) { | Source Location: (69:5,25 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |i| -Generated Location: (1834:49,25 [1] ) +Generated Location: (1860:49,25 [1] ) |i| Source Location: (75:5,31 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) | i += 1; }| -Generated Location: (2027:56,31 [16] ) +Generated Location: (2053:56,31 [16] ) | i += 1; }| @@ -31,14 +31,14 @@ Generated Location: (2027:56,31 [16] ) Source Location: (96:9,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |if(i == 11) { | -Generated Location: (2205:65,1 [19] ) +Generated Location: (2231:65,1 [19] ) |if(i == 11) { | Source Location: (140:10,29 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) | }| -Generated Location: (2414:73,29 [3] ) +Generated Location: (2440:73,29 [3] ) | }| @@ -46,7 +46,7 @@ Source Location: (148:13,1 [35] TestFiles/IntegrationTests/CodeGenerationIntegra |switch(i) { case 11: | -Generated Location: (2579:81,1 [35] ) +Generated Location: (2605:81,1 [35] ) |switch(i) { case 11: | @@ -56,7 +56,7 @@ Source Location: (219:15,44 [40] TestFiles/IntegrationTests/CodeGenerationIntegr break; default: | -Generated Location: (2819:90,44 [40] ) +Generated Location: (2845:90,44 [40] ) | break; default: @@ -66,7 +66,7 @@ Source Location: (288:18,37 [19] TestFiles/IntegrationTests/CodeGenerationIntegr | break; }| -Generated Location: (3057:100,37 [19] ) +Generated Location: (3083:100,37 [19] ) | break; }| @@ -74,26 +74,26 @@ Generated Location: (3057:100,37 [19] ) Source Location: (312:22,1 [39] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |for(int j = 1; j <= 10; j += 2) { | -Generated Location: (3238:109,1 [39] ) +Generated Location: (3264:109,1 [39] ) |for(int j = 1; j <= 10; j += 2) { | Source Location: (378:23,31 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |j| -Generated Location: (3469:117,31 [1] ) +Generated Location: (3495:117,31 [1] ) |j| Source Location: (384:23,37 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) | }| -Generated Location: (3669:124,37 [3] ) +Generated Location: (3695:124,37 [3] ) | }| Source Location: (392:26,1 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |try { | -Generated Location: (3834:132,1 [11] ) +Generated Location: (3860:132,1 [11] ) |try { | @@ -101,14 +101,14 @@ Source Location: (438:27,39 [31] TestFiles/IntegrationTests/CodeGenerationIntegr | } catch(Exception ex) { | -Generated Location: (4045:140,39 [31] ) +Generated Location: (4071:140,39 [31] ) | } catch(Exception ex) { | Source Location: (500:29,35 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |ex.Message| -Generated Location: (4272:149,35 [10] ) +Generated Location: (4298:149,35 [10] ) |ex.Message| Source Location: (515:29,50 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) @@ -116,7 +116,7 @@ Source Location: (515:29,50 [7] TestFiles/IntegrationTests/CodeGenerationIntegra } | -Generated Location: (4494:156,50 [7] ) +Generated Location: (4520:156,50 [7] ) | } @@ -124,25 +124,25 @@ Generated Location: (4494:156,50 [7] ) Source Location: (556:32,34 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) || -Generated Location: (4694:165,34 [0] ) +Generated Location: (4720:165,34 [0] ) || Source Location: (571:33,13 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |i| -Generated Location: (4868:172,13 [1] ) +Generated Location: (4894:172,13 [1] ) |i| Source Location: (581:35,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) |lock(new object()) { | -Generated Location: (5032:179,1 [26] ) +Generated Location: (5058:179,1 [26] ) |lock(new object()) { | Source Location: (654:36,51 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml) | }| -Generated Location: (5270:187,51 [3] ) +Generated Location: (5296:187,51 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.codegen.cs index 8f8acad959a..ffce9a306a8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5d359099ffaf3096190a7267378a546e5814b6a10f2691fdce13ec7577332aec" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.ir.txt index 94e1d3900e9..30142d2dd68 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NoLinePragmas_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NoLinePragmas - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [18] NoLinePragmas.cshtml) LazyIntermediateToken - (2:0,2 [18] NoLinePragmas.cshtml) - CSharp - \n int i = 1;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.cs index a0696ffeda0..bc71f0295d1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.ir.txt index 93da393ff63..b9b1062d69d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.mappings.txt index 0330ff17c9d..38bb7262277 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_DesignTime.mappings.txt @@ -1,75 +1,75 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) | | -Generated Location: (1489:33,2 [6] ) +Generated Location: (1515:33,2 [6] ) | | Source Location: (9:1,5 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag?.Data| -Generated Location: (1674:41,6 [13] ) +Generated Location: (1700:41,6 [13] ) |ViewBag?.Data| Source Location: (22:1,18 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) | | -Generated Location: (1879:48,18 [6] ) +Generated Location: (1905:48,18 [6] ) | | Source Location: (29:2,5 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag.IntIndexer?[0]| -Generated Location: (2064:56,6 [22] ) +Generated Location: (2090:56,6 [22] ) |ViewBag.IntIndexer?[0]| Source Location: (51:2,27 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) | | -Generated Location: (2287:63,27 [6] ) +Generated Location: (2313:63,27 [6] ) | | Source Location: (58:3,5 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag.StrIndexer?["key"]| -Generated Location: (2472:71,6 [26] ) +Generated Location: (2498:71,6 [26] ) |ViewBag.StrIndexer?["key"]| Source Location: (84:3,31 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) | | -Generated Location: (2703:78,31 [6] ) +Generated Location: (2729:78,31 [6] ) | | Source Location: (91:4,5 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag?.Method(Value?[23]?.More)?["key"]| -Generated Location: (2888:86,6 [41] ) +Generated Location: (2914:86,6 [41] ) |ViewBag?.Method(Value?[23]?.More)?["key"]| Source Location: (132:4,46 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) | | -Generated Location: (3149:93,46 [2] ) +Generated Location: (3175:93,46 [2] ) | | Source Location: (140:7,1 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag?.Data| -Generated Location: (3328:100,6 [13] ) +Generated Location: (3354:100,6 [13] ) |ViewBag?.Data| Source Location: (156:8,1 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag.IntIndexer?[0]| -Generated Location: (3521:107,6 [22] ) +Generated Location: (3547:107,6 [22] ) |ViewBag.IntIndexer?[0]| Source Location: (181:9,1 [26] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag.StrIndexer?["key"]| -Generated Location: (3724:114,6 [26] ) +Generated Location: (3750:114,6 [26] ) |ViewBag.StrIndexer?["key"]| Source Location: (210:10,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml) |ViewBag?.Method(Value?[23]?.More)?["key"]| -Generated Location: (3931:121,6 [41] ) +Generated Location: (3957:121,6 [41] ) |ViewBag?.Method(Value?[23]?.More)?["key"]| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.codegen.cs index 85eac013619..0ec12b4d474 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "bb8d8c34e68ddf6c5aaf34e0f1c5f319f48c57e4ba3661228c4eeeb8bb9b79ce" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.ir.txt index 45a0ebb4e8f..1c153641b76 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/NullConditionalExpressions_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_NullConditionalExpressions - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [6] NullConditionalExpressions.cshtml) LazyIntermediateToken - (2:0,2 [6] NullConditionalExpressions.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.cs index cdd496becc9..de895f73c52 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.ir.txt index 260117e7542..fdba2522af3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.mappings.txt index c7fd22841d9..0408e3d1b76 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (17:2,1 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml) |if (true) { | -Generated Location: (1982:39,1 [14] ) +Generated Location: (2008:39,1 [14] ) |if (true) { | Source Location: (38:3,7 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml) | | -Generated Location: (2156:46,7 [2] ) +Generated Location: (2182:46,7 [2] ) | | Source Location: (47:4,7 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml) || -Generated Location: (2318:53,7 [0] ) +Generated Location: (2344:53,7 [0] ) || diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.codegen.cs index dab52a101c2..d3340b2d5a2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "88878cf1ea054aeb74300eb51cb951ede03552e4df20742a94bc2d437e248274" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.ir.txt index 3004f057472..473b9648415 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/OpenedIf_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_OpenedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::Microsoft.AspNetCore.Mvc.Razor.TagHelpers.BodyTagHelper - __Microsoft_AspNetCore_Mvc_Razor_TagHelpers_BodyTagHelper MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.cs index e028f4d2489..347d347b308 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.ir.txt index 1d2c6ef0d5d..aa1f5fd4023 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.mappings.txt index 91160670a46..05d52d55ee3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_DesignTime.mappings.txt @@ -4,7 +4,7 @@ int i =10; int j =20; }| -Generated Location: (1444:33,2 [31] ) +Generated Location: (1470:33,2 [31] ) | /* int i =10; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.codegen.cs index bcd60d5d038..22df09ada55 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "2ea704d333b7a4d377b389409cc282c6500f60cbc098fd01acffeac4b61d150b" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.ir.txt index 9edd6cad57e..9c0f61420b5 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ParserError_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_ParserError - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [31] ParserError.cshtml) LazyIntermediateToken - (2:0,2 [31] ParserError.cshtml) - CSharp - \n/*\nint i =10;\nint j =20;\n} diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs index 05988623c7f..20f1105bbcf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.ir.txt index f077a61cf89..5cd2766446a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.InputTagHelper1 - __TestNamespace_InputTagHelper1 FieldDeclaration - - private - global::TestNamespace.InputTagHelper2 - __TestNamespace_InputTagHelper2 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt index c89df5a1c68..23d767d3da4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |"*, TestAssembly"| -Generated Location: (1855:33,37 [17] ) +Generated Location: (1881:33,37 [17] ) |"*, TestAssembly"| Source Location: (37:2,2 [242] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) @@ -15,7 +15,7 @@ Source Location: (37:2,2 [242] TestFiles/IntegrationTests/CodeGenerationIntegrat { "name", "value" }, }; | -Generated Location: (2373:50,2 [242] ) +Generated Location: (2399:50,2 [242] ) | var literate = "or illiterate"; var intDictionary = new Dictionary @@ -30,51 +30,51 @@ Generated Location: (2373:50,2 [242] ) Source Location: (370:15,43 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |intDictionary| -Generated Location: (3054:68,56 [13] ) +Generated Location: (3080:68,56 [13] ) |intDictionary| Source Location: (404:15,77 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |stringDictionary| -Generated Location: (3444:76,77 [16] ) +Generated Location: (3470:76,77 [16] ) |stringDictionary| Source Location: (468:16,43 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |intDictionary| -Generated Location: (4108:87,56 [13] ) +Generated Location: (4134:87,56 [13] ) |intDictionary| Source Location: (502:16,77 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (4498:95,77 [2] ) +Generated Location: (4524:95,77 [2] ) |37| Source Location: (526:16,101 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |42| -Generated Location: (4921:103,101 [2] ) +Generated Location: (4947:103,101 [2] ) |42| Source Location: (590:18,31 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |42| -Generated Location: (5556:114,46 [2] ) +Generated Location: (5582:114,46 [2] ) |42| Source Location: (611:18,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (5923:122,64 [2] ) +Generated Location: (5949:122,64 [2] ) |37| Source Location: (634:18,75 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |98| -Generated Location: (6316:130,75 [2] ) +Generated Location: (6342:130,75 [2] ) |98| Source Location: (783:20,42 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |literate| -Generated Location: (7136:142,42 [8] ) +Generated Location: (7162:142,42 [8] ) |literate| Source Location: (826:21,29 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml) |37| -Generated Location: (7914:154,65 [2] ) +Generated Location: (7940:154,65 [2] ) |37| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs index 7b948c4d155..d3168b292b9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "28f23e39ed667ea15fc4af5b51ee4ad399519e7dd4dbddb840b8b70c29baf0e5" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.ir.txt index 8423dd65388..fe7c85c4681 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/PrefixedAttributeTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_PrefixedAttributeTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - password - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - type - radio - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.cs index 7e4c9770598..7b6c78c5720 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt index e1680c41e3d..b51a5ea39fa 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.mappings.txt index 4f30421ebe1..fe2be405d9c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_DesignTime.mappings.txt @@ -1,14 +1,14 @@ Source Location: (81:3,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) | | -Generated Location: (1450:33,2 [6] ) +Generated Location: (1476:33,2 [6] ) | | Source Location: (122:4,39 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) | Exception foo = | -Generated Location: (1655:41,39 [22] ) +Generated Location: (1681:41,39 [22] ) | Exception foo = | @@ -18,7 +18,7 @@ Source Location: (173:5,49 [58] TestFiles/IntegrationTests/CodeGenerationIntegra throw foo; } | -Generated Location: (1886:49,49 [58] ) +Generated Location: (1912:49,49 [58] ) | null; if(foo != null) { throw foo; @@ -27,21 +27,21 @@ Generated Location: (1886:49,49 [58] ) Source Location: (238:11,2 [24] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) | var bar = "@* bar *@"; | -Generated Location: (2105:59,2 [24] ) +Generated Location: (2131:59,2 [24] ) | var bar = "@* bar *@"; | Source Location: (310:12,45 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) |bar| -Generated Location: (2335:66,45 [3] ) +Generated Location: (2361:66,45 [3] ) |bar| Source Location: (323:14,2 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) |a| -Generated Location: (2506:73,6 [1] ) +Generated Location: (2532:73,6 [1] ) |a| Source Location: (328:14,7 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml) |b| -Generated Location: (2507:73,7 [1] ) +Generated Location: (2533:73,7 [1] ) |b| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs index 38b59d46c5b..f539cc7203b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a9d16af76d3b638c489fe4ce4511816619e1713e1515ec0ce13b898e140dde7d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt index 931613bfaf4..160886a6763 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RazorComments_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RazorComments - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (38:1,0 [15] RazorComments.cshtml) LazyIntermediateToken - (38:1,0 [2] RazorComments.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.ir.txt index b2490b90085..d5ac9236574 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt index 9dd822ad066..b65af31345d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (17:0,17 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml) |*, TestAssembly| -Generated Location: (1263:26,38 [15] ) +Generated Location: (1289:26,38 [15] ) |*, TestAssembly| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.codegen.cs index fa612a6507c..6f7e93ca4a6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "66adeb0c482cc6a637c59000352e67b637c2f01d476e877553f414561d86016c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.ir.txt index f5d7162589f..82c6e13c4b9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/RemoveTagHelperDirective_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_RemoveTagHelperDirective - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync Inject - Inject - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs index e5ab174b090..f6fcb8a39a3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt index 516dd0b17ca..11abba1fe2d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt index 180bf3fb650..c855ae03328 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_DesignTime.mappings.txt @@ -1,44 +1,44 @@ Source Location: (89:6,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section2| -Generated Location: (1199:26,22 [8] ) +Generated Location: (1225:26,22 [8] ) |Section2| Source Location: (172:10,9 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |Section1| -Generated Location: (1462:36,22 [8] ) +Generated Location: (1488:36,22 [8] ) |Section1| Source Location: (235:14,9 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |NestedDelegates| -Generated Location: (1725:46,22 [15] ) +Generated Location: (1751:46,22 [15] ) |NestedDelegates| Source Location: (2:0,2 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Layout = "_SectionTestLayout.cshtml" | -Generated Location: (2230:63,2 [44] ) +Generated Location: (2256:63,2 [44] ) | Layout = "_SectionTestLayout.cshtml" | Source Location: (123:7,22 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |thing| -Generated Location: (2523:72,22 [5] ) +Generated Location: (2549:72,22 [5] ) |thing| Source Location: (260:15,6 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) | Func f = | -Generated Location: (2908:85,6 [27] ) +Generated Location: (2934:85,6 [27] ) | Func f = | Source Location: (295:15,41 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |item| -Generated Location: (3249:93,41 [4] ) +Generated Location: (3275:93,41 [4] ) |item| Source Location: (306:15,52 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml) |; | -Generated Location: (3500:102,52 [2] ) +Generated Location: (3526:102,52 [2] ) |; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs index e3100e5e2cf..eafa4743dd4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "0e3bbd637055ed3caa71a09baf3eb8ab5fc1f8057091dcd2c2adbfa3de691076" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt index d5d878ffa2f..8541321a79b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Sections_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Sections - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [44] Sections.cshtml) LazyIntermediateToken - (2:0,2 [44] Sections.cshtml) - CSharp - \n Layout = "_SectionTestLayout.cshtml"\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs index dfa27ebac0c..4b3af1ea35c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.ir.txt index c16f21af6ef..4d6b4ee172b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt index 9e334179661..2e6e5659a87 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_DesignTime.mappings.txt @@ -1,5 +1,5 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml) |*, TestAssembly| -Generated Location: (1705:32,38 [15] ) +Generated Location: (1731:32,38 [15] ) |*, TestAssembly| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs index 85573f6035e..9afced309db 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "cc678f2e7fe9415c8275fdb0aa72ebab925dcf86a98dcdcfcb8939af2a5f2a9e" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("value", "Hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.ir.txt index 5522ec595d5..43d6897a07f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleTagHelpers_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleTagHelpers - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - value - Hello - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes DefaultTagHelperRuntime - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.cs index 76e7d8ca04c..89bf4df8213 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.ir.txt index d5ff76e612c..51b30c8b69d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.mappings.txt index 9741f1f4134..4cba94c1349 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_DesignTime.mappings.txt @@ -2,7 +2,7 @@ |if (true) { | -Generated Location: (1458:33,1 [15] ) +Generated Location: (1484:33,1 [15] ) |if (true) { | @@ -10,7 +10,7 @@ Generated Location: (1458:33,1 [15] ) Source Location: (27:2,12 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml) | }| -Generated Location: (1648:42,12 [3] ) +Generated Location: (1674:42,12 [3] ) | }| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.codegen.cs index 26f0e9af95a..59517fa892e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6c2fffb4b344ac4d9af24dc64c830fcfcba50e2ae9c69a95e54910b4c9225820" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.ir.txt index 828c1e151d1..2811d9aca1f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SimpleUnspacedIf_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SimpleUnspacedIf - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [14] SimpleUnspacedIf.cshtml) LazyIntermediateToken - (1:0,1 [14] SimpleUnspacedIf.cshtml) - CSharp - if (true)\n{\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.cs index d8ee96ba3a0..e1ff3f6cf6f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.ir.txt index a6a881fda8f..79a28126563 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.mappings.txt index af7664ee49e..88f868ff1d9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_DesignTime.mappings.txt @@ -1,23 +1,23 @@ Source Location: (24:2,2 [44] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) | if (DateTime.Now.ToBinary() % 2 == 0) | -Generated Location: (1504:33,2 [44] ) +Generated Location: (1530:33,2 [44] ) | if (DateTime.Now.ToBinary() % 2 == 0) | Source Location: (70:3,44 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |"Current time is divisible by 2"| -Generated Location: (1770:41,44 [32] ) +Generated Location: (1796:41,44 [32] ) |"Current time is divisible by 2"| Source Location: (103:3,77 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) | else | -Generated Location: (2058:48,77 [6] ) +Generated Location: (2084:48,77 [6] ) | else | Source Location: (110:3,84 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |DateTime.Now| -Generated Location: (2326:55,84 [12] ) +Generated Location: (2352:55,84 [12] ) |DateTime.Now| Source Location: (122:3,96 [381] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -38,7 +38,7 @@ Source Location: (122:3,96 [381] TestFiles/IntegrationTests/CodeGenerationIntegr i--; | -Generated Location: (2613:62,96 [381] ) +Generated Location: (2639:62,96 [381] ) | object Bar() @@ -60,18 +60,18 @@ Generated Location: (2613:62,96 [381] ) Source Location: (504:19,5 [47] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |foreach (var item in new[] {"hello"}) | -Generated Location: (3178:85,5 [47] ) +Generated Location: (3204:85,5 [47] ) |foreach (var item in new[] {"hello"}) | Source Location: (552:20,9 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |item| -Generated Location: (3413:93,9 [4] ) +Generated Location: (3439:93,9 [4] ) |item| Source Location: (556:20,13 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) || -Generated Location: (3610:100,13 [0] ) +Generated Location: (3636:100,13 [0] ) || Source Location: (556:20,13 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -79,7 +79,7 @@ Source Location: (556:20,13 [20] TestFiles/IntegrationTests/CodeGenerationIntegr do | -Generated Location: (3802:107,13 [20] ) +Generated Location: (3828:107,13 [20] ) | do @@ -87,7 +87,7 @@ Generated Location: (3802:107,13 [20] ) Source Location: (577:23,9 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |currentCount| -Generated Location: (4010:117,9 [12] ) +Generated Location: (4036:117,9 [12] ) |currentCount| Source Location: (589:23,21 [174] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -99,7 +99,7 @@ Source Location: (589:23,21 [174] TestFiles/IntegrationTests/CodeGenerationInteg using (var reader = new System.IO.StreamReader("/something")) | -Generated Location: (4223:124,21 [174] ) +Generated Location: (4249:124,21 [174] ) | while (--currentCount >= 0); @@ -111,14 +111,14 @@ Generated Location: (4223:124,21 [174] ) Source Location: (764:30,9 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |reader.ReadToEnd()| -Generated Location: (4585:138,9 [18] ) +Generated Location: (4611:138,9 [18] ) |reader.ReadToEnd()| Source Location: (782:30,27 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) | | -Generated Location: (4810:145,27 [8] ) +Generated Location: (4836:145,27 [8] ) | | @@ -126,74 +126,74 @@ Generated Location: (4810:145,27 [8] ) Source Location: (791:32,5 [36] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |lock (this) currentCount++;| -Generated Location: (5002:154,5 [36] ) +Generated Location: (5028:154,5 [36] ) |lock (this) currentCount++;| Source Location: (827:33,23 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) | | -Generated Location: (5240:162,23 [2] ) +Generated Location: (5266:162,23 [2] ) | | Source Location: (1674:76,1 [34] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |for (var i = 0; i < 10; i++) | -Generated Location: (5420:169,1 [34] ) +Generated Location: (5446:169,1 [34] ) |for (var i = 0; i < 10; i++) | Source Location: (1709:77,5 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |i| -Generated Location: (5639:177,6 [1] ) +Generated Location: (5665:177,6 [1] ) |i| Source Location: (1710:77,6 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) || -Generated Location: (5826:184,6 [0] ) +Generated Location: (5852:184,6 [0] ) || Source Location: (1715:79,1 [43] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |foreach (var item in new[] {"hello"}) | -Generated Location: (6006:191,1 [43] ) +Generated Location: (6032:191,1 [43] ) |foreach (var item in new[] {"hello"}) | Source Location: (1759:80,5 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |item| -Generated Location: (6234:199,6 [4] ) +Generated Location: (6260:199,6 [4] ) |item| Source Location: (1763:80,9 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) || -Generated Location: (6427:206,9 [0] ) +Generated Location: (6453:206,9 [0] ) || Source Location: (1768:82,1 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |do | -Generated Location: (6607:213,1 [8] ) +Generated Location: (6633:213,1 [8] ) |do | Source Location: (1777:83,5 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |currentCount| -Generated Location: (6800:221,6 [12] ) +Generated Location: (6826:221,6 [12] ) |currentCount| Source Location: (1789:83,17 [30] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) | while (--currentCount >= 0);| -Generated Location: (7009:228,17 [30] ) +Generated Location: (7035:228,17 [30] ) | while (--currentCount >= 0);| Source Location: (1824:86,1 [49] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |while (--currentCount <= 10) currentCount++;| -Generated Location: (7219:236,1 [49] ) +Generated Location: (7245:236,1 [49] ) |while (--currentCount <= 10) currentCount++;| @@ -201,38 +201,38 @@ Source Location: (1878:89,1 [99] TestFiles/IntegrationTests/CodeGenerationIntegr |using (var reader = new System.IO.StreamReader("/something")) // Reading the entire file | -Generated Location: (7448:244,1 [99] ) +Generated Location: (7474:244,1 [99] ) |using (var reader = new System.IO.StreamReader("/something")) // Reading the entire file | Source Location: (1978:91,5 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |reader.ReadToEnd()| -Generated Location: (7732:253,6 [18] ) +Generated Location: (7758:253,6 [18] ) |reader.ReadToEnd()| Source Location: (1996:91,23 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) || -Generated Location: (7953:260,23 [0] ) +Generated Location: (7979:260,23 [0] ) || Source Location: (2001:93,1 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |lock (this) currentCount++;| -Generated Location: (8133:267,1 [32] ) +Generated Location: (8159:267,1 [32] ) |lock (this) currentCount++;| Source Location: (2038:96,1 [10] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |if (true) | -Generated Location: (8345:275,1 [10] ) +Generated Location: (8371:275,1 [10] ) |if (true) | Source Location: (2049:96,12 [33] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |@GitHubUserName

Hello!

| -Generated Location: (8546:282,12 [33] ) +Generated Location: (8572:282,12 [33] ) |@GitHubUserName

Hello!

| @@ -240,18 +240,18 @@ Generated Location: (8546:282,12 [33] ) Source Location: (2083:98,1 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |if (true) | -Generated Location: (8757:290,1 [16] ) +Generated Location: (8783:290,1 [16] ) |if (true) | Source Location: (2118:99,23 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |DateTime.Now| -Generated Location: (8976:298,23 [12] ) +Generated Location: (9002:298,23 [12] ) |DateTime.Now| Source Location: (2136:100,0 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) || -Generated Location: (9169:305,0 [0] ) +Generated Location: (9195:305,0 [0] ) || Source Location: (846:36,12 [386] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -271,7 +271,7 @@ Source Location: (846:36,12 [386] TestFiles/IntegrationTests/CodeGenerationInteg foreach (var item in new[] {"hello"}) | -Generated Location: (9407:313,12 [386] ) +Generated Location: (9433:313,12 [386] ) | public string Foo() { @@ -291,7 +291,7 @@ Generated Location: (9407:313,12 [386] ) Source Location: (1233:51,13 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |item| -Generated Location: (9985:335,13 [4] ) +Generated Location: (10011:335,13 [4] ) |item| Source Location: (1237:51,17 [28] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -299,7 +299,7 @@ Source Location: (1237:51,17 [28] TestFiles/IntegrationTests/CodeGenerationInteg do | -Generated Location: (10186:342,17 [28] ) +Generated Location: (10212:342,17 [28] ) | do @@ -307,7 +307,7 @@ Generated Location: (10186:342,17 [28] ) Source Location: (1266:54,13 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |currentCount| -Generated Location: (10406:352,13 [12] ) +Generated Location: (10432:352,13 [12] ) |currentCount| Source Location: (1278:54,25 [194] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -319,7 +319,7 @@ Source Location: (1278:54,25 [194] TestFiles/IntegrationTests/CodeGenerationInte using (var reader = new System.IO.StreamReader("/something")) | -Generated Location: (10623:359,25 [194] ) +Generated Location: (10649:359,25 [194] ) | while (--currentCount >= 0); @@ -331,7 +331,7 @@ Generated Location: (10623:359,25 [194] ) Source Location: (1473:61,13 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) |reader.ReadToEnd()| -Generated Location: (11009:373,13 [18] ) +Generated Location: (11035:373,13 [18] ) |reader.ReadToEnd()| Source Location: (1491:61,31 [177] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml) @@ -349,7 +349,7 @@ Source Location: (1491:61,31 [177] TestFiles/IntegrationTests/CodeGenerationInte } | -Generated Location: (11238:380,31 [177] ) +Generated Location: (11264:380,31 [177] ) | lock (this) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.codegen.cs index 7e716f7ea42..ed2da220f72 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a66d420fecd4b03184392e5ffae1b5cbd3050be4e5c1a1d641eb271a35d9099d" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.ir.txt index e9c7fa72f17..91f0e1309b0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleLineControlFlowStatements_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleLineControlFlowStatements - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [22] SingleLineControlFlowStatements.cshtml) LazyIntermediateToken - (0:0,0 [2] SingleLineControlFlowStatements.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.ir.txt index d89a1e77f7a..11b34d1f5d3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt index 87ee93f6caa..bd2332ebd08 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (1802:32,37 [17] ) +Generated Location: (1828:32,37 [17] ) |"*, TestAssembly"| Source Location: (67:3,28 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml) |1337| -Generated Location: (2461:50,33 [4] ) +Generated Location: (2487:50,33 [4] ) |1337| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs index 5095900078d..88ba9502a23 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "911da9fbec044f6d3567d334c5ef47d9311c69940873e9ceb6ba007b65164b71" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.ir.txt index f8242412415..5b09edff084 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelperWithNewlineBeforeAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelperWithNewlineBeforeAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs index 8a600625958..23f5bcac2c4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.ir.txt index 29e78d928b7..2364c72da6b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt index d78b043a4f3..fc44f126ca6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml) |"*, TestAssembly"| -Generated Location: (1721:32,37 [17] ) +Generated Location: (1747:32,37 [17] ) |"*, TestAssembly"| Source Location: (63:2,28 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml) |1337| -Generated Location: (2353:50,33 [4] ) +Generated Location: (2379:50,33 [4] ) |1337| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs index 5d33bd05fe5..f782f32a44c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "07221c920388e192f27500b1efb178559390c71d91890dc7624909ff0a7e62a0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.ir.txt index f1dea66c897..21781c9f6d4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SingleTagHelper_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SingleTagHelper - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs index 2be5e93240e..37045db077c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.ir.txt index 9cdf9b9a8ea..3005c7a5ab2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt index 547965436a9..887f794170a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (2022:85,9 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml) |WriteLiteralsToInHere| -Generated Location: (1218:26,22 [21] ) +Generated Location: (1244:26,22 [21] ) |WriteLiteralsToInHere| Source Location: (5701:205,9 [25] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml) |WriteLiteralsToInHereAlso| -Generated Location: (1501:36,22 [25] ) +Generated Location: (1527:36,22 [25] ) |WriteLiteralsToInHereAlso| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.codegen.cs index c86e63f3e41..1ca6da65524 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "69f3680900f8c303ec50c37449fea720166f0f13b35f665d03575ab725ccabe0" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.ir.txt index b605d37fcc7..d722c24d0b4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/StringLiterals_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_StringLiterals - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (0:0,0 [2013] StringLiterals.cshtml) LazyIntermediateToken - (0:0,0 [2] StringLiterals.cshtml) - Html -

#pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.ir.txt index 05bb964db21..ff8e91b22e6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.mappings.txt index 836a67568e9..c635c0be02b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_DesignTime.mappings.txt @@ -3,7 +3,7 @@ { case { Year: 2022 }: | -Generated Location: (1509:33,1 [69] ) +Generated Location: (1535:33,1 [69] ) |switch (DateTimeOffset.UtcNow) { case { Year: 2022 }: @@ -19,7 +19,7 @@ Source Location: (159:3,97 [180] TestFiles/IntegrationTests/CodeGenerationIntegr case global::Test: break; }| -Generated Location: (1855:43,97 [180] ) +Generated Location: (1881:43,97 [180] ) | break; case [{ Test: true }]: diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.codegen.cs index 73fc9577339..5aa3b37ceff 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9168a1bd59651e5e083cf79f3271ea80436a9539f637069ba388b14b675f3b39" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.ir.txt index e91c0995e2e..6df0b582b3a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SwitchExpression_RecursivePattern_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SwitchExpression_RecursivePattern - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (1:0,1 [61] SwitchExpression_RecursivePattern.cshtml) LazyIntermediateToken - (1:0,1 [61] SwitchExpression_RecursivePattern.cshtml) - CSharp - switch (DateTimeOffset.UtcNow)\n{\n case { Year: 2022 }:\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs index e09633c3bf6..71645b32c64 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.ir.txt index 1969f772019..f7fac4b18e0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.CatchAllTagHelper - __TestNamespace_CatchAllTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt index 2920c2cdfec..7bfa98ed10b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_DesignTime.mappings.txt @@ -1,25 +1,25 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |*, TestAssembly| -Generated Location: (1754:32,38 [15] ) +Generated Location: (1780:32,38 [15] ) |*, TestAssembly| Source Location: (302:11,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |items| -Generated Location: (2419:50,46 [5] ) +Generated Location: (2445:50,46 [5] ) |items| Source Location: (351:12,20 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |items| -Generated Location: (2826:59,47 [5] ) +Generated Location: (2852:59,47 [5] ) |items| Source Location: (405:13,23 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |doSomething()| -Generated Location: (3229:68,43 [13] ) +Generated Location: (3255:68,43 [13] ) |doSomething()| Source Location: (487:14,24 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml) |doSomething()| -Generated Location: (3640:77,43 [13] ) +Generated Location: (3666:77,43 [13] ) |doSomething()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs index 9fccf013742..b7c9124e5f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "6670062036b3e25775cee4af27e2b53b638aff4fd93c3087d0cfb1947fd5e738" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("[item]", new global::Microsoft.AspNetCore.Html.HtmlString("items"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.ir.txt index 11b5af7e683..ebb3fe58432 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/SymbolBoundAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_SymbolBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - [item] - items - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - [(item)] - items - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - (click) - doSomething() - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.codegen.cs index 60674114429..4922b3c6244 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.ir.txt index ec2d23a0973..160465d71ef 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.MyTagHelper - __TestNamespace_MyTagHelper FieldDeclaration - - private - global::TestNamespace.NestedTagHelper - __TestNamespace_NestedTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.mappings.txt index 8686ec967fb..38e534426cc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_DesignTime.mappings.txt @@ -1,39 +1,39 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |"*, TestAssembly"| -Generated Location: (1823:33,37 [17] ) +Generated Location: (1849:33,37 [17] ) |"*, TestAssembly"| Source Location: (82:6,9 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |MySection| -Generated Location: (2097:43,22 [9] ) +Generated Location: (2123:43,22 [9] ) |MySection| Source Location: (388:14,13 [13] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |nestedsection| -Generated Location: (2372:53,22 [13] ) +Generated Location: (2398:53,22 [13] ) |nestedsection| Source Location: (37:2,2 [31] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) | var code = "some code"; | -Generated Location: (2886:70,2 [31] ) +Generated Location: (2912:70,2 [31] ) | var code = "some code"; | Source Location: (313:10,56 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |code| -Generated Location: (3213:79,56 [4] ) +Generated Location: (3239:79,56 [4] ) |code| Source Location: (157:8,51 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |DateTime.Now| -Generated Location: (3725:89,51 [12] ) +Generated Location: (3751:89,51 [12] ) |DateTime.Now| Source Location: (203:8,97 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml) |DateTime.Now| -Generated Location: (4076:97,97 [12] ) +Generated Location: (4102:97,97 [12] ) |DateTime.Now| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.codegen.cs index 15bf9ec2b29..8d49de1065f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "66a1fd3b9b40b304a7d1864845d2b7ab0f5f5c8a98d810ff8f97a245644661a9" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.ir.txt index 3a0e62a7b4c..e46cbc8a484 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersInSection_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersInSection - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.MyTagHelper - __TestNamespace_MyTagHelper FieldDeclaration - - private - global::TestNamespace.NestedTagHelper - __TestNamespace_NestedTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs index 8c0ebff4477..5053a538c73 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.ir.txt index 7bf14af9334..d87a9e04b84 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt index c04d4923d0d..c5cfdf91938 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_DesignTime.mappings.txt @@ -1,10 +1,10 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml) |*, TestAssembly| -Generated Location: (1744:32,38 [15] ) +Generated Location: (1770:32,38 [15] ) |*, TestAssembly| Source Location: (57:2,18 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml) |Hello| -Generated Location: (2354:50,18 [5] ) +Generated Location: (2380:50,18 [5] ) |Hello| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs index 2979924754d..145f118001a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "13f5d05e90dce1e87481ae84a605a64f0292501f08d4449df1105d14bd068161" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("text"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.ir.txt index c65bdc4ddf2..301a41abc2d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithBoundAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithBoundAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.SingleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.codegen.cs index f19f4b6cf7a..dd71e4d44ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.ir.txt index c606b65b561..a82c21cc4e4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.mappings.txt index 453d5fe0416..ec28e82a2e3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml) |*, TestAssembly| -Generated Location: (1807:33,38 [15] ) +Generated Location: (1833:33,38 [15] ) |*, TestAssembly| Source Location: (111:3,15 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml) |foo| -Generated Location: (2615:54,15 [3] ) +Generated Location: (2641:54,15 [3] ) |foo| Source Location: (126:3,30 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml) |bar| -Generated Location: (2828:61,30 [3] ) +Generated Location: (2854:61,30 [3] ) |bar| Source Location: (225:4,61 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml) |foo| -Generated Location: (3148:69,61 [3] ) +Generated Location: (3174:69,61 [3] ) |foo| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.codegen.cs index de62361e52c..5d10f1a5f56 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "07dfad59bc192742aea1638b2d08142a1c9a2201583a31cd0ea0ad5342acffca" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("bound", "hello", global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.ir.txt index e528482375a..9d9a92f7113 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithDataDashAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithDataDashAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_0 - bound - hello - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - data-one - 1 - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - data-two - 2 - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs index 70ee5fcfabc..4f732ca20f2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.ir.txt index 28c97f25235..d71fe2bc71d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt index c2be32a5cae..d601ec59a75 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_DesignTime.mappings.txt @@ -1,15 +1,15 @@ Source Location: (14:0,14 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |*, TestAssembly| -Generated Location: (1717:32,38 [15] ) +Generated Location: (1743:32,38 [15] ) |*, TestAssembly| Source Location: (48:1,17 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |cool:| -Generated Location: (2007:42,38 [5] ) +Generated Location: (2033:42,38 [5] ) |cool:| Source Location: (86:3,23 [5] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml) |Hello| -Generated Location: (2603:60,23 [5] ) +Generated Location: (2629:60,23 [5] ) |Hello| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.codegen.cs index f1c99f01501..2fc39350b72 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "4073ac6b7d09e02c4f015f3b452a099682d34b86878f507ef1a6e8585c0d6e96" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("text"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.SingleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.ir.txt index f6037d9acf3..d4e6fec2952 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithPrefix_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithPrefix - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - type - text - HtmlAttributeValueStyle.SingleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs index 5bc212beab5..ff75b745ddf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.ir.txt index 2083da92fd8..e205f62ac64 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::DivTagHelper - __DivTagHelper FieldDeclaration - - private - global::InputTagHelper - __InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt index a080090424f..b25e804087a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |"*, TestAssembly"| -Generated Location: (1776:33,37 [17] ) +Generated Location: (1802:33,37 [17] ) |"*, TestAssembly"| Source Location: (333:12,6 [66] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) @@ -8,7 +8,7 @@ Source Location: (333:12,6 [66] TestFiles/IntegrationTests/CodeGenerationIntegra RenderTemplate( "Template: ", | -Generated Location: (2294:50,6 [66] ) +Generated Location: (2320:50,6 [66] ) | RenderTemplate( "Template: ", @@ -16,13 +16,13 @@ Generated Location: (2294:50,6 [66] ) Source Location: (427:15,40 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |item| -Generated Location: (2683:61,40 [4] ) +Generated Location: (2709:61,40 [4] ) |item| Source Location: (482:15,95 [8] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml) |); | -Generated Location: (3297:74,95 [8] ) +Generated Location: (3323:74,95 [8] ) |); | @@ -35,7 +35,7 @@ Source Location: (47:2,12 [268] TestFiles/IntegrationTests/CodeGenerationIntegra helperResult.WriteTo(Output, HtmlEncoder); } | -Generated Location: (3682:86,12 [268] ) +Generated Location: (3708:86,12 [268] ) | public void RenderTemplate(string title, Func template) { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.codegen.cs index 6f2062f3f18..cda7aec589b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "ad0a6817d6431c932ff123cbd5e19efc157aa4994025b91acf744cf1a5d02dd5" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("type", new global::Microsoft.AspNetCore.Html.HtmlString("checkbox"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.ir.txt index 28f96034d86..b8f63b7a76f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithTemplate_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithTemplate - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - type - checkbox - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_1 - checked - true - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - condition - true - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs index 72cba17d65b..55ca1b9f78c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt index 769c880e7f2..51db26f9ae2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper FieldDeclaration - - private - global::TestNamespace.InputTagHelper - __TestNamespace_InputTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt index 8ecc40f9f2f..9d1245a1263 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_DesignTime.mappings.txt @@ -1,20 +1,20 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (1961:34,37 [17] ) +Generated Location: (1987:34,37 [17] ) |"*, TestAssembly"| Source Location: (74:5,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |1337| -Generated Location: (2615:52,33 [4] ) +Generated Location: (2641:52,33 [4] ) |1337| Source Location: (99:6,19 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |true| -Generated Location: (2823:59,19 [4] ) +Generated Location: (2849:59,19 [4] ) |true| Source Location: (186:10,11 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml) |1234| -Generated Location: (3649:73,33 [4] ) +Generated Location: (3675:73,33 [4] ) |1234| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs index f77e9c33806..db86c83c3f6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d9b84e2f98477223e105fd1bb35f0717dea379bb406844d36d35a9220d093ff3" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("Hello World"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt index 94d36b268d8..be570989777 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TagHelpersWithWeirdlySpacedAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TagHelpersWithWeirdlySpacedAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - Hello World - HtmlAttributeValueStyle.DoubleQuotes PreallocatedTagHelperPropertyValue - - __tagHelperAttribute_1 - type - text - HtmlAttributeValueStyle.SingleQuotes PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_2 - data-content - hello - HtmlAttributeValueStyle.DoubleQuotes diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.cs index 3c3ff9fc50d..97c1d4aafd7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.ir.txt index 813a2146079..d77bbb5c394 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.mappings.txt index df99f1c6f3e..9033e7db672 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (2:0,2 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) | | -Generated Location: (1423:33,2 [6] ) +Generated Location: (1449:33,2 [6] ) | | Source Location: (41:1,37 [0] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) || -Generated Location: (1617:41,37 [0] ) +Generated Location: (1643:41,37 [0] ) || Source Location: (59:1,55 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml) | | -Generated Location: (1823:48,55 [2] ) +Generated Location: (1849:48,55 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.codegen.cs index 26cfa5227f6..ab5730700bf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "d02f15e5b65cbcc2185f5f77ae6e69a01492b23120b97f0ffe06d4f34412b670" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.ir.txt index 0fb8dc617b2..2fff147dd8e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Tags_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Tags - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [2] Tags.cshtml) LazyIntermediateToken - (2:0,2 [2] Tags.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.codegen.cs index e4a36991214..d6ea66c42d9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.ir.txt index 8edd1dd567c..1ae5ece059d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.mappings.txt index bddf6b26c60..141b5fd4dbe 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_DesignTime.mappings.txt @@ -1,149 +1,149 @@ Source Location: (284:10,2 [34] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) | Func foo = | -Generated Location: (1439:33,2 [34] ) +Generated Location: (1465:33,2 [34] ) | Func foo = | Source Location: (337:11,51 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (1794:42,51 [4] ) +Generated Location: (1820:42,51 [4] ) |item| Source Location: (349:11,63 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |; | -Generated Location: (2049:51,63 [7] ) +Generated Location: (2075:51,63 [7] ) |; | Source Location: (357:12,5 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |foo("")| -Generated Location: (2219:59,6 [7] ) +Generated Location: (2245:59,6 [7] ) |foo("")| Source Location: (364:12,12 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) | | -Generated Location: (2396:66,12 [2] ) +Generated Location: (2422:66,12 [2] ) | | Source Location: (373:15,2 [35] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) | Func bar = | -Generated Location: (2555:73,2 [35] ) +Generated Location: (2581:73,2 [35] ) | Func bar = | Source Location: (420:16,44 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (2904:82,44 [4] ) +Generated Location: (2930:82,44 [4] ) |item| Source Location: (435:16,59 [7] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |; | -Generated Location: (3155:91,59 [7] ) +Generated Location: (3181:91,59 [7] ) |; | Source Location: (443:17,5 [14] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |bar("myclass")| -Generated Location: (3325:99,6 [14] ) +Generated Location: (3351:99,6 [14] ) |bar("myclass")| Source Location: (457:17,19 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) | | -Generated Location: (3516:106,19 [2] ) +Generated Location: (3542:106,19 [2] ) | | Source Location: (472:21,2 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |Repeat(10, | -Generated Location: (3679:113,6 [11] ) +Generated Location: (3705:113,6 [11] ) |Repeat(10, | Source Location: (495:21,25 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (3921:116,25 [4] ) +Generated Location: (3947:116,25 [4] ) |item| Source Location: (504:21,34 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |)| -Generated Location: (3982:122,1 [1] ) +Generated Location: (4008:122,1 [1] ) |)| Source Location: (523:25,1 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |Repeat(10, | -Generated Location: (4147:129,6 [16] ) +Generated Location: (4173:129,6 [16] ) |Repeat(10, | Source Location: (556:26,21 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (4390:133,21 [4] ) +Generated Location: (4416:133,21 [4] ) |item| Source Location: (577:27,0 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |)| -Generated Location: (4451:139,1 [1] ) +Generated Location: (4477:139,1 [1] ) |)| Source Location: (594:31,1 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |Repeat(10, | -Generated Location: (4616:146,6 [16] ) +Generated Location: (4642:146,6 [16] ) |Repeat(10, | Source Location: (628:32,22 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (4860:150,22 [4] ) +Generated Location: (4886:150,22 [4] ) |item| Source Location: (650:33,0 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |)| -Generated Location: (4921:156,1 [1] ) +Generated Location: (4947:156,1 [1] ) |)| Source Location: (667:37,1 [16] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |Repeat(10, | -Generated Location: (5086:163,6 [16] ) +Generated Location: (5112:163,6 [16] ) |Repeat(10, | Source Location: (702:38,23 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (5331:167,23 [4] ) +Generated Location: (5357:167,23 [4] ) |item| Source Location: (724:39,0 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |)| -Generated Location: (5392:173,1 [1] ) +Generated Location: (5418:173,1 [1] ) |)| Source Location: (748:44,5 [11] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |Repeat(10, | -Generated Location: (5557:180,6 [11] ) +Generated Location: (5583:180,6 [11] ) |Repeat(10, | Source Location: (781:45,15 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |item| -Generated Location: (5789:183,15 [4] ) +Generated Location: (5815:183,15 [4] ) |item| Source Location: (797:46,10 [18] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |var parent = item;| -Generated Location: (5961:190,10 [18] ) +Generated Location: (5987:190,10 [18] ) |var parent = item;| Source Location: (956:51,9 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) |)| -Generated Location: (6035:196,1 [1] ) +Generated Location: (6061:196,1 [1] ) |)| Source Location: (12:0,12 [265] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml) @@ -156,7 +156,7 @@ Source Location: (12:0,12 [265] TestFiles/IntegrationTests/CodeGenerationIntegra }); } | -Generated Location: (6254:205,12 [265] ) +Generated Location: (6280:205,12 [265] ) | public HelperResult Repeat(int times, Func template) { return new HelperResult((writer) => { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs index a3203a7bd16..136795030c7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "695d7f5579e84a072c03d019783c98e393c52ec6a24e022eb8ecb663955abd5c" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.ir.txt index c283b786e9c..0f21f41483a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Templates_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Templates - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (280:9,0 [2] Templates.cshtml) LazyIntermediateToken - (280:9,0 [2] Templates.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs index bbc2e4fc300..c64ef00b8e8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #line hidden diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt index 57515ffd583..bc5d5f0e465 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper DesignTimeDirective - diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt index 054f953d977..93712abbcf3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_DesignTime.mappings.txt @@ -1,6 +1,6 @@ Source Location: (14:0,14 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |"*, TestAssembly"| -Generated Location: (1772:32,37 [17] ) +Generated Location: (1798:32,37 [17] ) |"*, TestAssembly"| Source Location: (35:1,2 [59] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) @@ -8,7 +8,7 @@ Source Location: (35:1,2 [59] TestFiles/IntegrationTests/CodeGenerationIntegrati var @class = "container-fluid"; var @int = 1; | -Generated Location: (2295:49,2 [59] ) +Generated Location: (2321:49,2 [59] ) | var @class = "container-fluid"; var @int = 1; @@ -16,51 +16,51 @@ Generated Location: (2295:49,2 [59] ) Source Location: (122:6,23 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |1337| -Generated Location: (2659:59,33 [4] ) +Generated Location: (2685:59,33 [4] ) |1337| Source Location: (157:7,12 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@class| -Generated Location: (3026:68,12 [6] ) +Generated Location: (3052:68,12 [6] ) |@class| Source Location: (171:7,26 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |42| -Generated Location: (3245:75,33 [2] ) +Generated Location: (3271:75,33 [2] ) |42| Source Location: (202:8,21 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |42 + @int| -Generated Location: (3631:84,33 [9] ) +Generated Location: (3657:84,33 [9] ) |42 + @int| Source Location: (241:9,22 [3] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |int| -Generated Location: (4025:93,33 [3] ) +Generated Location: (4051:93,33 [3] ) |int| Source Location: (274:10,22 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |(| -Generated Location: (4413:102,33 [1] ) +Generated Location: (4439:102,33 [1] ) |(| Source Location: (275:10,23 [4] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@int| -Generated Location: (4414:102,34 [4] ) +Generated Location: (4440:102,34 [4] ) |@int| Source Location: (279:10,27 [1] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |)| -Generated Location: (4418:102,38 [1] ) +Generated Location: (4444:102,38 [1] ) |)| Source Location: (307:11,19 [6] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |@class| -Generated Location: (4790:111,19 [6] ) +Generated Location: (4816:111,19 [6] ) |@class| Source Location: (321:11,33 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml) |4 * @(@int + 2)| -Generated Location: (5010:118,33 [15] ) +Generated Location: (5036:118,33 [15] ) |4 * @(@int + 2)| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs index f61e73f3e37..9403c0aa521 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "5cd388817ab99fffd9510eac1fcdd90cdd85ca2fdd2eea07bb546d13df0501ec" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { private static readonly global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute __tagHelperAttribute_0 = new global::Microsoft.AspNetCore.Razor.TagHelpers.TagHelperAttribute("class", new global::Microsoft.AspNetCore.Html.HtmlString("test"), global::Microsoft.AspNetCore.Razor.TagHelpers.HtmlAttributeValueStyle.DoubleQuotes); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt index 0df5432621b..205ae49b0ff 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/TransitionsInTagHelperAttributes_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_TransitionsInTagHelperAttributes - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - PreallocatedTagHelperHtmlAttributeValue - - __tagHelperAttribute_0 - class - test - HtmlAttributeValueStyle.DoubleQuotes DefaultTagHelperRuntime - FieldDeclaration - - private - global::TestNamespace.PTagHelper - __TestNamespace_PTagHelper diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.cs index 9ca1fc448e4..cc79a14e325 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -16,7 +16,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.ir.txt index 77a00644652..a1e409f94ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (1:0,1 [20] ) - global::System UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic @@ -10,7 +10,7 @@ UsingDirective - (226:6,1 [51] ) - global::Microsoft.AspNetCore.Mvc.ViewFeatures RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.mappings.txt index 562ac5e6d14..2e3186e571b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_DesignTime.mappings.txt @@ -1,19 +1,19 @@ Source Location: (2:0,2 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml) | | -Generated Location: (1489:33,2 [2] ) +Generated Location: (1515:33,2 [2] ) | | Source Location: (5:1,1 [9] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml) |DateTime.| -Generated Location: (1668:40,6 [9] ) +Generated Location: (1694:40,6 [9] ) |DateTime.| Source Location: (14:1,10 [2] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml) | | -Generated Location: (1861:47,10 [2] ) +Generated Location: (1887:47,10 [2] ) | | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.codegen.cs index 3c252d76ce9..040c8d41b43 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "9e0927882a39a700cb088e5a915bfe7c1f8b99c1859555ad2263383bac549511" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System; @@ -18,7 +18,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.ir.txt index e3000d9d916..c4fd3bfd7ac 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/UnfinishedExpressionInCode_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (1:0,1 [22] ) - global::System UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq @@ -11,7 +11,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_UnfinishedExpressionInCode - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync CSharpCode - (2:0,2 [2] UnfinishedExpressionInCode.cshtml) LazyIntermediateToken - (2:0,2 [2] UnfinishedExpressionInCode.cshtml) - CSharp - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.cs index b85b3188239..fb1f6c69ecb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -45,7 +45,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.ir.txt index 0cc9b7d0304..00c805a43fc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -15,7 +15,7 @@ UsingDirective - (123:6,1 [41] Usings.cshtml) - static global::System.Text.Encoding RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.mappings.txt index 49e5b4e7a7b..8fb5bc02ce6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_DesignTime.mappings.txt @@ -1,31 +1,31 @@ Source Location: (1:0,1 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using System.IO| -Generated Location: (520:14,0 [15] ) +Generated Location: (537:14,0 [15] ) |using System.IO| Source Location: (19:1,1 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using Foo = System.Text.Encoding| -Generated Location: (660:19,0 [32] ) +Generated Location: (677:19,0 [32] ) |using Foo = System.Text.Encoding| Source Location: (54:2,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using System| -Generated Location: (817:24,0 [12] ) +Generated Location: (834:24,0 [12] ) |using System| Source Location: (71:4,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using static System| -Generated Location: (954:29,0 [19] ) +Generated Location: (971:29,0 [19] ) |using static System| Source Location: (93:5,1 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using static System.Console| -Generated Location: (1098:34,0 [27] ) +Generated Location: (1115:34,0 [27] ) |using static System.Console| Source Location: (123:6,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |using static global::System.Text.Encoding| -Generated Location: (1250:39,0 [41] ) +Generated Location: (1267:39,0 [41] ) |using static global::System.Text.Encoding| Source Location: (170:8,2 [158] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) @@ -33,7 +33,7 @@ Source Location: (170:8,2 [158] TestFiles/IntegrationTests/CodeGenerationIntegra using var disposable = (IDisposable)ViewData["disposable"]; using System.IDisposable otherDisposable = (IDisposable)ViewData["otherdisposable"]; | -Generated Location: (2290:62,2 [158] ) +Generated Location: (2316:62,2 [158] ) | using var disposable = (IDisposable)ViewData["disposable"]; using System.IDisposable otherDisposable = (IDisposable)ViewData["otherdisposable"]; @@ -41,11 +41,11 @@ Generated Location: (2290:62,2 [158] ) Source Location: (362:13,29 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |typeof(Path).FullName| -Generated Location: (2629:71,29 [21] ) +Generated Location: (2655:71,29 [21] ) |typeof(Path).FullName| Source Location: (424:14,35 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml) |typeof(Foo).FullName| -Generated Location: (2840:78,35 [20] ) +Generated Location: (2866:78,35 [20] ) |typeof(Foo).FullName| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.codegen.cs index 7e460943928..714f3fe5d77 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.codegen.cs @@ -1,6 +1,6 @@ // #pragma warning disable 1591 -namespace AspNetCore +namespace AspNetCoreGeneratedDocument { #line default using TModel = global::System.Object; @@ -50,7 +50,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 219 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.ir.txt index da36f385ec9..44e536ca30a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.ir.txt @@ -1,5 +1,5 @@ Document - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - - TModel = global::System.Object UsingDirective - (24:1,1 [40] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [25] ) - global::System.Linq @@ -16,7 +16,7 @@ UsingDirective - (576:31,1 [17] Usings_OutOfOrder.cshtml) - System.Text RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - DesignTimeDirective - DirectiveToken - (287:7,8 [62] ) - global::Microsoft.AspNetCore.Mvc.Rendering.IHtmlHelper DirectiveToken - (350:7,71 [4] ) - Html diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.mappings.txt index 724da265177..9082f2f3e43 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_DesignTime.mappings.txt @@ -1,36 +1,36 @@ Source Location: (1:0,1 [15] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using System.IO| -Generated Location: (531:14,0 [15] ) +Generated Location: (548:14,0 [15] ) |using System.IO| Source Location: (60:6,1 [32] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using Foo = System.Text.Encoding| -Generated Location: (682:19,0 [32] ) +Generated Location: (699:19,0 [32] ) |using Foo = System.Text.Encoding| Source Location: (136:12,1 [12] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using System| -Generated Location: (851:24,0 [12] ) +Generated Location: (868:24,0 [12] ) |using System| Source Location: (153:14,1 [19] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using static System| -Generated Location: (1000:29,0 [19] ) +Generated Location: (1017:29,0 [19] ) |using static System| Source Location: (175:15,1 [27] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using static System.Console| -Generated Location: (1156:34,0 [27] ) +Generated Location: (1173:34,0 [27] ) |using static System.Console| Source Location: (246:21,1 [41] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using static global::System.Text.Encoding| -Generated Location: (1320:39,0 [41] ) +Generated Location: (1337:39,0 [41] ) |using static global::System.Text.Encoding| Source Location: (576:31,1 [17] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |using System.Text| -Generated Location: (1498:44,0 [17] ) +Generated Location: (1515:44,0 [17] ) |using System.Text| Source Location: (293:23,2 [158] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) @@ -38,7 +38,7 @@ Source Location: (293:23,2 [158] TestFiles/IntegrationTests/CodeGenerationIntegr using var disposable = (IDisposable)ViewData["disposable"]; using System.IDisposable otherDisposable = (IDisposable)ViewData["otherdisposable"]; | -Generated Location: (2548:67,2 [158] ) +Generated Location: (2574:67,2 [158] ) | using var disposable = (IDisposable)ViewData["disposable"]; using System.IDisposable otherDisposable = (IDisposable)ViewData["otherdisposable"]; @@ -46,19 +46,19 @@ Generated Location: (2548:67,2 [158] ) Source Location: (485:28,29 [21] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |typeof(Path).FullName| -Generated Location: (2898:76,29 [21] ) +Generated Location: (2924:76,29 [21] ) |typeof(Path).FullName| Source Location: (547:29,35 [20] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) |typeof(Foo).FullName| -Generated Location: (3120:83,35 [20] ) +Generated Location: (3146:83,35 [20] ) |typeof(Foo).FullName| Source Location: (32:2,12 [22] TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml) | // functions 1 | -Generated Location: (3366:92,12 [22] ) +Generated Location: (3392:92,12 [22] ) | // functions 1 | @@ -67,7 +67,7 @@ Source Location: (108:8,12 [22] TestFiles/IntegrationTests/CodeGenerationIntegra | // functions 2 | -Generated Location: (3562:100,12 [22] ) +Generated Location: (3588:100,12 [22] ) | // functions 2 | @@ -76,7 +76,7 @@ Source Location: (218:17,12 [22] TestFiles/IntegrationTests/CodeGenerationIntegr | // functions 3 | -Generated Location: (3759:108,12 [22] ) +Generated Location: (3785:108,12 [22] ) | // functions 3 | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.codegen.cs index 89753dcb72d..582e12e504c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "a3144fef15024ccbbb19682bfb110b149c637f2ae64b4499962195e7612ba274" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -59,7 +59,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.ir.txt index fd87db2bf1d..3d5b44cc8d4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_OutOfOrder_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks @@ -17,7 +17,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings_OutOfOrder - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (18:1,0 [2] Usings_OutOfOrder.cshtml) LazyIntermediateToken - (18:1,0 [2] Usings_OutOfOrder.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.codegen.cs index 7548535a8a6..11aba447b73 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.codegen.cs @@ -1,8 +1,8 @@ #pragma checksum "TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml" "{8829d00f-11b8-4213-878b-770e8597ac16}" "f52e72ba69034334ab681d1f5e91cd50788cbfc0d1390104ee1e60d95d4ca443" // #pragma warning disable 1591 -[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCore.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml")] -namespace AspNetCore +[assembly: global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemAttribute(typeof(AspNetCoreGeneratedDocument.TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings), @"mvc.1.0.view", @"/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml")] +namespace AspNetCoreGeneratedDocument { #line default using global::System.Collections.Generic; @@ -53,7 +53,7 @@ namespace AspNetCore [global::Microsoft.AspNetCore.Razor.Hosting.RazorCompiledItemMetadataAttribute("Identifier", "/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings.cshtml")] [global::System.Runtime.CompilerServices.CreateNewOnMetadataUpdateAttribute] #nullable restore - public class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage + internal sealed class TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings : global::Microsoft.AspNetCore.Mvc.Razor.RazorPage #nullable disable { #pragma warning disable 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.ir.txt index 1f87045e8c9..26b0208ef5b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.ir.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/Usings_Runtime.ir.txt @@ -1,6 +1,6 @@ Document - RazorCompiledItemAttribute - - NamespaceDeclaration - - AspNetCore + NamespaceDeclaration - - AspNetCoreGeneratedDocument UsingDirective - (24:1,1 [42] ) - global::System.Collections.Generic UsingDirective - (67:2,1 [27] ) - global::System.Linq UsingDirective - (95:3,1 [38] ) - global::System.Threading.Tasks @@ -16,7 +16,7 @@ RazorSourceChecksumAttribute - RazorCompiledItemMetadataAttribute - CreateNewOnMetadataUpdateAttribute - - ClassDeclaration - - public - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - + ClassDeclaration - - internal sealed - TestFiles_IntegrationTests_CodeGenerationIntegrationTest_Usings - global::Microsoft.AspNetCore.Mvc.Razor.RazorPage - MethodDeclaration - - public async override - global::System.Threading.Tasks.Task - ExecuteAsync HtmlContent - (68:3,0 [2] Usings.cshtml) LazyIntermediateToken - (68:3,0 [2] Usings.cshtml) - Html - \n diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs index 33f6e744b0e..a1b1ba4b487 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/RazorConfiguration.cs @@ -12,14 +12,14 @@ public sealed record class RazorConfiguration( string ConfigurationName, ImmutableArray Extensions, LanguageServerFlags? LanguageServerFlags = null, - bool UseConsolidatedMvcViews = false) + bool UseConsolidatedMvcViews = true) { public static readonly RazorConfiguration Default = new( RazorLanguageVersion.Latest, ConfigurationName: "unnamed", Extensions: [], LanguageServerFlags: null, - UseConsolidatedMvcViews: false); + UseConsolidatedMvcViews: true); public bool Equals(RazorConfiguration? other) => other is not null && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs index aa245a725be..0925b7d4aeb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentSymbols/DocumentSymbolEndpointTest.cs @@ -25,7 +25,7 @@ public Task DocumentSymbols_CSharpClassWithMethods(bool hierarchical) => VerifyDocumentSymbolsAsync( """ @functions { - class {|AspNetCore.test.C:C|} + class {|AspNetCoreGeneratedDocument.test.C:C|} { private void {|HandleString(string s):HandleString|}(string s) { From 27a338b0a6a7337b5e94033a512507ba0c2e2c13 Mon Sep 17 00:00:00 2001 From: Chris Sienkiewicz Date: Wed, 28 Aug 2024 11:56:48 -0700 Subject: [PATCH 192/271] Global namespace component bind (#10798) * Don't create a taghelper with no matching rules * Add test --------- Co-authored-by: Jan Jones --- .../ComponentCodeGenerationTestBase.cs | 30 ++++++++ .../TestComponent.codegen.cs | 71 +++++++++++++++++++ .../TestComponent.ir.txt | 27 +++++++ .../TestComponent.mappings.txt | 19 +++++ .../TestComponent.codegen.cs | 53 ++++++++++++++ .../TestComponent.ir.txt | 18 +++++ .../TestComponent.mappings.txt | 19 +++++ .../ComponentTagHelperDescriptorProvider.cs | 17 +++-- 8 files changed, 249 insertions(+), 5 deletions(-) create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 22fe140d289..57040aebbad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -2743,6 +2743,36 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10609")] + public void BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent() + { + // Arrange + AdditionalSyntaxTrees.Add(Parse(@" +using System; +using Microsoft.AspNetCore.Components; + +public class MyComponent : ComponentBase +{ + [Parameter] + public int Value { get; set; } + + [Parameter] + public Action ValueChanged { get; set; } +}")); + + // Act + var generated = CompileToCSharp(@" + +@code { + public int ParentValue { get; set; } = 42; +}"); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + [IntegrationTestFact] public void BindToElement_WritesAttributes() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs new file mode 100644 index 00000000000..e57b3f7c0f9 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs @@ -0,0 +1,71 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + ParentValue + +#line default +#line hidden +#nullable disable + ); + __o = new global::System.Action( + __value => ParentValue = __value); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); + #pragma warning disable BL0005 + ((global::MyComponent)default). +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Value + +#line default +#line hidden +#nullable disable + = default; + #pragma warning restore BL0005 +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::MyComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 2 "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt new file mode 100644 index 00000000000..09117fc51f6 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt @@ -0,0 +1,27 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => ParentValue = __value + HtmlContent - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (41:0,41 [2] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n + CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt new file mode 100644 index 00000000000..d69e5ca5733 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt @@ -0,0 +1,19 @@ +Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1135:29,26 [11] ) +|ParentValue| + +Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) +|Value| +Generated Location: (1663:44,19 [5] ) +|Value| + +Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (2071:62,7 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs new file mode 100644 index 00000000000..d8baebfd6df --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs @@ -0,0 +1,53 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, nameof(global::MyComponent. +#nullable restore +#line (1,20)-(1,25) "x:\dir\subdir\Test\TestComponent.cshtml" +Value + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck( +#nullable restore +#line (1,27)-(1,38) "x:\dir\subdir\Test\TestComponent.cshtml" +ParentValue + +#line default +#line hidden +#nullable disable + )); + __builder.AddComponentParameter(2, nameof(global::MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line (2,8)-(4,1) "x:\dir\subdir\Test\TestComponent.cshtml" + + public int ParentValue { get; set; } = 42; + +#line default +#line hidden +#nullable disable + + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt new file mode 100644 index 00000000000..f52f54e66eb --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.ir.txt @@ -0,0 +1,18 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [41] x:\dir\subdir\Test\TestComponent.cshtml) - MyComponent + ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - Value - Value - AttributeStructure.DoubleQuotes + CSharpExpression - + LazyIntermediateToken - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - ParentValue + ComponentAttribute - (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) - ValueChanged - ValueChanged - AttributeStructure.DoubleQuotes + CSharpExpression - + IntermediateToken - - CSharp - __value => ParentValue = __value + CSharpCode - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n public int ParentValue { get; set; } = 42;\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt new file mode 100644 index 00000000000..1e7397b4f77 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt @@ -0,0 +1,19 @@ +Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) +|Value| +Generated Location: (874:23,0 [5] ) +|Value| + +Source Location: (26:0,26 [11] x:\dir\subdir\Test\TestComponent.cshtml) +|ParentValue| +Generated Location: (1134:31,0 [11] ) +|ParentValue| + +Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) +| + public int ParentValue { get; set; } = 42; +| +Generated Location: (1548:43,0 [50] ) +| + public int ParentValue { get; set; } = 42; +| + diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs index 99c6e5e6943..7edbd71fb75 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ComponentTagHelperDescriptorProvider.cs @@ -55,14 +55,22 @@ protected override void Collect(ISymbol symbol, ICollection var shortNameMatchingDescriptor = CreateShortNameMatchingDescriptor(type, properties); results.Add(shortNameMatchingDescriptor); - var fullyQualifiedNameMatchingDescriptor = CreateFullyQualifiedNameMatchingDescriptor(type, properties); - results.Add(fullyQualifiedNameMatchingDescriptor); + // If the component is in the global namespace, skip adding this descriptor which will be the same as the short name one. + TagHelperDescriptor? fullyQualifiedNameMatchingDescriptor = null; + if (!type.ContainingNamespace.IsGlobalNamespace) + { + fullyQualifiedNameMatchingDescriptor = CreateFullyQualifiedNameMatchingDescriptor(type, properties); + results.Add(fullyQualifiedNameMatchingDescriptor); + } foreach (var childContent in shortNameMatchingDescriptor.GetChildContentProperties()) { // Synthesize a separate tag helper for each child content property that's declared. results.Add(CreateChildContentDescriptor(shortNameMatchingDescriptor, childContent)); - results.Add(CreateChildContentDescriptor(fullyQualifiedNameMatchingDescriptor, childContent)); + if (fullyQualifiedNameMatchingDescriptor is not null) + { + results.Add(CreateChildContentDescriptor(fullyQualifiedNameMatchingDescriptor, childContent)); + } } } } @@ -111,8 +119,7 @@ private static TagHelperDescriptor CreateNameMatchingDescriptor( metadata.Add(ComponentMetadata.Component.NameMatchKey, ComponentMetadata.Component.FullyQualifiedNameMatch); } - // If the component is in the global namespace, skip adding this rule which is the same as the fully qualified one. - else if (!type.ContainingNamespace.IsGlobalNamespace) + else { builder.TagMatchingRule(r => { From b650ceebd791c9d1aaae4577d25002516183ce48 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 29 Aug 2024 09:55:50 +1000 Subject: [PATCH 193/271] Cleanup and rename files to bring them to modern standards Purely mechanical changes here - using primary constructors, interfaces over abstract classes, etc. --- .../Debugging/RazorBreakpointSpanEndpoint.cs | 25 ++----- .../RazorProximityExpressionsEndpoint.cs | 28 ++------ ...esolver.cs => IRazorBreakpointResolver.cs} | 4 +- ...s => IRazorProximityExpressionResolver.cs} | 4 +- .../DefaultLSPBreakpointSpanProvider.cs | 66 ------------------ .../DefaultLSPProximityExpressionsProvider.cs | 67 ------------------- .../Debugging/ILSPBreakpointSpanProvider.cs | 14 ++++ .../ILSPProximityExpressionsProvider.cs | 15 +++++ .../Debugging/LSPBreakpointSpanProvider.cs | 39 ++++++++++- .../LSPProximityExpressionsProvider.cs | 38 ++++++++++- ...Resolver.cs => RazorBreakpointResolver.cs} | 58 +++++----------- ...cs => RazorProximityExpressionResolver.cs} | 58 +++++----------- ...zorLanguageService_IVsLanguageDebugInfo.cs | 8 +-- .../RazorPackage.cs | 4 +- ...Test.cs => RazorBreakpointResolverTest.cs} | 32 ++++----- ...> RazorProximityExpressionResolverTest.cs} | 22 +++--- .../TestLSPBreakpointSpanProvider.cs | 4 +- ...anguageService_IVsLanguageDebugInfoTest.cs | 12 ++-- 18 files changed, 188 insertions(+), 310 deletions(-) rename src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/{RazorBreakpointResolver.cs => IRazorBreakpointResolver.cs} (63%) rename src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/{RazorProximityExpressionResolver.cs => IRazorProximityExpressionResolver.cs} (58%) delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPBreakpointSpanProvider.cs delete mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPProximityExpressionsProvider.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs rename src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/{DefaultRazorBreakpointResolver.cs => RazorBreakpointResolver.cs} (64%) rename src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/{DefaultRazorProximityExpressionResolver.cs => RazorProximityExpressionResolver.cs} (63%) rename src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/{DefaultRazorBreakpointResolverTest.cs => RazorBreakpointResolverTest.cs} (86%) rename src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/{DefaultRazorProximityExpressionResolverTest.cs => RazorProximityExpressionResolverTest.cs} (83%) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index 1bcb7c82ec0..578010056e2 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -19,30 +19,17 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorBreakpointSpanEndpoint)] -internal class RazorBreakpointSpanEndpoint : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler +internal class RazorBreakpointSpanEndpoint( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler { - private readonly IDocumentMappingService _documentMappingService; - private readonly ILogger _logger; + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; - public RazorBreakpointSpanEndpoint( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - { - if (loggerFactory is null) - { - throw new ArgumentNullException(nameof(loggerFactory)); - } - - _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _logger = loggerFactory.GetOrCreateLogger(); - } - public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) - { - return request.Uri; - } + => request.Uri; public async Task HandleRequestAsync(RazorBreakpointSpanParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs index 844da19f1a8..a908dd8c8e4 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs @@ -20,35 +20,17 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorProximityExpressionsEndpoint)] -internal class RazorProximityExpressionsEndpoint : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler -{ - private readonly IDocumentMappingService _documentMappingService; - private readonly ILogger _logger; - - public RazorProximityExpressionsEndpoint( +internal class RazorProximityExpressionsEndpoint( IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) + ILoggerFactory loggerFactory) : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler { - if (documentMappingService is null) - { - throw new ArgumentNullException(nameof(documentMappingService)); - } - - if (loggerFactory is null) - { - throw new ArgumentNullException(nameof(loggerFactory)); - } - - _documentMappingService = documentMappingService; - _logger = loggerFactory.GetOrCreateLogger(); - } + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); public bool MutatesSolutionState => false; public Uri GetTextDocumentIdentifier(RazorProximityExpressionsParams request) - { - return request.Uri; - } + => request.Uri; public async Task HandleRequestAsync(RazorProximityExpressionsParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorBreakpointResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorBreakpointResolver.cs similarity index 63% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorBreakpointResolver.cs rename to src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorBreakpointResolver.cs index a9dfe15d5bc..62d9ec22964 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorBreakpointResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorBreakpointResolver.cs @@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.Razor.Debugging; -internal abstract class RazorBreakpointResolver +internal interface IRazorBreakpointResolver { - public abstract Task TryResolveBreakpointRangeAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken); + Task TryResolveBreakpointRangeAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorProximityExpressionResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorProximityExpressionResolver.cs similarity index 58% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorProximityExpressionResolver.cs rename to src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorProximityExpressionResolver.cs index 20ea51fa8c4..29ab08313b9 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/RazorProximityExpressionResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/Debugging/IRazorProximityExpressionResolver.cs @@ -8,7 +8,7 @@ namespace Microsoft.VisualStudio.Razor.Debugging; -internal abstract class RazorProximityExpressionResolver +internal interface IRazorProximityExpressionResolver { - public abstract Task?> TryResolveProximityExpressionsAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken); + Task?> TryResolveProximityExpressionsAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPBreakpointSpanProvider.cs deleted file mode 100644 index ee9438b506f..00000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPBreakpointSpanProvider.cs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.ComponentModel.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Protocol.Debugging; -using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; -using Microsoft.VisualStudio.LanguageServer.Protocol; -using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; - -namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; - -[Export(typeof(LSPBreakpointSpanProvider))] -internal class DefaultLSPBreakpointSpanProvider : LSPBreakpointSpanProvider -{ - private readonly LSPRequestInvoker _requestInvoker; - private readonly ILogger _logger; - - [ImportingConstructor] - public DefaultLSPBreakpointSpanProvider( - LSPRequestInvoker requestInvoker, - ILoggerFactory loggerFactory) - { - _requestInvoker = requestInvoker; - _logger = loggerFactory.GetOrCreateLogger(); - } - - public async override Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - if (position is null) - { - throw new ArgumentNullException(nameof(position)); - } - - var languageQueryParams = new RazorBreakpointSpanParams() - { - Position = position, - Uri = documentSnapshot.Uri - }; - - var response = await _requestInvoker.ReinvokeRequestOnServerAsync( - documentSnapshot.Snapshot.TextBuffer, - LanguageServerConstants.RazorBreakpointSpanEndpoint, - RazorLSPConstants.RazorLanguageServerName, - languageQueryParams, - cancellationToken).ConfigureAwait(false); - - var languageResponse = response?.Response; - if (languageResponse is null) - { - _logger.LogInformation($"The breakpoint position could not be mapped to a valid range."); - return null; - } - - return languageResponse.Range; - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPProximityExpressionsProvider.cs deleted file mode 100644 index 1452ca9f165..00000000000 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultLSPProximityExpressionsProvider.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Collections.Generic; -using System.ComponentModel.Composition; -using System.Threading; -using System.Threading.Tasks; -using Microsoft.CodeAnalysis.Razor.Logging; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Protocol.Debugging; -using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; - -[Export(typeof(LSPProximityExpressionsProvider))] -internal class DefaultLSPProximityExpressionsProvider : LSPProximityExpressionsProvider -{ - private readonly LSPRequestInvoker _requestInvoker; - - private readonly ILogger _logger; - - [ImportingConstructor] - public DefaultLSPProximityExpressionsProvider( - LSPRequestInvoker requestInvoker, - ILoggerFactory loggerFactory) - { - _requestInvoker = requestInvoker; - _logger = loggerFactory.GetOrCreateLogger(); - } - - public async override Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) - { - if (documentSnapshot is null) - { - throw new ArgumentNullException(nameof(documentSnapshot)); - } - - if (position is null) - { - throw new ArgumentNullException(nameof(position)); - } - - var proximityExpressionsParams = new RazorProximityExpressionsParams() - { - Position = position, - Uri = documentSnapshot.Uri - }; - - var response = await _requestInvoker.ReinvokeRequestOnServerAsync( - documentSnapshot.Snapshot.TextBuffer, - LanguageServerConstants.RazorProximityExpressionsEndpoint, - RazorLSPConstants.RazorLanguageServerName, - proximityExpressionsParams, - cancellationToken).ConfigureAwait(false); - - var languageResponse = response?.Response; - if (languageResponse is null) - { - _logger.LogInformation($"The proximity expressions could not be resolved."); - return null; - } - - return languageResponse.Expressions; - } -} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs new file mode 100644 index 00000000000..b25618a797b --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; + +internal interface ILSPBreakpointSpanProvider +{ + Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs new file mode 100644 index 00000000000..37ab22b8039 --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; + +internal interface ILSPProximityExpressionsProvider +{ + Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs index 0c1a05b4b7b..cd2b7bd4efd 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs @@ -1,14 +1,49 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Protocol.Debugging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; +using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -internal abstract class LSPBreakpointSpanProvider +[Export(typeof(ILSPBreakpointSpanProvider))] +[method: ImportingConstructor] +internal class LSPBreakpointSpanProvider( + LSPRequestInvoker requestInvoker, + ILoggerFactory loggerFactory) : ILSPBreakpointSpanProvider { - public abstract Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + public async Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + { + var languageQueryParams = new RazorBreakpointSpanParams() + { + Position = position, + Uri = documentSnapshot.Uri + }; + + var response = await _requestInvoker.ReinvokeRequestOnServerAsync( + documentSnapshot.Snapshot.TextBuffer, + LanguageServerConstants.RazorBreakpointSpanEndpoint, + RazorLSPConstants.RazorLanguageServerName, + languageQueryParams, + cancellationToken).ConfigureAwait(false); + + var languageResponse = response?.Response; + if (languageResponse is null) + { + _logger.LogInformation($"The breakpoint position could not be mapped to a valid range."); + return null; + } + + return languageResponse.Range; + } } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs index 20747767e8a..b209798513d 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs @@ -2,14 +2,48 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Generic; +using System.ComponentModel.Composition; using System.Threading; using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Protocol.Debugging; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -internal abstract class LSPProximityExpressionsProvider +[Export(typeof(ILSPProximityExpressionsProvider))] +[method: ImportingConstructor] +internal class LSPProximityExpressionsProvider( + LSPRequestInvoker requestInvoker, + ILoggerFactory loggerFactory) : ILSPProximityExpressionsProvider { - public abstract Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + public async Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + { + var proximityExpressionsParams = new RazorProximityExpressionsParams() + { + Position = position, + Uri = documentSnapshot.Uri + }; + + var response = await _requestInvoker.ReinvokeRequestOnServerAsync( + documentSnapshot.Snapshot.TextBuffer, + LanguageServerConstants.RazorProximityExpressionsEndpoint, + RazorLSPConstants.RazorLanguageServerName, + proximityExpressionsParams, + cancellationToken).ConfigureAwait(false); + + var languageResponse = response?.Response; + if (languageResponse is null) + { + _logger.LogInformation($"The proximity expressions could not be resolved."); + return null; + } + + return languageResponse.Expressions; + } } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorBreakpointResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs similarity index 64% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorBreakpointResolver.cs rename to src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs index 84dd82b1dea..35a47306657 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorBreakpointResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs @@ -15,52 +15,26 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -[Export(typeof(RazorBreakpointResolver))] -internal class DefaultRazorBreakpointResolver : RazorBreakpointResolver +[Export(typeof(IRazorBreakpointResolver))] +[method: ImportingConstructor] +internal class RazorBreakpointResolver( + FileUriProvider fileUriProvider, + LSPDocumentManager documentManager, + ILSPBreakpointSpanProvider breakpointSpanProvider) : IRazorBreakpointResolver { - private readonly FileUriProvider _fileUriProvider; - private readonly LSPDocumentManager _documentManager; - private readonly LSPBreakpointSpanProvider _breakpointSpanProvider; - private readonly MemoryCache _cache; - - [ImportingConstructor] - public DefaultRazorBreakpointResolver( - FileUriProvider fileUriProvider, - LSPDocumentManager documentManager, - LSPBreakpointSpanProvider breakpointSpanProvider) - { - if (fileUriProvider is null) - { - throw new ArgumentNullException(nameof(fileUriProvider)); - } - - if (documentManager is null) - { - throw new ArgumentNullException(nameof(documentManager)); - } - - if (breakpointSpanProvider is null) - { - throw new ArgumentNullException(nameof(breakpointSpanProvider)); - } + private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); - _fileUriProvider = fileUriProvider; - _documentManager = documentManager; - _breakpointSpanProvider = breakpointSpanProvider; + private readonly FileUriProvider _fileUriProvider = fileUriProvider; + private readonly LSPDocumentManager _documentManager = documentManager; + private readonly ILSPBreakpointSpanProvider _breakpointSpanProvider = breakpointSpanProvider; - // 4 is a magic number that was determined based on the functionality of VisualStudio. Currently when you set or edit a breakpoint - // we get called with two different locations for the same breakpoint. Because of this 2 time call our size must be at least 2, - // we grow it to 4 just to be safe for lesser known scenarios. - _cache = new MemoryCache(sizeLimit: 4); - } + // 4 is a magic number that was determined based on the functionality of VisualStudio. Currently when you set or edit a breakpoint + // we get called with two different locations for the same breakpoint. Because of this 2 time call our size must be at least 2, + // we grow it to 4 just to be safe for lesser known scenarios. + private readonly MemoryCache _cache = new(sizeLimit: 4); - public override async Task TryResolveBreakpointRangeAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken) + public async Task TryResolveBreakpointRangeAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken) { - if (textBuffer is null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - if (!_fileUriProvider.TryGet(textBuffer, out var documentUri)) { // Not an addressable Razor document. Do not allow a breakpoint here. In practice this shouldn't happen, just being defensive. @@ -111,6 +85,4 @@ public DefaultRazorBreakpointResolver( return hostDocumentRange; } - - private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorProximityExpressionResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs similarity index 63% rename from src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorProximityExpressionResolver.cs rename to src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs index 1b129fef497..32583d77b20 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/DefaultRazorProximityExpressionResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs @@ -15,51 +15,25 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -[Export(typeof(RazorProximityExpressionResolver))] -internal class DefaultRazorProximityExpressionResolver : RazorProximityExpressionResolver +[Export(typeof(IRazorProximityExpressionResolver))] +[method: ImportingConstructor] +internal class RazorProximityExpressionResolver( + FileUriProvider fileUriProvider, + LSPDocumentManager documentManager, + ILSPProximityExpressionsProvider proximityExpressionsProvider) : IRazorProximityExpressionResolver { - private readonly FileUriProvider _fileUriProvider; - private readonly LSPDocumentManager _documentManager; - private readonly LSPProximityExpressionsProvider _proximityExpressionsProvider; - private readonly MemoryCache> _cache; - - [ImportingConstructor] - public DefaultRazorProximityExpressionResolver( - FileUriProvider fileUriProvider, - LSPDocumentManager documentManager, - LSPProximityExpressionsProvider proximityExpressionsProvider) - { - if (fileUriProvider is null) - { - throw new ArgumentNullException(nameof(fileUriProvider)); - } - - if (documentManager is null) - { - throw new ArgumentNullException(nameof(documentManager)); - } - - if (proximityExpressionsProvider is null) - { - throw new ArgumentNullException(nameof(proximityExpressionsProvider)); - } + private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); - _fileUriProvider = fileUriProvider; - _documentManager = documentManager; - _proximityExpressionsProvider = proximityExpressionsProvider; + private readonly FileUriProvider _fileUriProvider = fileUriProvider; + private readonly LSPDocumentManager _documentManager = documentManager; + private readonly ILSPProximityExpressionsProvider _proximityExpressionsProvider = proximityExpressionsProvider; - // 10 is a magic number where this effectively represents our ability to cache the last 10 "hit" breakpoint locations - // corresponding proximity expressions which enables us not to go "async" in those re-hit scenarios. - _cache = new MemoryCache>(sizeLimit: 10); - } + // 10 is a magic number where this effectively represents our ability to cache the last 10 "hit" breakpoint locations + // corresponding proximity expressions which enables us not to go "async" in those re-hit scenarios. + private readonly MemoryCache> _cache = new(sizeLimit: 10); - public override async Task?> TryResolveProximityExpressionsAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken) + public async Task?> TryResolveProximityExpressionsAsync(ITextBuffer textBuffer, int lineIndex, int characterIndex, CancellationToken cancellationToken) { - if (textBuffer is null) - { - throw new ArgumentNullException(nameof(textBuffer)); - } - if (!_fileUriProvider.TryGet(textBuffer, out var documentUri)) { // Not an addressable Razor document. Do not allow expression resolution here. In practice this shouldn't happen, just being defensive. @@ -100,10 +74,8 @@ public DefaultRazorProximityExpressionResolver( // Cache range so if we're asked again for this document/line/character we don't have to go async. // Note: If we didn't get any proximity expressions back--likely due to an error--we cache an empty array. - _cache.Set(cacheKey, proximityExpressions ?? Array.Empty()); + _cache.Set(cacheKey, proximityExpressions ?? []); return proximityExpressions; } - - private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorLanguageService_IVsLanguageDebugInfo.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorLanguageService_IVsLanguageDebugInfo.cs index 233def0b2af..4386df4d33b 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorLanguageService_IVsLanguageDebugInfo.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/RazorLanguageService_IVsLanguageDebugInfo.cs @@ -16,16 +16,16 @@ namespace Microsoft.VisualStudio.Razor; internal partial class RazorLanguageService : IVsLanguageDebugInfo { - private readonly RazorBreakpointResolver _breakpointResolver; - private readonly RazorProximityExpressionResolver _proximityExpressionResolver; + private readonly IRazorBreakpointResolver _breakpointResolver; + private readonly IRazorProximityExpressionResolver _proximityExpressionResolver; private readonly ILspServerActivationTracker _lspServerActivationTracker; private readonly IUIThreadOperationExecutor _uiThreadOperationExecutor; private readonly IVsEditorAdaptersFactoryService _editorAdaptersFactory; private readonly JoinableTaskFactory _joinableTaskFactory; public RazorLanguageService( - RazorBreakpointResolver breakpointResolver, - RazorProximityExpressionResolver proximityExpressionResolver, + IRazorBreakpointResolver breakpointResolver, + IRazorProximityExpressionResolver proximityExpressionResolver, ILspServerActivationTracker lspServerActivationTracker, IUIThreadOperationExecutor uiThreadOperationExecutor, IVsEditorAdaptersFactoryService editorAdaptersFactory, diff --git a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs index acb9099758a..6c9708a4f60 100644 --- a/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs +++ b/src/Razor/src/Microsoft.VisualStudio.RazorExtension/RazorPackage.cs @@ -64,8 +64,8 @@ protected override async Task InitializeAsync(CancellationToken cancellationToke container.AddService(typeof(RazorLanguageService), (container, type) => { var componentModel = (IComponentModel)GetGlobalService(typeof(SComponentModel)); - var breakpointResolver = componentModel.GetService(); - var proximityExpressionResolver = componentModel.GetService(); + var breakpointResolver = componentModel.GetService(); + var proximityExpressionResolver = componentModel.GetService(); var uiThreadOperationExecutor = componentModel.GetService(); var editorAdaptersFactory = componentModel.GetService(); var lspServerActivationTracker = componentModel.GetService(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs similarity index 86% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs index f52c195fd07..139aea88ed2 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorBreakpointResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs @@ -19,7 +19,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -public class DefaultRazorBreakpointResolverTest : ToolingTestBase +public class RazorBreakpointResolverTest : ToolingTestBase { private const string ValidBreakpointCSharp = "private int foo = 123;"; private const string InvalidBreakpointCSharp = "private int bar;"; @@ -27,9 +27,9 @@ public class DefaultRazorBreakpointResolverTest : ToolingTestBase private readonly ITextBuffer _csharpTextBuffer; private readonly Uri _documentUri; private readonly Uri _csharpDocumentUri; - private readonly ITextBuffer _hostTextbuffer; + private readonly ITextBuffer _hostTextBuffer; - public DefaultRazorBreakpointResolverTest(ITestOutputHelper testOutput) + public RazorBreakpointResolverTest(ITestOutputHelper testOutput) : base(testOutput) { _documentUri = new Uri("file://C:/path/to/file.razor", UriKind.Absolute); @@ -51,7 +51,7 @@ public class SomeRazorFile {{InvalidBreakpointCSharp}} } """); - _hostTextbuffer = new TestTextBuffer(textBufferSnapshot); + _hostTextBuffer = new TestTextBuffer(textBufferSnapshot); } [Fact] @@ -77,7 +77,7 @@ public async Task TryResolveBreakpointRangeAsync_UnknownRazorDocument_ReturnsNul var resolver = CreateResolverWith(documentManager: documentManager); // Act - var result = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var result = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(result); @@ -94,7 +94,7 @@ public async Task TryResolveBreakpointRangeAsync_UnsynchronizedCSharpDocument_Re var resolver = CreateResolverWith(documentManager: documentManager); // Act - var expressions = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var expressions = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(expressions); @@ -107,7 +107,7 @@ public async Task TryResolveBreakpointRangeAsync_UnprojectedLocation_ReturnsNull var resolver = CreateResolverWith(); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(breakpointRange); @@ -117,11 +117,11 @@ public async Task TryResolveBreakpointRangeAsync_UnprojectedLocation_ReturnsNull public async Task TryResolveBreakpointRangeAsync_NotValidBreakpointLocation_ReturnsNull() { // Arrange - var hostDocumentPosition = GetPosition(InvalidBreakpointCSharp, _hostTextbuffer); + var hostDocumentPosition = GetPosition(InvalidBreakpointCSharp, _hostTextBuffer); var resolver = CreateResolverWith(); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); // Assert Assert.Null(breakpointRange); @@ -131,7 +131,7 @@ public async Task TryResolveBreakpointRangeAsync_NotValidBreakpointLocation_Retu public async Task TryResolveBreakpointRangeAsync_MappableCSharpBreakpointLocation_ReturnsHostBreakpointLocation() { // Arrange - var hostDocumentPosition = GetPosition(ValidBreakpointCSharp, _hostTextbuffer); + var hostDocumentPosition = GetPosition(ValidBreakpointCSharp, _hostTextBuffer); var hostBreakpointRange = VsLspFactory.CreateSingleLineRange(start: hostDocumentPosition, length: ValidBreakpointCSharp.Length); var projectionProvider = new TestLSPBreakpointSpanProvider( _documentUri, @@ -142,25 +142,25 @@ public async Task TryResolveBreakpointRangeAsync_MappableCSharpBreakpointLocatio var resolver = CreateResolverWith(projectionProvider: projectionProvider); // Act - var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextbuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); + var breakpointRange = await resolver.TryResolveBreakpointRangeAsync(_hostTextBuffer, hostDocumentPosition.Line, hostDocumentPosition.Character, DisposalToken); // Assert Assert.Equal(hostBreakpointRange, breakpointRange); } - private RazorBreakpointResolver CreateResolverWith( + private IRazorBreakpointResolver CreateResolverWith( FileUriProvider uriProvider = null, LSPDocumentManager documentManager = null, - LSPBreakpointSpanProvider projectionProvider = null) + ILSPBreakpointSpanProvider projectionProvider = null) { var documentUri = _documentUri; - uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextbuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextbuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); + uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextBuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextBuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); var csharpVirtualDocumentSnapshot = new CSharpVirtualDocumentSnapshot(projectKey: default, _csharpDocumentUri, _csharpTextBuffer.CurrentSnapshot, hostDocumentSyncVersion: 0); LSPDocumentSnapshot documentSnapshot = new TestLSPDocumentSnapshot(_documentUri, 0, csharpVirtualDocumentSnapshot); documentManager ??= Mock.Of(manager => manager.TryGetDocument(_documentUri, out documentSnapshot) == true, MockBehavior.Strict); if (projectionProvider is null) { - projectionProvider = new Mock(MockBehavior.Strict).Object; + projectionProvider = new Mock(MockBehavior.Strict).Object; Mock.Get(projectionProvider) .Setup(projectionProvider => projectionProvider.GetBreakpointSpanAsync( It.IsAny(), @@ -169,7 +169,7 @@ private RazorBreakpointResolver CreateResolverWith( .ReturnsAsync(value: null); } - var razorBreakpointResolver = new DefaultRazorBreakpointResolver(uriProvider, documentManager, projectionProvider); + var razorBreakpointResolver = new RazorBreakpointResolver(uriProvider, documentManager, projectionProvider); return razorBreakpointResolver; } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs similarity index 83% rename from src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs rename to src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs index b107a2fb3fc..33597a4a0d1 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/DefaultRazorProximityExpressionResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs @@ -20,16 +20,16 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -public class DefaultRazorProximityExpressionResolverTest : ToolingTestBase +public class RazorProximityExpressionResolverTest : ToolingTestBase { private readonly string _validProximityExpressionRoot; private readonly string _invalidProximityExpressionRoot; private readonly ITextBuffer _csharpTextBuffer; private readonly Uri _documentUri; private readonly Uri _csharpDocumentUri; - private readonly ITextBuffer _hostTextbuffer; + private readonly ITextBuffer _hostTextBuffer; - public DefaultRazorProximityExpressionResolverTest(ITestOutputHelper testOutput) + public RazorProximityExpressionResolverTest(ITestOutputHelper testOutput) : base(testOutput) { _documentUri = new Uri("file://C:/path/to/file.razor", UriKind.Absolute); @@ -51,7 +51,7 @@ public void Render() _csharpTextBuffer = new TestTextBuffer(csharpTextSnapshot); var textBufferSnapshot = new StringTextSnapshot($$"""@{{{_invalidProximityExpressionRoot}}} @code {{{_validProximityExpressionRoot}}}"""); - _hostTextbuffer = new TestTextBuffer(textBufferSnapshot); + _hostTextBuffer = new TestTextBuffer(textBufferSnapshot); } [Fact] @@ -79,7 +79,7 @@ public async Task TryResolveProximityExpressionsAsync_UnknownRazorDocument_Retur var resolver = CreateResolverWith(documentManager: documentManager); // Act - var result = await resolver.TryResolveProximityExpressionsAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var result = await resolver.TryResolveProximityExpressionsAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(result); @@ -96,25 +96,25 @@ public async Task TryResolveProximityExpressionsAsync_UnsynchronizedCSharpDocume var resolver = CreateResolverWith(documentManager: documentManager); // Act - var expressions = await resolver.TryResolveProximityExpressionsAsync(_hostTextbuffer, lineIndex: 0, characterIndex: 1, DisposalToken); + var expressions = await resolver.TryResolveProximityExpressionsAsync(_hostTextBuffer, lineIndex: 0, characterIndex: 1, DisposalToken); // Assert Assert.Null(expressions); } - private RazorProximityExpressionResolver CreateResolverWith( + private IRazorProximityExpressionResolver CreateResolverWith( FileUriProvider uriProvider = null, LSPDocumentManager documentManager = null) { var documentUri = _documentUri; - uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextbuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextbuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); + uriProvider ??= Mock.Of(provider => provider.TryGet(_hostTextBuffer, out documentUri) == true && provider.TryGet(It.IsNotIn(_hostTextBuffer), out It.Ref.IsAny) == false, MockBehavior.Strict); var csharpVirtualDocumentSnapshot = new CSharpVirtualDocumentSnapshot(projectKey: default, _csharpDocumentUri, _csharpTextBuffer.CurrentSnapshot, hostDocumentSyncVersion: 0); LSPDocumentSnapshot documentSnapshot = new TestLSPDocumentSnapshot(_documentUri, 0, csharpVirtualDocumentSnapshot); documentManager ??= Mock.Of( manager => manager.TryGetDocument(_documentUri, out documentSnapshot) == true, MockBehavior.Strict); - var razorProximityExpressionResolver = new DefaultRazorProximityExpressionResolver( + var razorProximityExpressionResolver = new RazorProximityExpressionResolver( uriProvider, documentManager, TestLSPProximityExpressionProvider.Instance); @@ -122,7 +122,7 @@ private RazorProximityExpressionResolver CreateResolverWith( return razorProximityExpressionResolver; } - private class TestLSPProximityExpressionProvider : LSPProximityExpressionsProvider + private class TestLSPProximityExpressionProvider : ILSPProximityExpressionsProvider { public static readonly TestLSPProximityExpressionProvider Instance = new(); @@ -130,7 +130,7 @@ private TestLSPProximityExpressionProvider() { } - public override Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) { return SpecializedTasks.Null>(); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs index b594365bdd2..f582e72739a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs @@ -15,7 +15,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; -internal class TestLSPBreakpointSpanProvider : LSPBreakpointSpanProvider +internal class TestLSPBreakpointSpanProvider : ILSPBreakpointSpanProvider { private readonly Uri _documentUri; private readonly IReadOnlyDictionary _mappings; @@ -36,7 +36,7 @@ public TestLSPBreakpointSpanProvider(Uri documentUri, IReadOnlyDictionary GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) { if (documentSnapshot.Uri != _documentUri) { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs index 4dd8aa8e590..b4509b4df5f 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RazorLanguageService_IVsLanguageDebugInfoTest.cs @@ -70,7 +70,7 @@ public void ValidateBreakpointLocation_ValidBreakpointRange_ReturnsSOK() { // Arrange var breakpointRange = VsLspFactory.CreateRange(2, 4, 3, 5); - var breakpointResolver = Mock.Of(resolver => resolver.TryResolveBreakpointRangeAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(breakpointRange), MockBehavior.Strict); + var breakpointResolver = Mock.Of(resolver => resolver.TryResolveBreakpointRangeAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(breakpointRange), MockBehavior.Strict); var languageService = CreateLanguageServiceWith(breakpointResolver); // Act @@ -146,7 +146,7 @@ public void GetProximityExpressions_ValidRange_ReturnsSOK() { // Arrange IReadOnlyList expressions = new[] { "something" }; - var resolver = Mock.Of(resolver => resolver.TryResolveProximityExpressionsAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(expressions), MockBehavior.Strict); + var resolver = Mock.Of(resolver => resolver.TryResolveProximityExpressionsAsync(It.IsAny(), 0, 0, It.IsAny()) == System.Threading.Tasks.Task.FromResult(expressions), MockBehavior.Strict); var languageService = CreateLanguageServiceWith(proximityExpressionResolver: resolver); // Act @@ -174,14 +174,14 @@ public void GetProximityExpressions_CanNotCreateDialog_ReturnsEFail() } private RazorLanguageService CreateLanguageServiceWith( - RazorBreakpointResolver breakpointResolver = null, - RazorProximityExpressionResolver proximityExpressionResolver = null, + IRazorBreakpointResolver breakpointResolver = null, + IRazorProximityExpressionResolver proximityExpressionResolver = null, IUIThreadOperationExecutor uiThreadOperationExecutor = null, IVsEditorAdaptersFactoryService editorAdaptersFactory = null) { if (breakpointResolver is null) { - breakpointResolver = new Mock(MockBehavior.Strict).Object; + breakpointResolver = new Mock(MockBehavior.Strict).Object; Mock.Get(breakpointResolver) .Setup(r => r.TryResolveBreakpointRangeAsync( It.IsAny(), @@ -193,7 +193,7 @@ private RazorLanguageService CreateLanguageServiceWith( if (proximityExpressionResolver is null) { - proximityExpressionResolver = new Mock(MockBehavior.Strict).Object; + proximityExpressionResolver = new Mock(MockBehavior.Strict).Object; Mock.Get(proximityExpressionResolver) .Setup(r => r.TryResolveProximityExpressionsAsync( It.IsAny(), From a05f9e64c0dd6834d0599acbe86bdce63f1880be Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 29 Aug 2024 12:26:14 +1000 Subject: [PATCH 194/271] Pass virtual document version through, and validate --- .../Debugging/RazorBreakpointSpanEndpoint.cs | 6 ++++++ .../RazorProximityExpressionsEndpoint.cs | 10 ++++++++-- .../Debugging/RazorBreakpointSpanParams.cs | 3 +++ .../RazorProximityExpressionsParams.cs | 3 +++ .../Debugging/ILSPBreakpointSpanProvider.cs | 2 +- .../ILSPProximityExpressionsProvider.cs | 2 +- .../Debugging/LSPBreakpointSpanProvider.cs | 5 +++-- .../LSPProximityExpressionsProvider.cs | 5 +++-- .../Debugging/RazorBreakpointResolver.cs | 18 +++++------------- .../RazorProximityExpressionResolver.cs | 18 +++++------------- .../Debugging/RazorBreakpointResolverTest.cs | 1 + .../RazorProximityExpressionResolverTest.cs | 2 +- .../Debugging/TestLSPBreakpointSpanProvider.cs | 2 +- 13 files changed, 41 insertions(+), 36 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs index 578010056e2..e2bdd2dc6d3 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorBreakpointSpanEndpoint.cs @@ -39,6 +39,12 @@ public Uri GetTextDocumentIdentifier(RazorBreakpointSpanParams request) return null; } + if (documentContext.Snapshot.Version != request.HostDocumentSyncVersion) + { + // Whether we are being asked about an old version of the C# document, or somehow a future one, we can't rely on the result. + return null; + } + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var hostDocumentIndex = sourceText.GetPosition(request.Position); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs index a908dd8c8e4..525b0059eb9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Debugging/RazorProximityExpressionsEndpoint.cs @@ -21,9 +21,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Debugging; [RazorLanguageServerEndpoint(LanguageServerConstants.RazorProximityExpressionsEndpoint)] internal class RazorProximityExpressionsEndpoint( - IDocumentMappingService documentMappingService, + IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) : IRazorDocumentlessRequestHandler, ITextDocumentIdentifierHandler - { +{ private readonly IDocumentMappingService _documentMappingService = documentMappingService; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); @@ -40,6 +40,12 @@ public Uri GetTextDocumentIdentifier(RazorProximityExpressionsParams request) return null; } + if (documentContext.Snapshot.Version != request.HostDocumentSyncVersion) + { + // Whether we are being asked about an old version of the C# document, or somehow a future one, we can't rely on the result. + return null; + } + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); var sourceText = await documentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); var hostDocumentIndex = sourceText.GetPosition(request.Position); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorBreakpointSpanParams.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorBreakpointSpanParams.cs index f486bc6230f..fdf956fc7f4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorBreakpointSpanParams.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorBreakpointSpanParams.cs @@ -14,4 +14,7 @@ internal class RazorBreakpointSpanParams [JsonPropertyName("position")] public required Position Position { get; init; } + + [JsonPropertyName("hostDocumentSyncVersion")] + public required long HostDocumentSyncVersion { get; init; } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorProximityExpressionsParams.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorProximityExpressionsParams.cs index d56edee55b7..8f20b3ff8ac 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorProximityExpressionsParams.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/Debugging/RazorProximityExpressionsParams.cs @@ -14,4 +14,7 @@ internal class RazorProximityExpressionsParams [JsonPropertyName("position")] public required Position Position { get; init; } + + [JsonPropertyName("hostDocumentSyncVersion")] + public required long HostDocumentSyncVersion { get; init; } } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs index b25618a797b..cdd2d28822a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPBreakpointSpanProvider.cs @@ -10,5 +10,5 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; internal interface ILSPBreakpointSpanProvider { - Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); + Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs index 37ab22b8039..990d58f6db3 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/ILSPProximityExpressionsProvider.cs @@ -11,5 +11,5 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Debugging; internal interface ILSPProximityExpressionsProvider { - Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken); + Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs index cd2b7bd4efd..c8adfc7df4c 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPBreakpointSpanProvider.cs @@ -22,12 +22,13 @@ internal class LSPBreakpointSpanProvider( private readonly LSPRequestInvoker _requestInvoker = requestInvoker; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public async Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { var languageQueryParams = new RazorBreakpointSpanParams() { Position = position, - Uri = documentSnapshot.Uri + Uri = documentSnapshot.Uri, + HostDocumentSyncVersion = hostDocumentSyncVersion }; var response = await _requestInvoker.ReinvokeRequestOnServerAsync( diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs index b209798513d..955dc901129 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/LSPProximityExpressionsProvider.cs @@ -22,12 +22,13 @@ internal class LSPProximityExpressionsProvider( private readonly LSPRequestInvoker _requestInvoker = requestInvoker; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - public async Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public async Task?> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { var proximityExpressionsParams = new RazorProximityExpressionsParams() { Position = position, - Uri = documentSnapshot.Uri + Uri = documentSnapshot.Uri, + HostDocumentSyncVersion = hostDocumentSyncVersion }; var response = await _requestInvoker.ReinvokeRequestOnServerAsync( diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs index 35a47306657..edc30f795f9 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorBreakpointResolver.cs @@ -22,7 +22,7 @@ internal class RazorBreakpointResolver( LSPDocumentManager documentManager, ILSPBreakpointSpanProvider breakpointSpanProvider) : IRazorBreakpointResolver { - private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); + private record CacheKey(Uri DocumentUri, long? HostDocumentSyncVersion, int Line, int Character); private readonly FileUriProvider _fileUriProvider = fileUriProvider; private readonly LSPDocumentManager _documentManager = documentManager; @@ -48,22 +48,14 @@ private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Char } // TODO: Support multiple C# documents per Razor document. - if (!documentSnapshot.TryGetVirtualDocument(out var virtualDocument)) + if (!documentSnapshot.TryGetVirtualDocument(out var virtualDocument) || + virtualDocument.HostDocumentSyncVersion is not { } hostDocumentSyncVersion) { Debug.Fail($"Some how there's no C# document associated with the host Razor document {documentUri.OriginalString} when validating breakpoint locations."); return null; } - if (virtualDocument.HostDocumentSyncVersion != documentSnapshot.Version) - { - // C# document isn't up-to-date with the Razor document. Because VS' debugging tech is synchronous on the UI thread we have to bail. Ideally we'd wait - // for the C# document to become "updated"; however, that'd require the UI thread to see that the C# buffer is updated. Because this call path blocks - // the UI thread the C# document will never update until this path has exited. This means as a user types around the point of interest data may get stale - // but will re-adjust later. - return null; - } - - var cacheKey = new CacheKey(documentSnapshot.Uri, documentSnapshot.Version, lineIndex, characterIndex); + var cacheKey = new CacheKey(documentSnapshot.Uri, virtualDocument.HostDocumentSyncVersion, lineIndex, characterIndex); if (_cache.TryGetValue(cacheKey, out var cachedRange)) { // We've seen this request before, no need to go async. @@ -71,7 +63,7 @@ private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Char } var position = VsLspFactory.CreatePosition(lineIndex, characterIndex); - var hostDocumentRange = await _breakpointSpanProvider.GetBreakpointSpanAsync(documentSnapshot, position, cancellationToken).ConfigureAwait(false); + var hostDocumentRange = await _breakpointSpanProvider.GetBreakpointSpanAsync(documentSnapshot, hostDocumentSyncVersion, position, cancellationToken).ConfigureAwait(false); if (hostDocumentRange is null) { // can't map the position, invalid breakpoint location. diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs index 32583d77b20..143fac97e94 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Debugging/RazorProximityExpressionResolver.cs @@ -22,7 +22,7 @@ internal class RazorProximityExpressionResolver( LSPDocumentManager documentManager, ILSPProximityExpressionsProvider proximityExpressionsProvider) : IRazorProximityExpressionResolver { - private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Character); + private record CacheKey(Uri DocumentUri, long? HostDocumentSyncVersion, int Line, int Character); private readonly FileUriProvider _fileUriProvider = fileUriProvider; private readonly LSPDocumentManager _documentManager = documentManager; @@ -47,22 +47,14 @@ private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Char } // TODO: Support multiple C# documents per Razor document. - if (!documentSnapshot.TryGetVirtualDocument(out var virtualDocument)) + if (!documentSnapshot.TryGetVirtualDocument(out var virtualDocument) || + virtualDocument.HostDocumentSyncVersion is not { } hostDocumentSyncVersion) { Debug.Fail($"Some how there's no C# document associated with the host Razor document {documentUri.OriginalString} when resolving proximity expressions."); return null; } - if (virtualDocument.HostDocumentSyncVersion != documentSnapshot.Version) - { - // C# document isn't up-to-date with the Razor document. Because VS' debugging tech is synchronous on the UI thread we have to bail. Ideally we'd wait - // for the C# document to become "updated"; however, that'd require the UI thread to see that the C# buffer is updated. Because this call path blocks - // the UI thread the C# document will never update until this path has exited. This means as a user types around the point of interest data may get stale - // but will re-adjust later. - return null; - } - - var cacheKey = new CacheKey(documentSnapshot.Uri, documentSnapshot.Version, lineIndex, characterIndex); + var cacheKey = new CacheKey(documentSnapshot.Uri, virtualDocument.HostDocumentSyncVersion, lineIndex, characterIndex); if (_cache.TryGetValue(cacheKey, out var cachedExpressions)) { // We've seen this request before, no need to go async. @@ -70,7 +62,7 @@ private record CacheKey(Uri DocumentUri, int DocumentVersion, int Line, int Char } var position = VsLspFactory.CreatePosition(lineIndex, characterIndex); - var proximityExpressions = await _proximityExpressionsProvider.GetProximityExpressionsAsync(documentSnapshot, position, cancellationToken).ConfigureAwait(false); + var proximityExpressions = await _proximityExpressionsProvider.GetProximityExpressionsAsync(documentSnapshot, hostDocumentSyncVersion, position, cancellationToken).ConfigureAwait(false); // Cache range so if we're asked again for this document/line/character we don't have to go async. // Note: If we didn't get any proximity expressions back--likely due to an error--we cache an empty array. diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs index 139aea88ed2..5116954c420 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorBreakpointResolverTest.cs @@ -164,6 +164,7 @@ private IRazorBreakpointResolver CreateResolverWith( Mock.Get(projectionProvider) .Setup(projectionProvider => projectionProvider.GetBreakpointSpanAsync( It.IsAny(), + It.IsAny(), It.IsAny(), DisposalToken)) .ReturnsAsync(value: null); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs index 33597a4a0d1..23bc07fd62c 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/RazorProximityExpressionResolverTest.cs @@ -130,7 +130,7 @@ private TestLSPProximityExpressionProvider() { } - public Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task> GetProximityExpressionsAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { return SpecializedTasks.Null>(); } diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs index f582e72739a..dc7e3527557 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/LanguageClient/Debugging/TestLSPBreakpointSpanProvider.cs @@ -36,7 +36,7 @@ public TestLSPBreakpointSpanProvider(Uri documentUri, IReadOnlyDictionary GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, Position position, CancellationToken cancellationToken) + public Task GetBreakpointSpanAsync(LSPDocumentSnapshot documentSnapshot, long hostDocumentSyncVersion, Position position, CancellationToken cancellationToken) { if (documentSnapshot.Uri != _documentUri) { From 744e9e32426360e532c821812d738d4a9e972ef8 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 29 Aug 2024 12:27:03 +1000 Subject: [PATCH 195/271] Fix integration tests to validate the change --- .../BreakpointSpanTests.cs | 46 +++++++++++-------- .../InProcess/DebuggerInProcess.cs | 2 +- .../InProcess/RazorProjectSystemInProcess.cs | 39 ++++++++++++++++ 3 files changed, 67 insertions(+), 20 deletions(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs index 81eb2aa6601..7cacf5c1d96 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/BreakpointSpanTests.cs @@ -17,13 +17,15 @@ public async Task SetBreakpoint_FirstCharacter_SpanAdjusts() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync("

@{ var abc = 123; }

", ControlledHangMitigatingCancellationToken); - // Act - await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync("

@{ var abc = 123; }

", ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); - // Assert - await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 7, ControlledHangMitigatingCancellationToken); + Assert.True(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken)); + + Assert.True(await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 7, ControlledHangMitigatingCancellationToken)); } [IdeFact] @@ -34,15 +36,17 @@ public async Task SetBreakpoint_FirstCharacter_InvalidLine() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync(@"

@{ - var abc = 123; -}

", ControlledHangMitigatingCancellationToken); - // Act - var result = await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync(""" +

@{ + var abc = 123; + }

+ """, ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); - // Assert - Assert.False(result); + Assert.False(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 1, character: 1, ControlledHangMitigatingCancellationToken)); } [IdeFact] @@ -53,14 +57,18 @@ public async Task SetBreakpoint_FirstCharacter_ValidLine() // Wait for classifications to indicate Razor LSP is up and running await TestServices.Editor.WaitForComponentClassificationAsync(ControlledHangMitigatingCancellationToken); - await TestServices.Editor.SetTextAsync(@"

@{ - var abc = 123; -}

", ControlledHangMitigatingCancellationToken); - // Act - await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 1, ControlledHangMitigatingCancellationToken); + await TestServices.RazorProjectSystem.WaitForCSharpVirtualDocumentUpdateAsync(RazorProjectConstants.BlazorProjectName, RazorProjectConstants.CounterRazorFile, async () => + { + await TestServices.Editor.SetTextAsync(""" +

@{ + var abc = 123; + }

+ """, ControlledHangMitigatingCancellationToken); + }, ControlledHangMitigatingCancellationToken); + + Assert.True(await TestServices.Debugger.SetBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 1, ControlledHangMitigatingCancellationToken)); - // Assert - await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 4, ControlledHangMitigatingCancellationToken); + Assert.True(await TestServices.Debugger.VerifyBreakpointAsync(RazorProjectConstants.CounterRazorFile, line: 2, character: 5, ControlledHangMitigatingCancellationToken)); } } diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs index d8c08224a56..4d8c7f45290 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/DebuggerInProcess.cs @@ -39,7 +39,7 @@ public async Task VerifyBreakpointAsync(string fileName, int line, int cha foreach (EnvDTE.Breakpoint breakpoint in debugger.Breakpoints) { - if (breakpoint.File == fileName && + if (breakpoint.File.EndsWith(fileName) && breakpoint.FileLine == line && breakpoint.FileColumn == character) { diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs index 04f8659b0f8..98b4f5c7534 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/RazorProjectSystemInProcess.cs @@ -127,4 +127,43 @@ await Helper.RetryAsync(ct => }, TimeSpan.FromMilliseconds(100), cancellationToken); } + + public async Task WaitForCSharpVirtualDocumentUpdateAsync(string projectName, string relativeFilePath, Func updater, CancellationToken cancellationToken) + { + var filePath = await TestServices.SolutionExplorer.GetAbsolutePathForProjectRelativeFilePathAsync(projectName, relativeFilePath, cancellationToken); + + var documentManager = await TestServices.Shell.GetComponentModelServiceAsync(cancellationToken); + + var uri = new Uri(filePath, UriKind.Absolute); + + long? desiredVersion = null; + + await Helper.RetryAsync(async ct => + { + if (documentManager.TryGetDocument(uri, out var snapshot)) + { + if (snapshot.TryGetVirtualDocument(out var virtualDocument)) + { + if (!virtualDocument.ProjectKey.IsUnknown && + virtualDocument.Snapshot.Length > 0) + { + if (desiredVersion is null) + { + desiredVersion = virtualDocument.HostDocumentSyncVersion + 1; + await updater(); + } + else if (virtualDocument.HostDocumentSyncVersion == desiredVersion) + { + return true; + } + } + + return false; + } + } + + return false; + + }, TimeSpan.FromMilliseconds(100), cancellationToken); + } } From ebe38785444605a8354f9a020d00e5622f22444e Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 29 Aug 2024 13:31:43 +1000 Subject: [PATCH 196/271] Update existing tests --- .../RazorBreakpointSpanEndpointTest.cs | 29 ++++++++++++------- .../RazorProximityExpressionsEndpointTest.cs | 5 ++++ 2 files changed, 24 insertions(+), 10 deletions(-) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs index 718cbcfc0d5..7fa3f0ae3e8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorBreakpointSpanEndpointTest.cs @@ -39,7 +39,8 @@ public async Task Handle_UnsupportedDocument_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; codeDocument.SetUnsupported(); var requestContext = CreateRazorRequestContext(documentContext); @@ -64,7 +65,8 @@ public async Task Handle_StartsInHtml_BreakpointMoved() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 14); var requestContext = CreateRazorRequestContext(documentContext); @@ -89,7 +91,8 @@ public async Task Handle_ImplicitExpression_StartsInHtml_BreakpointMoved() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 4, length: 12); var requestContext = CreateRazorRequestContext(documentContext); @@ -114,7 +117,8 @@ public async Task Handle_StartsInHtml_BreakpointMoved_Razor() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 5, length: 14); var requestContext = CreateRazorRequestContext(documentContext); @@ -139,7 +143,8 @@ public async Task Handle_ImplicitExpression_StartsInHtml_BreakpointMoved_Razor() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var expectedRange = VsLspFactory.CreateSingleLineRange(line: 1, character: 4, length: 12); var requestContext = CreateRazorRequestContext(documentContext); @@ -165,7 +170,8 @@ public async Task Handle_StartsInHtml_InvalidBreakpointSpan_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -189,7 +195,8 @@ public async Task Handle_StartInHtml_NoCSharpOnLine_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -216,7 +223,8 @@ public async Task Handle_StartInHtml_NoActualCSharp_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(1, 0) + Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -243,7 +251,8 @@ public async Task Handle_InvalidBreakpointSpan_ReturnsNull() var request = new RazorBreakpointSpanParams() { Uri = documentPath, - Position = VsLspFactory.CreatePosition(2, 0) + Position = VsLspFactory.CreatePosition(2, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -258,7 +267,7 @@ private static RazorCodeDocument CreateCodeDocument(string text, string? fileKin { var sourceDocument = TestRazorSourceDocument.Create(text); var projectEngine = RazorProjectEngine.Create(builder => { }); - var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind ?? FileKinds.Legacy, importSources: default, Array.Empty()); + var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind ?? FileKinds.Legacy, importSources: default, tagHelpers: []); return codeDocument; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs index 66f45a89fc0..092d8731e68 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Debugging/RazorProximityExpressionsEndpointTest.cs @@ -40,6 +40,7 @@ public async Task Handle_UnsupportedDocument_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; codeDocument.SetUnsupported(); var requestContext = CreateRazorRequestContext(documentContext); @@ -65,6 +66,7 @@ public async Task Handle_ReturnsValidExpressions() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 8), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -90,6 +92,7 @@ public async Task Handle_StartsInHtml_ReturnsValidExpressions() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -115,6 +118,7 @@ public async Task Handle_StartInHtml_NoCSharpOnLine_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.CreatePosition(1, 0), + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); @@ -142,6 +146,7 @@ public async Task Handle_InvalidLocation_ReturnsNull() { Uri = documentPath, Position = VsLspFactory.DefaultPosition, + HostDocumentSyncVersion = 0, }; var requestContext = CreateRazorRequestContext(documentContext); From 12f51941849327c7368c65901da01bf7bf2c6890 Mon Sep 17 00:00:00 2001 From: Alex Gavrilov Date: Thu, 29 Aug 2024 11:27:56 -0700 Subject: [PATCH 197/271] Cohosting OnAutoInsert endpoint (#10776) * Factoring out AutoInsertService * Switch non-cohost endpoint to use new AutoInsertService * Adding Remote and OOB AutoInsertService classes and OnAutoInsertProviders * Add common code for capabilities * Add cohost OnAutoInsert endpoint * Parameter rename * Update src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs Co-authored-by: David Wengier * Update src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs Co-authored-by: David Wengier * Update src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/InsertTextEdit.cs Co-authored-by: David Wengier * Fixup after rebase * More post-build cleanup * Move common HTML and C# auto-insert trigger chars per CR suggestion * More cleanup after rebase * Add IOnAutoInsertTiggerCharacterProvider per CR suggestion * Removing trigger characters property from RemoteAutoInsertService per CR suggestion * Switch to using RemoteResponse * Fixup bad resolve after rebase, and extra whitespace in RazorLangaugeServer * Complete capabilities check in CohostingOnAutoInsertEndpoing registration * Change input position type to serializable :LinePosition * Fixing RemoteInsertTextEdit to use properly annotated (for serialization) types only * Support for delegating auto-insert to C# * Fixup after rebase * Fixup AutoClosingTagOnAutoInsertProviderTest tests * Fixinfg up CloseTextTagOnAutoInsertProviderTest tests * Fixing up OnAutoInsertEndpointTest (which also tests the new AutoInsertService) * Fixing duplicate OnAutoInsert handler registration (bad merge after rebate) * Fixes to MEF composition issue and capabilities check - IDocumentMappingService was not needed (and not available via MEF), so removed that - TextDocument does not implmement VSInternalTextDocumentClientCapabilities * Fixing incorrect export type * Minor cleanup per CR suggestions * Switching parameters to RazorCodeDocument and removing async in a lot of places per CR suggestion * Fixing build - removing unneeded using * Fix RemoteAutoInsertService logic to follow existing code (always prefer our own AutoInsertService first) * Check allowed trigger characters before delegating to other languages/servers * Plumbing through actual option values we need and using them * Fixup After Rebase * Consuming RazorFormattingService in remote OnAutoInsert service * Fixing exception in RemoteProjectSnapshot.Configuration Moving GetFormatterCodeDocumentAsync() into IDocumentSnapshot (and implementations of that) to allow eaiser differentiation of behavior in remote (cohosting) case where we don't need to check the flag on Project.Configuration. Also AddUsingStatementsIfNeeded *always* gets called, even in cases when they are not actually needed, so we can't Debug.Fail there. * Switch to PreferHtmlInAttributeValuesDocumentPositionInfoStrategy as the original code does That allows the code insert double-quotes by delegating to HTML language server after attribute name and equals. * Cleanup usings * More usings cleanup * PR feedback - minor cleanup and removal of InsertTextEdit type in favor of VSInternalDocumentOnAutoInsertResponseItem * PR feedback - removing MEF usage from RemoteAdhocWorkspaceFactory, minor cleanup * PR feedback * Type and method renames, minor cleanup per PR feedback * Renaming interface methods, removing unnecessary usage of FrozenSet * Use ImmutableArray to store providers * Switching to bool and out on IAutoInsertService and implementation * Cleaned up document position info calculation per PR feedback * Minor cleanup in RemoteAutoInsertService * Cleanup trigger character calculation in CohostOnAutoInsertEndpoint * Formatting changes, VsLspFactory usage * Revert to MEF DI in RemoteAdhocWorkspaceFactory/RemoteRazorFormattingService * Removing Rolsyn to VS LSP extension methods * Switch to raw strings in tests and minor whitespace cleanup * Rename per PR feedback suggestion to better indicate the purpose * Cleanup formatting code document acquisition per PR feedback Creating IFormattingCodeDocumentProvider service with seprate LSP and Remote implementations to provide code document appropriate for formatting. * Removing redundant assert as compiler is already doing the check * Unnecessary assignment cleanup * Misc PR feedback cleanup * Made GetGeneratedOutputAsync an extension method per PR feedback * Remaining MEF parameter attrivute formatting changes * Last of the PR feedback. * Fixing most unit test failures. Extension methods can't be used for Mock setups, so since I made GetGeneratedOutputAsync() with no parameter an extension method, I had to switch unit tests to use GeGeneratedOutputAsync(It.Any()) * Fixing last 4 unit test failures We still had non-parameter GetGeneratedOutputAsycnc in DocumentSnapshot (even though it wasn't in IDocumentSnapshot) which was getting called internally. That was both messy (since there is now no-parameter extension method on IDocumentSnapshot) and was causing issues in tests --------- Co-authored-by: David Wengier --- eng/targets/Services.props | 1 + .../CloseTextTagOnAutoInsertProvider.cs | 71 -- .../AutoInsert/IOnAutoInsertProvider.cs | 16 - .../AutoInsert/OnAutoInsertEndpoint.cs | 64 +- .../LspFormattingCodeDocumentProvider.cs | 18 + ...ensions.cs => LspInitializationHelpers.cs} | 21 +- .../InlineCompletionEndPoint.cs | 10 +- .../Mapping/RazorLanguageQueryEndpoint.cs | 1 + .../RazorLanguageServer.cs | 17 +- .../AutoClosingTagOnAutoInsertProvider.cs | 94 +- .../AutoInsert/AutoInsertService.cs | 80 ++ .../CloseTextTagOnAutoInsertProvider.cs | 68 ++ .../AutoInsert/IAutoInsertService.cs | 21 + .../AutoInsert/IOnAutoInsertProvider.cs | 17 + .../IOnAutoInsertTriggerCharacterProvider.cs | 9 + .../Formatting/CSharpFormattingPass.cs | 2 +- .../FormattingContentValidationPass.cs | 2 +- .../Formatting/FormattingContext.cs | 48 +- .../FormattingDiagnosticValidationPass.cs | 2 +- .../IFormattingCodeDocumentProvider.cs | 13 + .../Formatting/RazorFormattingService.cs | 24 +- .../ProjectSystem/DocumentSnapshot.cs | 27 +- .../ProjectSystem/IDocumentSnapshot.cs | 2 +- .../IDocumentSnapshotExtensions.cs | 24 +- .../ProjectSystem/ImportDocumentSnapshot.cs | 6 +- .../AutoInsert/RemoteAutoInsertTextEdit.cs | 36 + .../Remote/IRemoteAutoInsertService.cs | 24 + .../Remote/RazorServices.cs | 1 + .../AutoInsert/OOPAutoInsertService.cs | 14 + .../AutoInsert/RemoteAutoInsertService.cs | 212 ++++ .../AutoInsert/RemoteOnAutoInsertProviders.cs | 17 + .../RemoteDocumentMappingService.cs | 1 + .../RemoteCSharpOnTypeFormattingPass.cs | 7 +- .../RemoteFormattingCodeDocumentProvider.cs | 19 + .../Formatting/RemoteFormattingPasses.cs | 30 + .../Formatting/RemoteRazorFormattingPass.cs | 5 +- .../RemoteRazorFormattingService.cs | 22 + .../ProjectSystem/RemoteDocumentSnapshot.cs | 2 +- .../RemoteAdhocWorkspaceFactory.cs | 7 +- .../Cohost/CohostOnAutoInsertEndpoint.cs | 176 +++ ...stOnAutoInsertTriggerCharacterProviders.cs | 16 + .../AutoClosingTagOnAutoInsertProviderTest.cs | 1017 ++++++++--------- .../CloseTextTagOnAutoInsertProviderTest.cs | 45 +- .../OnAutoInsertEndpointTest.NetFx.cs | 71 +- .../AutoInsert/OnAutoInsertEndpointTest.cs | 53 +- .../RazorOnAutoInsertProviderTestBase.cs | 20 +- .../DefaultCSharpCodeActionProviderTest.cs | 2 +- ...TypeAccessibilityCodeActionProviderTest.cs | 2 +- .../Html/DefaultHtmlCodeActionProviderTest.cs | 2 +- ...nentAccessibilityCodeActionProviderTest.cs | 2 +- ...tractToCodeBehindCodeActionProviderTest.cs | 2 +- ...extDocumentUriPresentationEndpointTests.cs | 14 +- .../FormattingContentValidationPassTest.cs | 10 +- .../FormattingDiagnosticValidationPassTest.cs | 8 +- .../Formatting_NetFx/FormattingTestBase.cs | 2 +- .../TestRazorFormattingService.cs | 5 +- .../Hover/HoverServiceTest.cs | 2 +- .../Semantic/SemanticTokensTest.cs | 2 +- .../ProjectSystem/TestDocumentSnapshot.cs | 2 +- .../RazorComponentDefinitionServiceTest.cs | 1 + 60 files changed, 1684 insertions(+), 825 deletions(-) delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs delete mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs create mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs rename src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/{VSInternalServerCapabilitiesExtensions.cs => LspInitializationHelpers.cs} (76%) rename src/Razor/src/{Microsoft.AspNetCore.Razor.LanguageServer => Microsoft.CodeAnalysis.Razor.Workspaces}/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs (74%) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/AutoInsert/RemoteAutoInsertTextEdit.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteAutoInsertService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/OOPAutoInsertService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteOnAutoInsertProviders.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertEndpoint.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertTriggerCharacterProviders.cs diff --git a/eng/targets/Services.props b/eng/targets/Services.props index 6d9d80ecd5e..b2476eab94a 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -28,5 +28,6 @@ + diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs deleted file mode 100644 index f6ff6ff95e1..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/CloseTextTagOnAutoInsertProvider.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System; -using System.Diagnostics; -using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Legacy; -using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Text; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; - -internal sealed class CloseTextTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor) : IOnAutoInsertProvider -{ - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - - public string TriggerCharacter => ">"; - - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) - { - if (!_optionsMonitor.CurrentValue.AutoClosingTags) - { - // We currently only support auto-closing tags our onType formatter. - format = default; - edit = default; - return false; - } - - if (!IsAtTextTag(context, position)) - { - format = default; - edit = default; - return false; - } - - // This is a text tag. - format = InsertTextFormat.Snippet; - edit = VsLspFactory.CreateTextEdit(position, $"$0"); - - return true; - } - - private static bool IsAtTextTag(FormattingContext context, Position position) - { - var syntaxTree = context.CodeDocument.GetSyntaxTree(); - - if (!context.SourceText.TryGetAbsoluteIndex(position, out var absoluteIndex)) - { - return false; - } - - var owner = syntaxTree.Root.FindToken(absoluteIndex - 1); - // Make sure the end tag doesn't already exist - if (owner?.Parent is MarkupStartTagSyntax - { - IsMarkupTransition: true, - Parent: MarkupElementSyntax { EndTag: null } - } startTag) - { - Debug.Assert(string.Equals(startTag.Name.Content, SyntaxConstants.TextTagName, StringComparison.Ordinal), "MarkupTransition that is not a tag."); - - return true; - } - - return false; - } -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs deleted file mode 100644 index d45bfe02d8d..00000000000 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/IOnAutoInsertProvider.cs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Diagnostics.CodeAnalysis; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.VisualStudio.LanguageServer.Protocol; - -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; - -internal interface IOnAutoInsertProvider -{ - string TriggerCharacter { get; } - - bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format); -} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs index cbcef4ece99..93dd2e890e8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/OnAutoInsertEndpoint.cs @@ -2,7 +2,9 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; +using System.Collections.Frozen; using System.Collections.Generic; +using System.Collections.Immutable; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -12,6 +14,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; @@ -26,21 +29,18 @@ internal class OnAutoInsertEndpoint( LanguageServerFeatureOptions languageServerFeatureOptions, IDocumentMappingService documentMappingService, IClientConnection clientConnection, - IEnumerable onAutoInsertProvider, + IAutoInsertService autoInsertService, RazorLSPOptionsMonitor optionsMonitor, IAdhocWorkspaceFactory workspaceFactory, IRazorFormattingService razorFormattingService, ILoggerFactory loggerFactory) : AbstractRazorDelegatingEndpoint(languageServerFeatureOptions, documentMappingService, clientConnection, loggerFactory.GetOrCreateLogger()), ICapabilitiesProvider { - private static readonly HashSet s_htmlAllowedTriggerCharacters = new(StringComparer.Ordinal) { "=", }; - private static readonly HashSet s_cSharpAllowedTriggerCharacters = new(StringComparer.Ordinal) { "'", "/", "\n" }; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly IAdhocWorkspaceFactory _workspaceFactory = workspaceFactory; private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; - private readonly List _onAutoInsertProviders = onAutoInsertProvider.ToList(); + private readonly IAutoInsertService _autoInsertService = autoInsertService; protected override string CustomMessageTarget => CustomMessageNames.RazorOnAutoInsertEndpointName; @@ -53,17 +53,17 @@ internal class OnAutoInsertEndpoint( public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { - var triggerCharacters = _onAutoInsertProviders.Select(provider => provider.TriggerCharacter); + var triggerCharacters = _autoInsertService.TriggerCharacters; if (_languageServerFeatureOptions.SingleServerSupport) { - triggerCharacters = triggerCharacters.Concat(s_htmlAllowedTriggerCharacters).Concat(s_cSharpAllowedTriggerCharacters); + triggerCharacters = [ + .. triggerCharacters, + .. AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters, + .. AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters]; } - serverCapabilities.OnAutoInsertProvider = new VSInternalDocumentOnAutoInsertOptions() - { - TriggerCharacters = triggerCharacters.Distinct().ToArray() - }; + serverCapabilities.EnableOnAutoInsert(triggerCharacters); } protected override async Task TryHandleAsync(VSInternalDocumentOnAutoInsertParams request, RazorRequestContext requestContext, DocumentPositionInfo positionInfo, CancellationToken cancellationToken) @@ -84,36 +84,18 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V var character = request.Character; - using var applicableProviders = new PooledArrayBuilder(); - foreach (var provider in _onAutoInsertProviders) - { - if (provider.TriggerCharacter == character) - { - applicableProviders.Add(provider); - } - } - - if (applicableProviders.Count == 0) + if (_autoInsertService.TryResolveInsertion( + codeDocument, + request.Position, + character, + _optionsMonitor.CurrentValue.AutoClosingTags, + out var insertTextEdit)) { - // There's currently a bug in the LSP platform where other language clients OnAutoInsert trigger characters influence every language clients trigger characters. - // To combat this we need to preemptively return so we don't try having our providers handle characters that they can't. - return null; - } - - var uri = request.TextDocument.Uri; - var position = request.Position; - - using var formattingContext = FormattingContext.Create(uri, documentContext.Snapshot, codeDocument, request.Options, _workspaceFactory); - foreach (var provider in applicableProviders) - { - if (provider.TryResolveInsertion(position, formattingContext, out var textEdit, out var format)) + return new VSInternalDocumentOnAutoInsertResponseItem() { - return new VSInternalDocumentOnAutoInsertResponseItem() - { - TextEdit = textEdit, - TextEditFormat = format, - }; - } + TextEdit = insertTextEdit.TextEdit, + TextEditFormat = insertTextEdit.TextEditFormat, + }; } // No provider could handle the text edit. @@ -130,7 +112,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V if (positionInfo.LanguageKind == RazorLanguageKind.Html) { - if (!s_htmlAllowedTriggerCharacters.Contains(request.Character)) + if (!AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters.Contains(request.Character)) { Logger.LogInformation($"Inapplicable HTML trigger char {request.Character}."); return SpecializedTasks.Null(); @@ -146,7 +128,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } else if (positionInfo.LanguageKind == RazorLanguageKind.CSharp) { - if (!s_cSharpAllowedTriggerCharacters.Contains(request.Character)) + if (!AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters.Contains(request.Character)) { Logger.LogInformation($"Inapplicable C# trigger char {request.Character}."); return SpecializedTasks.Null(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs new file mode 100644 index 00000000000..eaf9bfa091b --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs @@ -0,0 +1,18 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; + +internal sealed class LspFormattingCodeDocumentProvider : IFormattingCodeDocumentProvider +{ + public Task GetCodeDocumentAsync(IDocumentSnapshot snapshot) + { + var useDesignTimeGeneratedOutput = snapshot.Project.Configuration.LanguageServerFlags?.ForceRuntimeCodeGeneration ?? false; + return snapshot.GetGeneratedOutputAsync(useDesignTimeGeneratedOutput); + } +} diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs similarity index 76% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs index cb9f96cecb3..ac141c81680 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/VSInternalServerCapabilitiesExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs @@ -1,12 +1,14 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Collections.Generic; +using System.Linq; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -internal static class VSInternalServerCapabilitiesExtensions +internal static class LspInitializationHelpers { public static void EnableInlayHints(this VSInternalServerCapabilities serverCapabilities) { @@ -65,4 +67,21 @@ public static void EnableMapCodeProvider(this VSInternalServerCapabilities serve { serverCapabilities.MapCodeProvider = true; } + + public static void EnableOnAutoInsert( + this VSInternalServerCapabilities serverCapabilities, + IEnumerable triggerCharacters) + { + serverCapabilities.OnAutoInsertProvider = new VSInternalDocumentOnAutoInsertOptions() + .EnableOnAutoInsert(triggerCharacters); + } + + public static VSInternalDocumentOnAutoInsertOptions EnableOnAutoInsert( + this VSInternalDocumentOnAutoInsertOptions options, + IEnumerable triggerCharacters) + { + options.TriggerCharacters = triggerCharacters.Distinct().ToArray(); + + return options; + } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs index 0993fac51f9..76d61ba0eb8 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/InlineCompletion/InlineCompletionEndPoint.cs @@ -28,6 +28,7 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.InlineCompletion; internal sealed class InlineCompletionEndpoint( IDocumentMappingService documentMappingService, IClientConnection clientConnection, + IFormattingCodeDocumentProvider formattingCodeDocumentProvider, IAdhocWorkspaceFactory adhocWorkspaceFactory, ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider @@ -39,6 +40,7 @@ internal sealed class InlineCompletionEndpoint( private readonly IDocumentMappingService _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); private readonly IClientConnection _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); + private readonly IFormattingCodeDocumentProvider _formattingCodeDocumentProvider = formattingCodeDocumentProvider; private readonly IAdhocWorkspaceFactory _adhocWorkspaceFactory = adhocWorkspaceFactory ?? throw new ArgumentNullException(nameof(adhocWorkspaceFactory)); private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); @@ -123,7 +125,13 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalInlineCompleti continue; } - using var formattingContext = FormattingContext.Create(request.TextDocument.Uri, documentContext.Snapshot, codeDocument, request.Options, _adhocWorkspaceFactory); + using var formattingContext = FormattingContext.Create( + request.TextDocument.Uri, + documentContext.Snapshot, + codeDocument, + request.Options, + _formattingCodeDocumentProvider, + _adhocWorkspaceFactory); if (!TryGetSnippetWithAdjustedIndentation(formattingContext, item.Text, hostDocumentIndex, out var newSnippetText)) { continue; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs index 7c7bc03cc47..2ef39d5ab1f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Mapping/RazorLanguageQueryEndpoint.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index d542644a9c8..d3162a0e5b1 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -14,6 +14,7 @@ using Microsoft.AspNetCore.Razor.LanguageServer.Extensions; using Microsoft.AspNetCore.Razor.LanguageServer.FindAllReferences; using Microsoft.AspNetCore.Razor.LanguageServer.Folding; +using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.LanguageServer.Implementation; using Microsoft.AspNetCore.Razor.LanguageServer.InlayHints; @@ -24,7 +25,9 @@ using Microsoft.AspNetCore.Razor.LanguageServer.SignatureHelp; using Microsoft.AspNetCore.Razor.LanguageServer.WrapWithTag; using Microsoft.AspNetCore.Razor.Telemetry; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.FoldingRanges; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.GoToDefinition; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol.DocumentSymbols; @@ -119,6 +122,8 @@ protected override ILspServices ConstructLspServices() services.AddSingleton(); services.AddSingleton(); + services.AddSingleton(); + var featureOptions = _featureOptions ?? new DefaultLanguageServerFeatureOptions(); services.AddSingleton(featureOptions); @@ -136,12 +141,14 @@ protected override ILspServices ConstructLspServices() services.AddHoverServices(); services.AddTextDocumentServices(featureOptions); - // Auto insert - services.AddSingleton(); - services.AddSingleton(); - if (!featureOptions.UseRazorCohostServer) { + // Auto insert + services.AddSingleton(); + services.AddSingleton(); + + services.AddSingleton(); + // Folding Range Providers services.AddSingleton(); services.AddSingleton(); @@ -178,7 +185,6 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption services.AddTransient(sp => sp.GetRequiredService()); services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); if (!featureOptions.UseRazorCohostServer) { @@ -188,6 +194,7 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption services.AddSingleton(); services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs similarity index 74% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs index ae288e14de1..e5e9febc604 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoClosingTagOnAutoInsertProvider.cs @@ -7,14 +7,13 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Syntax; -using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; +using RazorSyntaxNode = Microsoft.AspNetCore.Razor.Language.Syntax.SyntaxNode; -internal sealed class AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor optionsMonitor) : IOnAutoInsertProvider +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal class AutoClosingTagOnAutoInsertProvider : IOnAutoInsertProvider { // From http://dev.w3.org/html5/spec/Overview.html#elements-0 private static readonly ImmutableHashSet s_voidElements = ImmutableHashSet.Create(StringComparer.OrdinalIgnoreCase, @@ -39,55 +38,58 @@ internal sealed class AutoClosingTagOnAutoInsertProvider(RazorLSPOptionsMonitor private static readonly ImmutableHashSet s_voidElementsCaseSensitive = s_voidElements.WithComparer(StringComparer.Ordinal); - private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; - public string TriggerCharacter => ">"; - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) { - if (!_optionsMonitor.CurrentValue.AutoClosingTags) - { - format = default; - edit = default; - return false; - } + autoInsertEdit = null; - if (!context.SourceText.TryGetAbsoluteIndex(position, out var afterCloseAngleIndex)) + if (!(enableAutoClosingTags + && codeDocument.Source.Text is { } sourceText + && sourceText.TryGetAbsoluteIndex(position, out var afterCloseAngleIndex) + && TryResolveAutoClosingBehavior(codeDocument, afterCloseAngleIndex) is { } tagNameWithClosingBehavior)) { - format = default; - edit = default; return false; } - if (!TryResolveAutoClosingBehavior(context, afterCloseAngleIndex, out var tagName, out var autoClosingBehavior)) + if (tagNameWithClosingBehavior.AutoClosingBehavior == AutoClosingBehavior.EndTag) { - format = default; - edit = default; - return false; - } + var formatForEndTag = InsertTextFormat.Snippet; + var editForEndTag = VsLspFactory.CreateTextEdit(position, $"$0"); - if (autoClosingBehavior == AutoClosingBehavior.EndTag) - { - format = InsertTextFormat.Snippet; - edit = VsLspFactory.CreateTextEdit(position, $"$0"); + autoInsertEdit = new() + { + TextEdit = editForEndTag, + TextEditFormat = formatForEndTag + }; return true; } - Debug.Assert(autoClosingBehavior == AutoClosingBehavior.SelfClosing); + Debug.Assert(tagNameWithClosingBehavior.AutoClosingBehavior == AutoClosingBehavior.SelfClosing); - format = InsertTextFormat.Plaintext; + var format = InsertTextFormat.Plaintext; // Need to replace the `>` with ' />$0' or '/>$0' depending on if there's prefixed whitespace. - var insertionText = char.IsWhiteSpace(context.SourceText[afterCloseAngleIndex - 2]) ? "/" : " /"; - edit = VsLspFactory.CreateTextEdit(position.Line, position.Character - 1, insertionText); + var insertionText = char.IsWhiteSpace(sourceText[afterCloseAngleIndex - 2]) ? "/" : " /"; + var edit = VsLspFactory.CreateTextEdit(position.Line, position.Character - 1, insertionText); + + autoInsertEdit = new() + { + TextEdit = edit, + TextEditFormat = format + }; return true; } - private static bool TryResolveAutoClosingBehavior(FormattingContext context, int afterCloseAngleIndex, [NotNullWhen(true)] out string? name, out AutoClosingBehavior autoClosingBehavior) + private static TagNameWithClosingBehavior? TryResolveAutoClosingBehavior(RazorCodeDocument codeDocument, int afterCloseAngleIndex) { - var syntaxTree = context.CodeDocument.GetSyntaxTree(); + var syntaxTree = codeDocument.GetSyntaxTree(); var closeAngle = syntaxTree.Root.FindToken(afterCloseAngleIndex - 1); if (closeAngle.Parent is MarkupStartTagSyntax @@ -97,19 +99,17 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int } startTag) { var unescapedTagName = startTag.Name.Content; - autoClosingBehavior = InferAutoClosingBehavior(unescapedTagName, caseSensitive: false); + var autoClosingBehavior = InferAutoClosingBehavior(unescapedTagName, caseSensitive: false); if (autoClosingBehavior == AutoClosingBehavior.EndTag && !CouldAutoCloseParentOrSelf(unescapedTagName, htmlElement)) { // Auto-closing behavior is end-tag; however, we already have and end-tag therefore we don't need to do anything! - autoClosingBehavior = default; - name = null; - return false; + return default; } // Finally capture the entire tag name with the potential escape operator. - name = startTag.GetTagNameWithOptionalBang(); - return true; + var name = startTag.GetTagNameWithOptionalBang(); + return new TagNameWithClosingBehavior(name, autoClosingBehavior); } if (closeAngle.Parent is MarkupTagHelperStartTagSyntax @@ -118,9 +118,9 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int Parent: MarkupTagHelperElementSyntax { TagHelperInfo.BindingResult: var binding } tagHelperElement } startTagHelper) { - name = startTagHelper.Name.Content; + var name = startTagHelper.Name.Content; - if (!TryGetTagHelperAutoClosingBehavior(binding, out autoClosingBehavior)) + if (!TryGetTagHelperAutoClosingBehavior(binding, out var autoClosingBehavior)) { autoClosingBehavior = InferAutoClosingBehavior(name, caseSensitive: true); } @@ -128,17 +128,13 @@ private static bool TryResolveAutoClosingBehavior(FormattingContext context, int if (autoClosingBehavior == AutoClosingBehavior.EndTag && !CouldAutoCloseParentOrSelf(name, tagHelperElement)) { // Auto-closing behavior is end-tag; however, we already have and end-tag therefore we don't need to do anything! - autoClosingBehavior = default; - name = null; - return false; + return default; } - return true; + return new TagNameWithClosingBehavior(name, autoClosingBehavior); } - autoClosingBehavior = default; - name = null; - return false; + return default; } private static AutoClosingBehavior InferAutoClosingBehavior(string name, bool caseSensitive) @@ -194,7 +190,7 @@ private static bool TryGetTagHelperAutoClosingBehavior(TagHelperBinding bindingR return false; } - private static bool CouldAutoCloseParentOrSelf(string currentTagName, SyntaxNode node) + private static bool CouldAutoCloseParentOrSelf(string currentTagName, RazorSyntaxNode node) { do { @@ -256,4 +252,6 @@ private enum AutoClosingBehavior EndTag, SelfClosing, } + + private readonly record struct TagNameWithClosingBehavior(string TagName, AutoClosingBehavior AutoClosingBehavior); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs new file mode 100644 index 00000000000..d6b6e3e3a47 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/AutoInsertService.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Frozen; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal class AutoInsertService(IEnumerable onAutoInsertProviders) : IAutoInsertService +{ + private readonly ImmutableArray _onAutoInsertProviders = onAutoInsertProviders.ToImmutableArray(); + + public static FrozenSet HtmlAllowedAutoInsertTriggerCharacters { get; } + = new string[] { "=" }.ToFrozenSet(StringComparer.Ordinal); + public static FrozenSet CSharpAllowedAutoInsertTriggerCharacters { get; } + = new string[] { "'", "/", "\n" }.ToFrozenSet(StringComparer.Ordinal); + + private readonly ImmutableArray _triggerCharacters = CalculateTriggerCharacters(onAutoInsertProviders); + + private static ImmutableArray CalculateTriggerCharacters(IEnumerable onAutoInsertProviders) + { + using var builder = new PooledArrayBuilder(); + using var _ = StringHashSetPool.Ordinal.GetPooledObject(out var set); + foreach (var provider in onAutoInsertProviders) + { + var triggerCharacter = provider.TriggerCharacter; + if (set.Add(triggerCharacter)) + { + builder.Add(triggerCharacter); + } + } + + return builder.DrainToImmutable(); + } + + public ImmutableArray TriggerCharacters => _triggerCharacters; + + public bool TryResolveInsertion( + RazorCodeDocument codeDocument, + Position position, + string character, + bool autoCloseTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? insertTextEdit) + { + using var applicableProviders = new PooledArrayBuilder(capacity: _onAutoInsertProviders.Length); + foreach (var provider in _onAutoInsertProviders) + { + if (provider.TriggerCharacter == character) + { + applicableProviders.Add(provider); + } + } + + if (applicableProviders.Count == 0) + { + // There's currently a bug in the LSP platform where other language clients OnAutoInsert trigger characters influence every language clients trigger characters. + // To combat this we need to preemptively return so we don't try having our providers handle characters that they can't. + insertTextEdit = null; + return false; + } + + foreach (var provider in applicableProviders) + { + if (provider.TryResolveInsertion(position, codeDocument, autoCloseTags, out insertTextEdit)) + { + return true; + } + } + + // No provider could handle the text edit. + insertTextEdit = null; + return false; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs new file mode 100644 index 00000000000..b2a791b6881 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/CloseTextTagOnAutoInsertProvider.cs @@ -0,0 +1,68 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Legacy; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal class CloseTextTagOnAutoInsertProvider : IOnAutoInsertProvider +{ + public string TriggerCharacter => ">"; + + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) + { + if (!(enableAutoClosingTags && IsAtTextTag(codeDocument, position))) + { + autoInsertEdit = null; + return false; + } + + // This is a text tag. + var format = InsertTextFormat.Snippet; + var edit = VsLspFactory.CreateTextEdit(position, $"$0"); + + autoInsertEdit = new() + { + TextEdit = edit, + TextEditFormat = format + }; + + return true; + } + + private static bool IsAtTextTag(RazorCodeDocument codeDocument, Position position) + { + var syntaxTree = codeDocument.GetSyntaxTree(); + + if (!(codeDocument.Source.Text is { } sourceText + && sourceText.TryGetAbsoluteIndex(position, out var absoluteIndex))) + { + return false; + } + + var owner = syntaxTree.Root.FindToken(absoluteIndex - 1); + // Make sure the end tag doesn't already exist + if (owner?.Parent is MarkupStartTagSyntax + { + IsMarkupTransition: true, + Parent: MarkupElementSyntax { EndTag: null } + } startTag) + { + Debug.Assert(string.Equals(startTag.Name.Content, SyntaxConstants.TextTagName, StringComparison.Ordinal), "MarkupTransition that is not a tag."); + + return true; + } + + return false; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs new file mode 100644 index 00000000000..8bad0493d0f --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IAutoInsertService.cs @@ -0,0 +1,21 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IAutoInsertService +{ + ImmutableArray TriggerCharacters { get; } + + bool TryResolveInsertion( + RazorCodeDocument codeDocument, + Position position, + string character, + bool autoCloseTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? insertTextEdit); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs new file mode 100644 index 00000000000..ba6458712a0 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertProvider.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Diagnostics.CodeAnalysis; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IOnAutoInsertProvider : IOnAutoInsertTriggerCharacterProvider +{ + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs new file mode 100644 index 00000000000..cfc1ffbed5e --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/AutoInsert/IOnAutoInsertTriggerCharacterProvider.cs @@ -0,0 +1,9 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Razor.AutoInsert; + +internal interface IOnAutoInsertTriggerCharacterProvider +{ + string TriggerCharacter { get; } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs index e061b305aaf..722b986ffee 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/CSharpFormattingPass.cs @@ -17,7 +17,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class CSharpFormattingPass( +internal class CSharpFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) : CSharpFormattingPassBase(documentMappingService) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs index 7973e9d0df3..0b80da73d28 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContentValidationPass.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class FormattingContentValidationPass( +internal class FormattingContentValidationPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) : FormattingPassBase(documentMappingService) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index e5329eccbc7..bd0fd0db7b7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -21,16 +21,27 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal sealed class FormattingContext : IDisposable { private readonly IAdhocWorkspaceFactory _workspaceFactory; - private Document? _csharpWorkspaceDocument; + private readonly IFormattingCodeDocumentProvider _codeDocumentProvider; + private Document? _csharpWorkspaceDocument; private AdhocWorkspace? _csharpWorkspace; private IReadOnlyList? _formattingSpans; private IReadOnlyDictionary? _indentations; - private FormattingContext(IAdhocWorkspaceFactory workspaceFactory, Uri uri, IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, - bool isFormatOnType, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) + private FormattingContext( + IFormattingCodeDocumentProvider codeDocumentProvider, + IAdhocWorkspaceFactory workspaceFactory, + Uri uri, + IDocumentSnapshot originalSnapshot, + RazorCodeDocument codeDocument, + FormattingOptions options, + bool isFormatOnType, + bool automaticallyAddUsings, + int hostDocumentIndex, + char triggerCharacter) { + _codeDocumentProvider = codeDocumentProvider; _workspaceFactory = workspaceFactory; Uri = uri; OriginalSnapshot = originalSnapshot; @@ -268,11 +279,12 @@ public async Task WithTextAsync(SourceText changedText) var changedSnapshot = OriginalSnapshot.WithText(changedText); - var codeDocument = await changedSnapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(changedSnapshot).ConfigureAwait(false); DEBUG_ValidateComponents(CodeDocument, codeDocument); var newContext = new FormattingContext( + _codeDocumentProvider, _workspaceFactory, Uri, OriginalSnapshot, @@ -309,12 +321,23 @@ public static FormattingContext CreateForOnTypeFormatting( IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, + IFormattingCodeDocumentProvider codeDocumentProvider, IAdhocWorkspaceFactory workspaceFactory, bool automaticallyAddUsings, int hostDocumentIndex, char triggerCharacter) { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: true, automaticallyAddUsings, hostDocumentIndex, triggerCharacter); + return CreateCore( + uri, + originalSnapshot, + codeDocument, + options, + codeDocumentProvider, + workspaceFactory, + isFormatOnType: true, + automaticallyAddUsings, + hostDocumentIndex, + triggerCharacter); } public static FormattingContext Create( @@ -322,9 +345,20 @@ public static FormattingContext Create( IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, + IFormattingCodeDocumentProvider codeDocumentProvider, IAdhocWorkspaceFactory workspaceFactory) { - return CreateCore(uri, originalSnapshot, codeDocument, options, workspaceFactory, isFormatOnType: false, automaticallyAddUsings: false, hostDocumentIndex: 0, triggerCharacter: '\0'); + return CreateCore( + uri, + originalSnapshot, + codeDocument, + options, + codeDocumentProvider, + workspaceFactory, + isFormatOnType: false, + automaticallyAddUsings: false, + hostDocumentIndex: 0, + triggerCharacter: '\0'); } private static FormattingContext CreateCore( @@ -332,6 +366,7 @@ private static FormattingContext CreateCore( IDocumentSnapshot originalSnapshot, RazorCodeDocument codeDocument, FormattingOptions options, + IFormattingCodeDocumentProvider codeDocumentProvider, IAdhocWorkspaceFactory workspaceFactory, bool isFormatOnType, bool automaticallyAddUsings, @@ -367,6 +402,7 @@ private static FormattingContext CreateCore( Debug.Assert(isFormatOnType || (hostDocumentIndex == 0 && triggerCharacter == '\0' && automaticallyAddUsings == false)); var result = new FormattingContext( + codeDocumentProvider, workspaceFactory, uri, originalSnapshot, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs index 64bf765dd73..8515f5ff13b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingDiagnosticValidationPass.cs @@ -15,7 +15,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal sealed class FormattingDiagnosticValidationPass( +internal class FormattingDiagnosticValidationPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) : FormattingPassBase(documentMappingService) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs new file mode 100644 index 00000000000..0d1c25da983 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IFormattingCodeDocumentProvider.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal interface IFormattingCodeDocumentProvider +{ + Task GetCodeDocumentAsync(IDocumentSnapshot snapshot); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 79d03f61986..15ef27643c9 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -21,10 +21,12 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal class RazorFormattingService : IRazorFormattingService { private readonly List _formattingPasses; + private readonly IFormattingCodeDocumentProvider _codeDocumentProvider; private readonly IAdhocWorkspaceFactory _workspaceFactory; public RazorFormattingService( IEnumerable formattingPasses, + IFormattingCodeDocumentProvider codeDocumentProvider, IAdhocWorkspaceFactory workspaceFactory) { if (formattingPasses is null) @@ -33,6 +35,7 @@ public RazorFormattingService( } _formattingPasses = formattingPasses.OrderBy(f => f.Order).ToList(); + _codeDocumentProvider = codeDocumentProvider ?? throw new ArgumentNullException(nameof(codeDocumentProvider)); _workspaceFactory = workspaceFactory ?? throw new ArgumentNullException(nameof(workspaceFactory)); } @@ -42,7 +45,7 @@ public async Task FormatAsync( FormattingOptions options, CancellationToken cancellationToken) { - var codeDocument = await documentContext.Snapshot.GetFormatterCodeDocumentAsync().ConfigureAwait(false); + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(documentContext.Snapshot).ConfigureAwait(false); // Range formatting happens on every paste, and if there are Razor diagnostics in the file // that can make some very bad results. eg, given: @@ -70,7 +73,13 @@ public async Task FormatAsync( var uri = documentContext.Uri; var documentSnapshot = documentContext.Snapshot; var hostDocumentVersion = documentContext.Snapshot.Version; - using var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, _workspaceFactory); + using var context = FormattingContext.Create( + uri, + documentSnapshot, + codeDocument, + options, + _codeDocumentProvider, + _workspaceFactory); var originalText = context.SourceText; var result = new FormattingResult([]); @@ -156,7 +165,16 @@ private async Task ApplyFormattedEditsAsync( var documentSnapshot = documentContext.Snapshot; var uri = documentContext.Uri; var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); - using var context = FormattingContext.CreateForOnTypeFormatting(uri, documentSnapshot, codeDocument, options, _workspaceFactory, automaticallyAddUsings: automaticallyAddUsings, hostDocumentIndex, triggerCharacter); + using var context = FormattingContext.CreateForOnTypeFormatting( + uri, + documentSnapshot, + codeDocument, + options, + _codeDocumentProvider, + _workspaceFactory, + automaticallyAddUsings: automaticallyAddUsings, + hostDocumentIndex, + triggerCharacter); var result = new FormattingResult(formattedEdits, kind); foreach (var pass in _formattingPasses) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs index 00d3e9fa182..7a145bf3ee1 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/DocumentSnapshot.cs @@ -36,12 +36,6 @@ public Task GetTextAsync() public Task GetTextVersionAsync() => State.GetTextVersionAsync(); - public virtual async Task GetGeneratedOutputAsync() - { - var (output, _) = await State.GetGeneratedOutputAndVersionAsync(ProjectInternal, this).ConfigureAwait(false); - return output; - } - public bool TryGetText([NotNullWhen(true)] out SourceText? result) => State.TryGetText(out result); @@ -69,8 +63,27 @@ public IDocumentSnapshot WithText(SourceText text) public async Task GetCSharpSyntaxTreeAsync(CancellationToken cancellationToken) { - var codeDocument = await GetGeneratedOutputAsync().ConfigureAwait(false); + var codeDocument = await GetGeneratedOutputAsync(forceDesignTimeGeneratedOutput: false).ConfigureAwait(false); var csharpText = codeDocument.GetCSharpSourceText(); return CSharpSyntaxTree.ParseText(csharpText, cancellationToken: cancellationToken); } + + public virtual async Task GetGeneratedOutputAsync(bool forceDesignTimeGeneratedOutput) + { + if (forceDesignTimeGeneratedOutput) + { + return await GetDesignTimeGeneratedOutputAsync().ConfigureAwait(false); + } + + var (output, _) = await State.GetGeneratedOutputAndVersionAsync(ProjectInternal, this).ConfigureAwait(false); + return output; + } + + private async Task GetDesignTimeGeneratedOutputAsync() + { + var tagHelpers = await Project.GetTagHelpersAsync(CancellationToken.None).ConfigureAwait(false); + var projectEngine = Project.GetProjectEngine(); + var imports = await DocumentState.GetImportsAsync(this, projectEngine).ConfigureAwait(false); + return await DocumentState.GenerateCodeDocumentAsync(this, projectEngine, imports, tagHelpers, forceRuntimeCodeGeneration: false).ConfigureAwait(false); + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs index 3e226a3eda9..c3e7f78f698 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshot.cs @@ -21,7 +21,7 @@ internal interface IDocumentSnapshot Task GetTextAsync(); Task GetTextVersionAsync(); - Task GetGeneratedOutputAsync(); + Task GetGeneratedOutputAsync(bool forceDesignTimeGeneratedOutput); ///
/// Gets the Roslyn syntax tree for the generated C# for this Razor document diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs index ef8b26ca9e9..6b6ec6a9360 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs @@ -59,29 +59,9 @@ public static bool IsPathCandidateForComponent(this IDocumentSnapshot documentSn return fileName.AsSpan().Equals(path.Span, FilePathComparison.Instance); } - public static Task GetFormatterCodeDocumentAsync(this IDocumentSnapshot documentSnapshot) + public static Task GetGeneratedOutputAsync(this IDocumentSnapshot documentSnapshot) { - var forceRuntimeCodeGeneration = documentSnapshot.Project.Configuration.LanguageServerFlags?.ForceRuntimeCodeGeneration ?? false; - if (!forceRuntimeCodeGeneration) - { - return documentSnapshot.GetGeneratedOutputAsync(); - } - - // if forceRuntimeCodeGeneration is on, GetGeneratedOutputAsync will get runtime code. As of now - // the formatting service doesn't expect the form of code generated to be what the compiler does with - // runtime. For now force usage of design time and avoid the cache. There may be a slight perf hit - // but either the user is typing (which will invalidate the cache) or the user is manually attempting to - // format. We expect formatting to invalidate the cache if it changes things and consider this an - // acceptable overhead for now. - return GetDesignTimeDocumentAsync(documentSnapshot); + return documentSnapshot.GetGeneratedOutputAsync(forceDesignTimeGeneratedOutput: false); } - private static async Task GetDesignTimeDocumentAsync(IDocumentSnapshot documentSnapshot) - { - var project = documentSnapshot.Project; - var tagHelpers = await project.GetTagHelpersAsync(CancellationToken.None).ConfigureAwait(false); - var projectEngine = project.GetProjectEngine(); - var imports = await DocumentState.GetImportsAsync(documentSnapshot, projectEngine).ConfigureAwait(false); - return await DocumentState.GenerateCodeDocumentAsync(documentSnapshot, project.GetProjectEngine(), imports, tagHelpers, false).ConfigureAwait(false); - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs index e77a615ed5c..213a2f2352c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ImportDocumentSnapshot.cs @@ -35,9 +35,6 @@ public ImportDocumentSnapshot(IProjectSnapshot project, RazorProjectItem item) public int Version => 1; - public Task GetGeneratedOutputAsync() - => throw new NotSupportedException(); - public async Task GetTextAsync() { using (var stream = _importItem.Read()) @@ -50,6 +47,9 @@ public async Task GetTextAsync() return _sourceText; } + public Task GetGeneratedOutputAsync(bool _) + => throw new NotSupportedException(); + public Task GetTextVersionAsync() { return Task.FromResult(_version); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/AutoInsert/RemoteAutoInsertTextEdit.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/AutoInsert/RemoteAutoInsertTextEdit.cs new file mode 100644 index 00000000000..faaf69dc274 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Protocol/AutoInsert/RemoteAutoInsertTextEdit.cs @@ -0,0 +1,36 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Runtime.Serialization; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using static Microsoft.VisualStudio.LanguageServer.Protocol.VsLspExtensions; +using static Roslyn.LanguageServer.Protocol.RoslynLspExtensions; +using RoslynInsertTextFormat = Roslyn.LanguageServer.Protocol.InsertTextFormat; + +namespace Microsoft.CodeAnalysis.Razor.Protocol.AutoInsert; + +[DataContract] +internal readonly record struct RemoteAutoInsertTextEdit( + [property: DataMember(Order = 0)] LinePositionSpan LinePositionSpan, + [property: DataMember(Order = 1)] string NewText, + [property: DataMember(Order = 2)] RoslynInsertTextFormat InsertTextFormat) +{ + public static RemoteAutoInsertTextEdit FromLspInsertTextEdit(VSInternalDocumentOnAutoInsertResponseItem edit) + => new ( + edit.TextEdit.Range.ToLinePositionSpan(), + edit.TextEdit.NewText, + (RoslynInsertTextFormat)edit.TextEditFormat); + + public static VSInternalDocumentOnAutoInsertResponseItem ToLspInsertTextEdit(RemoteAutoInsertTextEdit edit) + => new() + { + TextEdit = VsLspFactory.CreateTextEdit(edit.LinePositionSpan, edit.NewText), + TextEditFormat = (InsertTextFormat)edit.InsertTextFormat, + }; + + public override string ToString() + { + return $"({LinePositionSpan}), '{NewText}', {InsertTextFormat}"; + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteAutoInsertService.cs new file mode 100644 index 00000000000..3872965c0f7 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteAutoInsertService.cs @@ -0,0 +1,24 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Text; + +using Response = Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse; + +internal interface IRemoteAutoInsertService +{ + ValueTask GetAutoInsertTextEditAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + LinePosition position, + string character, + bool autoCloseTags, + bool formatOnType, + bool indentWithTabs, + int indentSize, + CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs index b99ef863b7e..558b737d4c4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs @@ -21,6 +21,7 @@ internal static class RazorServices (typeof(IRemoteUriPresentationService), null), (typeof(IRemoteFoldingRangeService), null), (typeof(IRemoteDocumentHighlightService), null), + (typeof(IRemoteAutoInsertService), null), ]; // Internal for testing diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/OOPAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/OOPAutoInsertService.cs new file mode 100644 index 00000000000..6e19d616fcf --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/OOPAutoInsertService.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Composition; +using Microsoft.CodeAnalysis.Razor.AutoInsert; + +namespace Microsoft.CodeAnalysis.Remote.Razor.AutoInsert; + +[Export(typeof(IAutoInsertService)), Shared] +[method: ImportingConstructor] +internal sealed class OOPAutoInsertService([ImportMany] IEnumerable providers) : AutoInsertService(providers) +{ +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs new file mode 100644 index 00000000000..4c009c6b7ad --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs @@ -0,0 +1,212 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Handlers; +using Microsoft.CodeAnalysis.Razor.AutoInsert; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Protocol.AutoInsert; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using Response = Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse; +using RoslynFormattingOptions = Roslyn.LanguageServer.Protocol.FormattingOptions; +using RoslynInsertTextFormat = Roslyn.LanguageServer.Protocol.InsertTextFormat; +using VsLspFormattingOptions = Microsoft.VisualStudio.LanguageServer.Protocol.FormattingOptions; + +namespace Microsoft.CodeAnalysis.Remote.Razor; + +internal sealed class RemoteAutoInsertService(in ServiceArgs args) + : RazorDocumentServiceBase(in args), IRemoteAutoInsertService +{ + internal sealed class Factory : FactoryBase + { + protected override IRemoteAutoInsertService CreateService(in ServiceArgs args) + => new RemoteAutoInsertService(in args); + } + + private readonly IAutoInsertService _autoInsertService = args.ExportProvider.GetExportedValue(); + private readonly IFilePathService _filePathService = args.ExportProvider.GetExportedValue(); + private readonly IRazorFormattingService _razorFormattingService = args.ExportProvider.GetExportedValue(); + + protected override IDocumentPositionInfoStrategy DocumentPositionInfoStrategy => PreferHtmlInAttributeValuesDocumentPositionInfoStrategy.Instance; + + public ValueTask GetAutoInsertTextEditAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + LinePosition linePosition, + string character, + bool autoCloseTags, + bool formatOnType, + bool indentWithTabs, + int indentSize, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => TryResolveInsertionAsync( + context, + linePosition, + character, + autoCloseTags, + formatOnType, + indentWithTabs, + indentSize, + cancellationToken), + cancellationToken); + + private async ValueTask TryResolveInsertionAsync( + RemoteDocumentContext remoteDocumentContext, + LinePosition linePosition, + string character, + bool autoCloseTags, + bool formatOnType, + bool indentWithTabs, + int indentSize, + CancellationToken cancellationToken) + { + var sourceText = await remoteDocumentContext.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + if (!sourceText.TryGetAbsoluteIndex(linePosition, out var index)) + { + return Response.NoFurtherHandling; + } + + var codeDocument = await remoteDocumentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + + // Always try our own service first, regardless of language + // E.g. if ">" is typed for html tag, it's actually our auto-insert provider + // that adds closing tag instead of HTML even though we are in HTML + if (_autoInsertService.TryResolveInsertion( + codeDocument, + VsLspExtensions.ToPosition(linePosition), + character, + autoCloseTags, + out var insertTextEdit)) + { + return Response.Results(RemoteAutoInsertTextEdit.FromLspInsertTextEdit(insertTextEdit)); + } + + var positionInfo = GetPositionInfo(codeDocument, index); + var languageKind = positionInfo.LanguageKind; + + switch (languageKind) + { + case RazorLanguageKind.Razor: + // If we are in Razor and got no edit from our own service, there is nothing else to do + return Response.NoFurtherHandling; + case RazorLanguageKind.Html: + return AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters.Contains(character) + ? Response.CallHtml + : Response.NoFurtherHandling; + case RazorLanguageKind.CSharp: + var mappedPosition = positionInfo.Position.ToLinePosition(); + return await TryResolveInsertionInCSharpAsync( + remoteDocumentContext, + mappedPosition, + character, + formatOnType, + indentWithTabs, + indentSize, + cancellationToken); + default: + Logger.LogError($"Unsupported language {languageKind} in {nameof(RemoteAutoInsertService)}"); + return Response.NoFurtherHandling; + } + } + + private async ValueTask TryResolveInsertionInCSharpAsync( + RemoteDocumentContext remoteDocumentContext, + LinePosition mappedPosition, + string character, + bool formatOnType, + bool indentWithTabs, + int indentSize, + CancellationToken cancellationToken) + { + // Special case for C# where we use AutoInsert for two purposes: + // 1. For XML documentation comments (filling out the template when typing "///") + // 2. For "on type formatting" style behavior, like adjusting indentation when pressing Enter inside empty braces + // + // If users have turned off on-type formatting, they don't want the behavior of number 2, but its impossible to separate + // that out from number 1. Typing "///" could just as easily adjust indentation on some unrelated code higher up in the + // file, which is exactly the behavior users complain about. + // + // Therefore we are just going to no-op if the user has turned off on type formatting. Maybe one day we can make this + // smarter, but at least the user can always turn the setting back on, type their "///", and turn it back off, without + // having to restart VS. Not the worst compromise (hopefully!) + if (!formatOnType) + { + return Response.NoFurtherHandling; + } + + if (!AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters.Contains(character)) + { + return Response.NoFurtherHandling; + } + + var generatedDocument = await remoteDocumentContext.Snapshot.GetGeneratedDocumentAsync().ConfigureAwait(false); + var formattingOptions = new RoslynFormattingOptions() + { + InsertSpaces = !indentWithTabs, + TabSize = indentSize + }; + + var autoInsertResponseItem = await OnAutoInsert.GetOnAutoInsertResponseAsync( + generatedDocument, + mappedPosition, + character, + formattingOptions, + cancellationToken + ); + + if (autoInsertResponseItem is null) + { + return Response.NoFurtherHandling; + } + + var razorFormattingOptions = new VsLspFormattingOptions() + { + InsertSpaces = !indentWithTabs, + TabSize = indentSize + }; + + var vsLspTextEdit = VsLspFactory.CreateTextEdit( + autoInsertResponseItem.TextEdit.Range.ToLinePositionSpan(), + autoInsertResponseItem.TextEdit.NewText); + var mappedEdits = autoInsertResponseItem.TextEditFormat == RoslynInsertTextFormat.Snippet + ? await _razorFormattingService.FormatSnippetAsync( + remoteDocumentContext, + RazorLanguageKind.CSharp, + [vsLspTextEdit], + razorFormattingOptions, + cancellationToken) + .ConfigureAwait(false) + : await _razorFormattingService.FormatOnTypeAsync( + remoteDocumentContext, + RazorLanguageKind.CSharp, + [vsLspTextEdit], + razorFormattingOptions, + hostDocumentIndex: 0, + triggerCharacter: '\0', + cancellationToken) + .ConfigureAwait(false); + + if (mappedEdits is not [{ } edit]) + { + return Response.NoFurtherHandling; + } + + return Response.Results( + new RemoteAutoInsertTextEdit( + edit.Range.ToLinePositionSpan(), + edit.NewText, + autoInsertResponseItem.TextEditFormat)); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteOnAutoInsertProviders.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteOnAutoInsertProviders.cs new file mode 100644 index 00000000000..e619a1aa100 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteOnAutoInsertProviders.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.Razor.AutoInsert; + +namespace Microsoft.CodBeAnalysis.Remote.Razor.AutoInsert; + +[Shared] +[Export(typeof(IOnAutoInsertProvider))] +internal sealed class RemoteAutoClosingTagOnAutoInsertProvider + : AutoClosingTagOnAutoInsertProvider; + +[Shared] +[Export(typeof(IOnAutoInsertProvider))] +internal sealed class RemoteCloseTextTagOnAutoInsertProvider + : CloseTextTagOnAutoInsertProvider; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs index 50fbc2fec25..0d3a170efac 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/DocumentMapping/RemoteDocumentMappingService.cs @@ -9,6 +9,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs index 6d4e33d0af8..638aa40b213 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteCSharpOnTypeFormattingPass.cs @@ -1,7 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Diagnostics; +using System.Composition; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; @@ -13,6 +13,8 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +[Export(typeof(IFormattingPass)), Shared] +[method: ImportingConstructor] internal sealed class RemoteCSharpOnTypeFormattingPass( IDocumentMappingService documentMappingService, ILoggerFactory loggerFactory) @@ -20,7 +22,8 @@ internal sealed class RemoteCSharpOnTypeFormattingPass( { protected override Task AddUsingStatementEditsIfNecessaryAsync(CodeAnalysis.Razor.Formatting.FormattingContext context, RazorCodeDocument codeDocument, SourceText csharpText, TextEdit[] textEdits, SourceText originalTextWithChanges, TextEdit[] finalEdits, CancellationToken cancellationToken) { - Debug.Fail("Implement this when code actions are migrated to cohosting"); + // Implement this when code actions are migrated to cohosting, + // probably will be able to move it back into base class and make that non-abstract. return Task.FromResult(finalEdits); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs new file mode 100644 index 00000000000..92a0ccd1ae6 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs @@ -0,0 +1,19 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; + +[Export(typeof(IFormattingCodeDocumentProvider)), Shared] +internal sealed class RemoteFormattingCodeDocumentProvider : IFormattingCodeDocumentProvider +{ + public Task GetCodeDocumentAsync(IDocumentSnapshot snapshot) + { + return snapshot.GetGeneratedOutputAsync(); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs new file mode 100644 index 00000000000..2ca3bda8a99 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; + +namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; + +[Export(typeof(IFormattingPass)), Shared] +[method: ImportingConstructor] +internal sealed class RemoteCSharpFormattingPass( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) + : CSharpFormattingPass(documentMappingService, loggerFactory); + +[Export(typeof(IFormattingPass)), Shared] +[method: ImportingConstructor] +internal sealed class RemoteFormattingContentValidationPass( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) + : FormattingContentValidationPass(documentMappingService, loggerFactory); + +[Export(typeof(IFormattingPass)), Shared] +[method: ImportingConstructor] +internal sealed class RemoteFormattingDiagnosticValidationPass( + IDocumentMappingService documentMappingService, + ILoggerFactory loggerFactory) + : FormattingDiagnosticValidationPass(documentMappingService, loggerFactory); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs index 500d610a99e..0347e5591c9 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingPass.cs @@ -1,15 +1,18 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Composition; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +[Export(typeof(IFormattingPass)), Shared] +[method: ImportingConstructor] internal sealed class RemoteRazorFormattingPass( IDocumentMappingService documentMappingService) : RazorFormattingPassBase(documentMappingService) { // TODO: properly plumb this through - protected override bool CodeBlockBraceOnNextLine => true; + protected override bool CodeBlockBraceOnNextLine => false; } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs new file mode 100644 index 00000000000..bff121bd4c0 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs @@ -0,0 +1,22 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Composition; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Workspaces; + +namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; + +[Export(typeof(IRazorFormattingService)), Shared] +[method: ImportingConstructor] +internal class RemoteRazorFormattingService( + [ImportMany] IEnumerable formattingPasses, + IFormattingCodeDocumentProvider codeDocumentProvider, + IAdhocWorkspaceFactory adhocWorkspaceFactory) + : RazorFormattingService( + formattingPasses, + codeDocumentProvider, + adhocWorkspaceFactory) +{ +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs index e4e413bc5a6..bf65778cd50 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteDocumentSnapshot.cs @@ -46,7 +46,7 @@ internal class RemoteDocumentSnapshot(TextDocument textDocument, RemoteProjectSn public bool TryGetTextVersion(out VersionStamp result) => _textDocument.TryGetTextVersion(out result); - public async Task GetGeneratedOutputAsync() + public async Task GetGeneratedOutputAsync(bool _) { // TODO: We don't need to worry about locking if we get called from the didOpen/didChange LSP requests, as CLaSP // takes care of that for us, and blocks requests until those are complete. If that doesn't end up happening, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteAdhocWorkspaceFactory.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteAdhocWorkspaceFactory.cs index 232561f871f..9abf7da6394 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteAdhocWorkspaceFactory.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RemoteAdhocWorkspaceFactory.cs @@ -2,20 +2,23 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System.Collections.Immutable; +using System.Composition; using Microsoft.CodeAnalysis.Host; using Microsoft.CodeAnalysis.Razor.Workspaces; namespace Microsoft.CodeAnalysis.Remote.Razor; -internal sealed class RemoteAdhocWorkspaceFactory(HostServices hostServices) : IAdhocWorkspaceFactory +[Export(typeof(IAdhocWorkspaceFactory)), Shared] +internal sealed class RemoteAdhocWorkspaceFactory() : IAdhocWorkspaceFactory { public AdhocWorkspace Create(params IWorkspaceService[] workspaceServices) { workspaceServices ??= []; + var hostServices = RemoteWorkspaceAccessor.GetWorkspace().Services.HostServices; var services = AdhocServices.Create( workspaceServices: workspaceServices.ToImmutableArray(), - languageServices: ImmutableArray.Empty, + languageServices: [], fallbackServices: hostServices); return new AdhocWorkspace(services); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertEndpoint.cs new file mode 100644 index 00000000000..1b90bd110ac --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertEndpoint.cs @@ -0,0 +1,176 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.AutoInsert; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Protocol.AutoInsert; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.LanguageClient.Cohost; +using Microsoft.VisualStudio.Razor.Settings; +using RazorLSPConstants = Microsoft.VisualStudio.Razor.LanguageClient.RazorLSPConstants; +using Response = Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(VSInternalMethods.OnAutoInsertName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostOnAutoInsertEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostOnAutoInsertEndpoint( + IRemoteServiceInvoker remoteServiceInvoker, + IClientSettingsManager clientSettingsManager, +#pragma warning disable RS0030 // Do not use banned APIs + [ImportMany] IEnumerable onAutoInsertTriggerCharacterProviders, +#pragma warning restore RS0030 // Do not use banned APIs + IHtmlDocumentSynchronizer htmlDocumentSynchronizer, + LSPRequestInvoker requestInvoker, + ILoggerFactory loggerFactory) + : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; + private readonly IEnumerable _onAutoInsertTriggerCharacterProviders = onAutoInsertTriggerCharacterProviders; + private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + private readonly ImmutableArray _triggerCharacters = CalculateTriggerChars(onAutoInsertTriggerCharacterProviders); + + private static ImmutableArray CalculateTriggerChars(IEnumerable onAutoInsertTriggerCharacterProviders) + { + var providerTriggerCharacters = onAutoInsertTriggerCharacterProviders.Select((provider) => provider.TriggerCharacter).Distinct(); + + ImmutableArray _triggerCharacters = [ + .. providerTriggerCharacters, + .. AutoInsertService.HtmlAllowedAutoInsertTriggerCharacters, + .. AutoInsertService.CSharpAllowedAutoInsertTriggerCharacters ]; + + return _triggerCharacters; + } + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.SupportsVisualStudioExtensions) + { + return new Registration + { + Method = VSInternalMethods.OnAutoInsertName, + RegisterOptions = new VSInternalDocumentOnAutoInsertOptions() + .EnableOnAutoInsert(_triggerCharacters) + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(VSInternalDocumentOnAutoInsertParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override async Task HandleRequestAsync(VSInternalDocumentOnAutoInsertParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + { + var razorDocument = context.TextDocument.AssumeNotNull(); + + _logger.LogDebug($"Resolving auto-insertion for {razorDocument.FilePath}"); + + var clientSettings = _clientSettingsManager.GetClientSettings(); + var enableAutoClosingTags = clientSettings.AdvancedSettings.AutoClosingTags; + var formatOnType = clientSettings.AdvancedSettings.FormatOnType; + var indentWithTabs = clientSettings.ClientSpaceSettings.IndentWithTabs; + var indentSize = clientSettings.ClientSpaceSettings.IndentSize; + + _logger.LogDebug($"Calling OOP to resolve insertion at {request.Position} invoked by typing '{request.Character}'"); + var data = await _remoteServiceInvoker.TryInvokeAsync( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) + => service.GetAutoInsertTextEditAsync( + solutionInfo, + razorDocument.Id, + request.Position.ToLinePosition(), + request.Character, + enableAutoClosingTags, + formatOnType, + indentWithTabs, + indentSize, + cancellationToken), + cancellationToken).ConfigureAwait(false); + + if (data.Result is { } remoteInsertTextEdit) + { + _logger.LogDebug($"Got insert text edit from OOP {remoteInsertTextEdit}"); + return RemoteAutoInsertTextEdit.ToLspInsertTextEdit(remoteInsertTextEdit); + } + + if (data.StopHandling) + { + return null; + } + + // Got no data but no signal to stop handling + + return await TryResolveHtmlInsertionAsync( + razorDocument, + request, + clientSettings.AdvancedSettings.AutoInsertAttributeQuotes, + cancellationToken) + .ConfigureAwait(false); + } + + private async Task TryResolveHtmlInsertionAsync( + TextDocument razorDocument, + VSInternalDocumentOnAutoInsertParams request, + bool autoInsertAttributeQuotes, + CancellationToken cancellationToken) + { + if (!autoInsertAttributeQuotes && request.Character == "=") + { + // Use Razor setting for auto insert attribute quotes. HTML Server doesn't have a way to pass that + // information along so instead we just don't delegate the request. + _logger.LogTrace($"Not delegating to HTML completion because AutoInsertAttributeQuotes is disabled"); + return null; + } + + var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); + if (htmlDocument is null) + { + return null; + } + + request.TextDocument = request.TextDocument.WithUri(htmlDocument.Uri); + + _logger.LogDebug($"Resolving auto-insertion edit for {htmlDocument.Uri}"); + + var result = await _requestInvoker.ReinvokeRequestOnServerAsync( + htmlDocument.Buffer, + VSInternalMethods.OnAutoInsertName, + RazorLSPConstants.HtmlLanguageServerName, + request, + cancellationToken).ConfigureAwait(false); + + if (result?.Response is null) + { + _logger.LogDebug($"Didn't get insert edit back from Html."); + return null; + } + + return result.Response; + } +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertTriggerCharacterProviders.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertTriggerCharacterProviders.cs new file mode 100644 index 00000000000..84a7207e1cd --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnAutoInsertTriggerCharacterProviders.cs @@ -0,0 +1,16 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.ComponentModel.Composition; +using Microsoft.CodeAnalysis.Razor.AutoInsert; + +namespace Microsoft.VisualStudio.LanguageServices.Razor.LanguageClient.Cohost; + +// These are needed to we can get auto-insert trigger character collection +// during registration of CohostOnAutoInsertProvider without using a remote service + +[Export(typeof(IOnAutoInsertTriggerCharacterProvider))] +internal sealed class CohostAutoClosingTagOnAutoInsertTriggerCharacterProvider : AutoClosingTagOnAutoInsertProvider; + +[Export(typeof(IOnAutoInsertTriggerCharacterProvider))] +internal sealed class CohostCloseTextTagOnAutoInsertTriggerCharacterProvider : CloseTextTagOnAutoInsertProvider; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs index 0e806675535..3eba6dff3fd 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/AutoClosingTagOnAutoInsertProviderTest.cs @@ -3,8 +3,8 @@ using System; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Xunit; using Xunit.Abstractions; using static Microsoft.AspNetCore.Razor.Language.CommonMetadata; @@ -13,8 +13,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.AutoInsert; public class AutoClosingTagOnAutoInsertProviderTest(ITestOutputHelper testOutput) : RazorOnAutoInsertProviderTestBase(testOutput) { - private RazorLSPOptions Options { get; set; } = RazorLSPOptions.Default; - private static TagHelperDescriptor CatchAllTagHelper { get @@ -104,19 +102,18 @@ private static TagHelperDescriptor WithoutEndTagTagHelper public void OnTypeCloseAngle_ConflictingAutoClosingBehaviorsChoosesMostSpecific() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly - -$$ -", -expected: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper, CatchAllTagHelper }); + $$ + """, + expected: """ + @addTagHelper *, TestAssembly + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper, CatchAllTagHelper }); } [Fact] @@ -124,18 +121,18 @@ public void OnTypeCloseAngle_ConflictingAutoClosingBehaviorsChoosesMostSpecific( public void OnTypeCloseAngle_TagHelperAlreadyHasEndTag() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -143,18 +140,18 @@ public void OnTypeCloseAngle_TagHelperAlreadyHasEndTag() public void OnTypeCloseAngle_VoidTagHelperHasEndTag_ShouldStillAutoClose() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputTagHelper }); } [Fact] @@ -162,12 +159,12 @@ public void OnTypeCloseAngle_VoidTagHelperHasEndTag_ShouldStillAutoClose() public void OnTypeCloseAngle_TagAlreadyHasEndTag() { RunAutoInsertTest( -input: @" -
$$
-", -expected: @" -
-"); + input: """ +
$$
+ """, + expected: """ +
+ """); } [Fact] @@ -175,33 +172,33 @@ public void OnTypeCloseAngle_TagAlreadyHasEndTag() public void OnTypeCloseAngle_TagDoesNotAutoCloseOutOfScope() { RunAutoInsertTest( -input: @" -
- @if (true) - { -
$$
- } -", -expected: @" -
- @if (true) - { -
- } -"); + input: """ +
+ @if (true) + { +
$$
+ } + """, + expected: """ +
+ @if (true) + { +
+ } + """); } [Fact] [WorkItem("https://github.com/dotnet/aspnetcore/issues/36125")] - public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillAutoClose() + public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillClose() { RunAutoInsertTest( -input: @" -$$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] @@ -209,18 +206,18 @@ public void OnTypeCloseAngle_VoidTagHasEndTag_ShouldStillAutoClose() public void OnTypeCloseAngle_VoidElementMirroringTagHelper() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputMirroringTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputMirroringTagHelper }); } [Fact] @@ -228,82 +225,82 @@ public void OnTypeCloseAngle_VoidElementMirroringTagHelper() public void OnTypeCloseAngle_VoidHtmlElementCapitalized_SelfCloses() { RunAutoInsertTest( -input: "$$", -expected: "", -fileKind: FileKinds.Legacy, -tagHelpers: Array.Empty()); + input: "$$", + expected: "", + fileKind: FileKinds.Legacy, + tagHelpers: Array.Empty()); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingStructureOverridesVoidTagBehavior() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfclosingInputTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfclosingInputTagHelper }); } [Fact] public void OnTypeCloseAngle_UnspeccifiedStructureInheritsVoidTagBehavior() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedInputTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedInputTagHelper }); } [Fact] public void OnTypeCloseAngle_UnspeccifiedTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedTagHelper }); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -311,24 +308,24 @@ public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure() public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -336,24 +333,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement() public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -361,24 +358,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute() public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -386,24 +383,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithAttribute_SpaceBe public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -411,24 +408,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttrib public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -436,24 +433,24 @@ public void OnTypeCloseAngle_HtmlTagInHtml_NestedStatement_WithMinimalizedAttrib public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -461,24 +458,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute() public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -486,24 +483,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithAttribute_Space public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttribute() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -511,24 +508,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttr public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttribute_SpaceBetweenClosingAngleAndAttributeClosingQuote() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$0
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @if (true) + { +
$0
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] @@ -536,24 +533,24 @@ public void OnTypeCloseAngle_TagHelperInHtml_NestedStatement_WithMinimalizedAttr public void OnTypeCloseAngle_TagHelperInTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); + @if (true) + { + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); } [Fact] @@ -561,24 +558,24 @@ public void OnTypeCloseAngle_TagHelperInTagHelper_NestedStatement() public void OnTypeCloseAngle_TagHelperNextToVoidTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); + @if (true) + { + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, UnspecifiedInputTagHelper }); } [Fact] @@ -586,64 +583,64 @@ public void OnTypeCloseAngle_TagHelperNextToVoidTagHelper_NestedStatement() public void OnTypeCloseAngle_TagHelperNextToTagHelper_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -$0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper, NormalOrSelfclosingInputTagHelper }); + @if (true) + { + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper, NormalOrSelfclosingInputTagHelper }); } [Fact] public void OnTypeCloseAngle_NormalOrSelfClosingTagHelperTagStructure_CodeBlock() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@{ - $$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @{ + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@{ - $0 -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + @{ + $0 + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] public void OnTypeCloseAngle_WithSlash_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] @@ -651,130 +648,130 @@ public void OnTypeCloseAngle_WithSlash_WithoutEndTagTagHelperTagStructure() public void OnTypeCloseAngle_NestedStatement() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
$$
-} -", -expected: @" -@addTagHelper *, TestAssembly + @if (true) + { +
$$
+ } + """, + expected: """ + @addTagHelper *, TestAssembly -@if (true) -{ -
-} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + @if (true) + { +
+ } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithSpace_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithoutEndTagTagHelperTagStructure() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly - -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_WithoutEndTagTagHelperTagStructure_CodeBlock() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -@{ - $$ -} -", -expected: @" -@addTagHelper *, TestAssembly + @{ + $$ + } + """, + expected: """ + @addTagHelper *, TestAssembly -@{ - -} -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { WithoutEndTagTagHelper }); + @{ + + } + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_MultipleApplicableTagHelperTagStructures() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { UnspecifiedTagHelper, NormalOrSelfClosingTagHelper, WithoutEndTagTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { UnspecifiedTagHelper, NormalOrSelfClosingTagHelper, WithoutEndTagTagHelper }); } [Fact] public void OnTypeCloseAngle_EscapedTagTagHelperAutoCompletesWithEscape() { RunAutoInsertTest( -input: @" -@addTagHelper *, TestAssembly + input: """ + @addTagHelper *, TestAssembly -$$ -", -expected: @" -@addTagHelper *, TestAssembly + $$ + """, + expected: """ + @addTagHelper *, TestAssembly -$0 -", -fileKind: FileKinds.Legacy, -tagHelpers: new[] { NormalOrSelfClosingTagHelper }); + $0 + """, + fileKind: FileKinds.Legacy, + tagHelpers: new[] { NormalOrSelfClosingTagHelper }); } [Fact] public void OnTypeCloseAngle_AlwaysClosesStandardHTMLTag() { RunAutoInsertTest( -input: @" -
$$
-", -expected: @" -
$0
-"); + input: """ +
$$
+ """, + expected: """ +
$0
+ """); } [Fact] @@ -782,18 +779,18 @@ public void OnTypeCloseAngle_AlwaysClosesStandardHTMLTag() public void OnTypeCloseAngle_ClosesStandardHTMLTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$

-} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$

+ } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] @@ -801,18 +798,18 @@ public void OnTypeCloseAngle_ClosesStandardHTMLTag_NestedStatement() public void OnTypeCloseAngle_TagNextToTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$

-} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$

+ } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] @@ -820,58 +817,58 @@ public void OnTypeCloseAngle_TagNextToTag_NestedStatement() public void OnTypeCloseAngle_TagNextToVoidTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ -

$$ -} -", -expected: @" -@if (true) -{ -

$0

-} -"); + input: """ + @if (true) + { +

$$ + } + """, + expected: """ + @if (true) + { +

$0

+ } + """); } [Fact] public void OnTypeCloseAngle_ClosesStandardHTMLTag() { RunAutoInsertTest( -input: @" -
$$ -", -expected: @" -
$0
-"); + input: """ +
$$ + """, + expected: """ +
$0
+ """); } [Fact] public void OnTypeCloseAngle_ClosesStandardHTMLTag_CodeBlock() { RunAutoInsertTest( -input: @" -@{ -
$$ -} -", -expected: @" -@{ -
$0
-} -"); + input: """ + @{ +
$$ + } + """, + expected: """ + @{ +
$0
+ } + """); } [Fact] public void OnTypeCloseAngle_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] @@ -879,79 +876,73 @@ public void OnTypeCloseAngle_ClosesVoidHTMLTag() public void OnTypeCloseAngle_ClosesVoidHTMLTag_NestedStatement() { RunAutoInsertTest( -input: @" -@if (true) -{ - $$ -} -", -expected: @" -@if (true) -{ - -} -"); + input: """ + @if (true) + { + $$ + } + """, + expected: """ + @if (true) + { + + } + """); } [Fact] public void OnTypeCloseAngle_ClosesVoidHTMLTag_CodeBlock() { RunAutoInsertTest( -input: @" -@{ - $$ -} -", -expected: @" -@{ - -} -"); + input: """ + @{ + $$ + } + """, + expected: """ + @{ + + } + """); } [Fact] public void OnTypeCloseAngle_WithSlash_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] public void OnTypeCloseAngle_WithSpace_ClosesVoidHTMLTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } [Fact] public void OnTypeCloseAngle_AutoInsertDisabled_Noops() { - Options = RazorLSPOptions.Default with { AutoClosingTags = false }; RunAutoInsertTest( -input: @" -
$$ -", -expected: @" -
-"); + input: """ +
$$ + """, + expected: """ +
+ """, + enableAutoClosingTags: false); } internal override IOnAutoInsertProvider CreateProvider() - { - var configService = StrictMock.Of(); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, Options); - - var provider = new AutoClosingTagOnAutoInsertProvider(optionsMonitor); - return provider; - } + => new AutoClosingTagOnAutoInsertProvider(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs index 18fed07bd85..74b17456c4c 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/CloseTextTagOnAutoInsertProviderTest.cs @@ -1,8 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Xunit; using Xunit.Abstractions; @@ -14,36 +13,30 @@ public class CloseTextTagOnAutoInsertProviderTest(ITestOutputHelper testOutput) public void OnTypeCloseAngle_ClosesTextTag() { RunAutoInsertTest( -input: @" -@{ - $$ -} -", -expected: @" -@{ - $0 -} -"); + input: """ + @{ + $$ + } + """, + expected: """ + @{ + $0 + } + """); } [Fact] public void OnTypeCloseAngle_OutsideRazorBlock_DoesNotCloseTextTag() { RunAutoInsertTest( -input: @" - $$ -", -expected: @" - -"); + input: """ + $$ + """, + expected: """ + + """); } - internal override IOnAutoInsertProvider CreateProvider() - { - var configService = StrictMock.Of(); - var optionsMonitor = new RazorLSPOptionsMonitor(configService, RazorLSPOptions.Default); - - var provider = new CloseTextTagOnAutoInsertProvider(optionsMonitor); - return provider; - } + internal override IOnAutoInsertProvider CreateProvider() => + new CloseTextTagOnAutoInsertProvider(); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs index 26b5acd8561..b5bb61530e2 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.NetFx.cs @@ -5,6 +5,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.Formatting; using Microsoft.AspNetCore.Razor.LanguageServer.Test; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; @@ -27,7 +28,15 @@ public async Task Handle_SingleProvider_InvokesProvider() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -69,7 +78,15 @@ public async Task Handle_MultipleProviderSameTrigger_UsesSuccessful() ResolvedTextEdit = VsLspFactory.CreateTextEdit(position: (0, 0), string.Empty) }; var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider1, insertProvider2]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -114,7 +131,15 @@ public async Task Handle_MultipleProviderSameTrigger_UsesFirstSuccessful() ResolvedTextEdit = VsLspFactory.CreateTextEdit(position: (0, 0), string.Empty) }; var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider1, insertProvider2]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -151,7 +176,15 @@ public async Task Handle_NoApplicableProvider_CallsProviderAndReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -186,7 +219,15 @@ public async Task Handle_OnTypeFormattingOff_Html_CallsLanguageServer() var optionsMonitor = GetOptionsMonitor(formatOnType: false); var insertProvider = new TestOnAutoInsertProvider("<", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -219,7 +260,15 @@ public async Task Handle_AutoInsertAttributeQuotesOff_Html_DoesNotCallLanguageSe var optionsMonitor = GetOptionsMonitor(autoInsertAttributeQuotes: false); var insertProvider = new TestOnAutoInsertProvider("<", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -357,7 +406,15 @@ private async Task VerifyCSharpOnAutoInsertAsync(string input, string expected, var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider("!!!", canResolve: false); var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, formattingService, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + formattingService, + LoggerFactory); var text = codeDocument.Source.Text; var @params = new VSInternalDocumentOnAutoInsertParams() diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs index d5c57f9abff..6811b702468 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/OnAutoInsertEndpointTest.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Test; -using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; using Xunit.Abstractions; @@ -27,7 +27,16 @@ public async Task Handle_MultipleProviderUnmatchingTrigger_ReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider1 = new TestOnAutoInsertProvider(">", canResolve: true); var insertProvider2 = new TestOnAutoInsertProvider("<", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider1, insertProvider2], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var autoInsertService = new AutoInsertService([insertProvider1, insertProvider2]); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + autoInsertService, + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -61,7 +70,15 @@ public async Task Handle_DocumentNotFound_ReturnsNull() var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + null!, + LoggerFactory); var uri = new Uri("file://path/test.razor"); var @params = new VSInternalDocumentOnAutoInsertParams() { @@ -97,7 +114,15 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var optionsMonitor = GetOptionsMonitor(); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: true); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, + TestAdhocWorkspaceFactory.Instance, + razorFormattingService: null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -131,7 +156,14 @@ public async Task Handle_OnTypeFormattingOff_CSharp_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var optionsMonitor = GetOptionsMonitor(formatOnType: false); var insertProvider = new TestOnAutoInsertProvider(">", canResolve: false); - var endpoint = new OnAutoInsertEndpoint(LanguageServerFeatureOptions, DocumentMappingService, languageServer, [insertProvider], optionsMonitor, TestAdhocWorkspaceFactory.Instance, null!, LoggerFactory); + var endpoint = new OnAutoInsertEndpoint( + LanguageServerFeatureOptions, + DocumentMappingService, + languageServer, + new AutoInsertService([insertProvider]), + optionsMonitor, TestAdhocWorkspaceFactory.Instance, + razorFormattingService: null!, + LoggerFactory); var @params = new VSInternalDocumentOnAutoInsertParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -161,12 +193,15 @@ private class TestOnAutoInsertProvider(string triggerCharacter, bool canResolve) public string TriggerCharacter { get; } = triggerCharacter; - // Disabling because [NotNullWhen] is available in two Assemblies and causes warnings - public bool TryResolveInsertion(Position position, FormattingContext context, [NotNullWhen(true)] out TextEdit? edit, out InsertTextFormat format) + public bool TryResolveInsertion( + Position position, + RazorCodeDocument codeDocument, + bool enableAutoClosingTags, + [NotNullWhen(true)] out VSInternalDocumentOnAutoInsertResponseItem? autoInsertEdit) { Called = true; - edit = ResolvedTextEdit!; - format = default; + autoInsertEdit = canResolve ? new() { TextEdit = ResolvedTextEdit!, TextEditFormat = InsertTextFormat.Plaintext } : null; + return canResolve; } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs index 2d77fa619a3..c5e809d705a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/AutoInsert/RazorOnAutoInsertProviderTestBase.cs @@ -6,14 +6,11 @@ using System; using System.Collections.Generic; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.LanguageServer.Test; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.AutoInsert; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; using Xunit; using Xunit.Abstractions; @@ -28,7 +25,7 @@ protected RazorOnAutoInsertProviderTestBase(ITestOutputHelper testOutput) internal abstract IOnAutoInsertProvider CreateProvider(); - protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, bool insertSpaces = true, string fileKind = default, IReadOnlyList tagHelpers = default) + protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, bool insertSpaces = true, bool enableAutoClosingTags = true, string fileKind = default, IReadOnlyList tagHelpers = default) { // Arrange TestFileMarkupParser.GetPosition(input, out input, out var location); @@ -39,23 +36,14 @@ protected void RunAutoInsertTest(string input, string expected, int tabSize = 4, var path = "file:///path/to/document.razor"; var uri = new Uri(path); var codeDocument = CreateCodeDocument(source, uri.AbsolutePath, tagHelpers, fileKind: fileKind); - var options = new FormattingOptions() - { - TabSize = tabSize, - InsertSpaces = insertSpaces, - }; var provider = CreateProvider(); - using var context = FormattingContext.Create(uri, Mock.Of(MockBehavior.Strict), codeDocument, options, TestAdhocWorkspaceFactory.Instance); // Act - if (!provider.TryResolveInsertion(position, context, out var edit, out _)) - { - edit = null; - } + provider.TryResolveInsertion(position, codeDocument, enableAutoClosingTags: enableAutoClosingTags, out var edit); // Assert - var edited = edit is null ? source : ApplyEdit(source, edit); + var edited = edit is null ? source : ApplyEdit(source, edit.TextEdit); var actual = edited.ToString(); Assert.Equal(expected, actual); } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs index bd93514e88f..2f668586916 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/DefaultCSharpCodeActionProviderTest.cs @@ -333,7 +333,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs index 610e0462269..86d1b8239e5 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/CSharp/TypeAccessibilityCodeActionProviderTest.cs @@ -464,7 +464,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs index 297848bba6c..8bcc81013b1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Html/DefaultHtmlCodeActionProviderTest.cs @@ -152,7 +152,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext( var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, FileKinds.Component, importSources: default, tagHelpers); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs index 56874c402da..2a0e033c4b5 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ComponentAccessibilityCodeActionProviderTest.cs @@ -464,7 +464,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP codeDocument.SetCSharpDocument(csharpDocumentWithDiagnostic); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text) && document.Project.GetTagHelpersAsync(It.IsAny()) == new ValueTask>(tagHelpers), MockBehavior.Strict); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs index a0995f885a9..698d462b310 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/CodeActions/Razor/ExtractToCodeBehindCodeActionProviderTest.cs @@ -396,7 +396,7 @@ private static RazorCodeActionContext CreateRazorCodeActionContext(VSCodeActionP codeDocument.SetSyntaxTree(syntaxTree); var documentSnapshot = Mock.Of(document => - document.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + document.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && document.GetTextAsync() == Task.FromResult(codeDocument.Source.Text), MockBehavior.Strict); var sourceText = SourceText.From(text); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs index 52ee2ceb54a..3b814f35d33 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/DocumentPresentation/TextDocumentUriPresentationEndpointTests.cs @@ -216,7 +216,7 @@ public async Task Handle_NoTypeNameIdentifier_ReturnsNull() var builder = TagHelperDescriptorBuilder.Create("MyTagHelper", "MyAssembly"); var tagHelperDescriptor = builder.Build(); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(componentCodeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(componentCodeDocument), MockBehavior.Strict); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); @@ -262,7 +262,7 @@ public async Task Handle_MultipleUris_ReturnsNull() var documentMappingService = Mock.Of( s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var uri = new Uri("file://path/test.razor"); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); @@ -313,7 +313,7 @@ public async Task Handle_NotComponent_ReturnsNull() var documentMappingService = Mock.Of( s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var droppedUri = new Uri("file:///c:/path/MyTagHelper.cshtml"); var uri = new Uri("file://path/test.razor"); @@ -422,7 +422,7 @@ public async Task Handle_CSharp_ReturnsNull() s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.CSharp && s.TryMapToGeneratedDocumentRange(csharpDocument, It.IsAny(), out projectedRange) == true, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var response = (WorkspaceEdit?)null; @@ -466,7 +466,7 @@ public async Task Handle_DocumentNotFound_ReturnsNull() var documentMappingService = Mock.Of( s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var response = (WorkspaceEdit?)null; @@ -511,7 +511,7 @@ public async Task Handle_UnsupportedCodeDocument_ReturnsNull() var documentMappingService = Mock.Of( s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var response = new WorkspaceEdit(); @@ -555,7 +555,7 @@ public async Task Handle_NoUris_ReturnsNull() var documentMappingService = Mock.Of( s => s.GetLanguageKind(codeDocument, It.IsAny(), It.IsAny()) == RazorLanguageKind.Html, MockBehavior.Strict); - var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync() == Task.FromResult(codeDocument), MockBehavior.Strict); + var documentSnapshot = Mock.Of(s => s.GetGeneratedOutputAsync(false) == Task.FromResult(codeDocument), MockBehavior.Strict); var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var response = (WorkspaceEdit?)null; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs index ba5973a36ef..f35c3dffeeb 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingContentValidationPassTest.cs @@ -132,7 +132,13 @@ private static FormattingContext CreateFormattingContext(SourceText source, int InsertSpaces = insertSpaces, }; - var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, TestAdhocWorkspaceFactory.Instance); + var context = FormattingContext.Create( + uri, + documentSnapshot, + codeDocument, + options, + new LspFormattingCodeDocumentProvider(), + TestAdhocWorkspaceFactory.Instance); return context; } @@ -146,7 +152,7 @@ private static (RazorCodeDocument, IDocumentSnapshot) CreateCodeDocumentAndSnaps var documentSnapshot = new Mock(MockBehavior.Strict); documentSnapshot - .Setup(d => d.GetGeneratedOutputAsync()) + .Setup(d => d.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(codeDocument); documentSnapshot .Setup(d => d.TargetPath) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs index 60adc04a1fc..7ca4655ac5e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingDiagnosticValidationPassTest.cs @@ -129,7 +129,13 @@ private static FormattingContext CreateFormattingContext(SourceText source, int InsertSpaces = insertSpaces, }; - var context = FormattingContext.Create(uri, documentSnapshot, codeDocument, options, TestAdhocWorkspaceFactory.Instance); + var context = FormattingContext.Create( + uri, + documentSnapshot, + codeDocument, + options, + new LspFormattingCodeDocumentProvider(), + TestAdhocWorkspaceFactory.Instance); return context; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 62221cac30b..dc8c6ddd2be 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -287,7 +287,7 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA { var documentSnapshot = new Mock(MockBehavior.Strict); documentSnapshot - .Setup(d => d.GetGeneratedOutputAsync()) + .Setup(d => d.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(codeDocument); documentSnapshot .Setup(d => d.FilePath) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 151cfc51df9..21b381771c8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -57,6 +57,9 @@ public static async Task CreateWithFullSupportAsync( new FormattingContentValidationPass(mappingService, loggerFactory), }; - return new RazorFormattingService(passes, TestAdhocWorkspaceFactory.Instance); + return new RazorFormattingService( + passes, + new LspFormattingCodeDocumentProvider(), + TestAdhocWorkspaceFactory.Instance); } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs index 411d6405171..4430868d72e 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Hover/HoverServiceTest.cs @@ -923,7 +923,7 @@ public void Increment(){ var sourceText = SourceText.From(txt); var snapshot = Mock.Of(d => - d.GetGeneratedOutputAsync() == Task.FromResult(codeDocument) && + d.GetGeneratedOutputAsync(It.IsAny()) == Task.FromResult(codeDocument) && d.FilePath == path && d.FileKind == FileKinds.Component && d.GetTextAsync() == Task.FromResult(sourceText) && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs index 748262ec53a..455da63ae60 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Semantic/SemanticTokensTest.cs @@ -937,7 +937,7 @@ private static DocumentContext CreateDocumentContext( .SetupGet(x => x.Project) .Returns(projectSnapshot.Object); documentSnapshotMock - .Setup(x => x.GetGeneratedOutputAsync()) + .Setup(x => x.GetGeneratedOutputAsync(It.IsAny())) .ReturnsAsync(document); documentSnapshotMock .Setup(x => x.GetTextAsync()) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs index 65c0670b26c..645bec36bae 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/ProjectSystem/TestDocumentSnapshot.cs @@ -79,7 +79,7 @@ public TestDocumentSnapshot(ProjectSnapshot projectSnapshot, DocumentState docum public HostDocument HostDocument => State.HostDocument; - public override Task GetGeneratedOutputAsync() + public override Task GetGeneratedOutputAsync(bool _) { if (_codeDocument is null) { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs index 22c43a1a755..041b95c6eee 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/RazorComponentDefinitionServiceTest.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.GoToDefinition; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; From ee83a6b9bbfbb722e6e3ac2eeb3a0f4a996a2977 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 30 Aug 2024 07:38:43 +1000 Subject: [PATCH 198/271] Fixes after merge --- .../Formatting/FormattingContext.cs | 4 +-- .../FormattingDiagnosticValidationPass.cs | 2 +- .../AutoInsert/RemoteAutoInsertService.cs | 21 +++++-------- .../Formatting/RemoteFormattingPasses.cs | 30 ------------------- .../RemoteRazorFormattingService.cs | 13 +++----- .../Formatting_NetFx/FormattingTestBase.cs | 17 +++-------- .../TestRazorFormattingService.cs | 4 ++- 7 files changed, 22 insertions(+), 69 deletions(-) delete mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs index 32233177efd..e0a16ef90d4 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/FormattingContext.cs @@ -313,12 +313,12 @@ public static FormattingContext CreateForOnTypeFormatting( char triggerCharacter) { return new FormattingContext( + codeDocumentProvider, + workspaceFactory, uri, originalSnapshot, codeDocument, options, - codeDocumentProvider, - workspaceFactory, automaticallyAddUsings, hostDocumentIndex, triggerCharacter); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs index a402d6b6c96..c223878de25 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/FormattingDiagnosticValidationPass.cs @@ -13,7 +13,7 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; -internal class FormattingDiagnosticValidationPass(ILoggerFactory loggerFactory) : IFormattingPass +internal sealed class FormattingDiagnosticValidationPass(ILoggerFactory loggerFactory) : IFormattingPass { private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs index 4c009c6b7ad..9793c86b68e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/AutoInsert/RemoteAutoInsertService.cs @@ -19,7 +19,6 @@ using Response = Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse; using RoslynFormattingOptions = Roslyn.LanguageServer.Protocol.FormattingOptions; using RoslynInsertTextFormat = Roslyn.LanguageServer.Protocol.InsertTextFormat; -using VsLspFormattingOptions = Microsoft.VisualStudio.LanguageServer.Protocol.FormattingOptions; namespace Microsoft.CodeAnalysis.Remote.Razor; @@ -171,7 +170,7 @@ private async ValueTask TryResolveInsertionInCSharpAsync( return Response.NoFurtherHandling; } - var razorFormattingOptions = new VsLspFormattingOptions() + var razorFormattingOptions = new RazorFormattingOptions() { InsertSpaces = !indentWithTabs, TabSize = indentSize @@ -180,33 +179,29 @@ private async ValueTask TryResolveInsertionInCSharpAsync( var vsLspTextEdit = VsLspFactory.CreateTextEdit( autoInsertResponseItem.TextEdit.Range.ToLinePositionSpan(), autoInsertResponseItem.TextEdit.NewText); - var mappedEdits = autoInsertResponseItem.TextEditFormat == RoslynInsertTextFormat.Snippet - ? await _razorFormattingService.FormatSnippetAsync( + var mappedEdit = autoInsertResponseItem.TextEditFormat == RoslynInsertTextFormat.Snippet + ? await _razorFormattingService.GetCSharpSnippetFormattingEditAsync( remoteDocumentContext, - RazorLanguageKind.CSharp, [vsLspTextEdit], razorFormattingOptions, cancellationToken) .ConfigureAwait(false) - : await _razorFormattingService.FormatOnTypeAsync( + : await _razorFormattingService.GetSingleCSharpEditAsync( remoteDocumentContext, - RazorLanguageKind.CSharp, - [vsLspTextEdit], + vsLspTextEdit, razorFormattingOptions, - hostDocumentIndex: 0, - triggerCharacter: '\0', cancellationToken) .ConfigureAwait(false); - if (mappedEdits is not [{ } edit]) + if (mappedEdit is null) { return Response.NoFurtherHandling; } return Response.Results( new RemoteAutoInsertTextEdit( - edit.Range.ToLinePositionSpan(), - edit.NewText, + mappedEdit.Range.ToLinePositionSpan(), + mappedEdit.NewText, autoInsertResponseItem.TextEditFormat)); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs deleted file mode 100644 index 2ca3bda8a99..00000000000 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingPasses.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) .NET Foundation. All rights reserved. -// Licensed under the MIT license. See License.txt in the project root for license information. - -using System.Composition; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.Formatting; -using Microsoft.CodeAnalysis.Razor.Logging; - -namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; - -[Export(typeof(IFormattingPass)), Shared] -[method: ImportingConstructor] -internal sealed class RemoteCSharpFormattingPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : CSharpFormattingPass(documentMappingService, loggerFactory); - -[Export(typeof(IFormattingPass)), Shared] -[method: ImportingConstructor] -internal sealed class RemoteFormattingContentValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingContentValidationPass(documentMappingService, loggerFactory); - -[Export(typeof(IFormattingPass)), Shared] -[method: ImportingConstructor] -internal sealed class RemoteFormattingDiagnosticValidationPass( - IDocumentMappingService documentMappingService, - ILoggerFactory loggerFactory) - : FormattingDiagnosticValidationPass(documentMappingService, loggerFactory); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs index bff121bd4c0..7d9344fe3d0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs @@ -1,22 +1,17 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Composition; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Workspaces; namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; [Export(typeof(IRazorFormattingService)), Shared] [method: ImportingConstructor] -internal class RemoteRazorFormattingService( - [ImportMany] IEnumerable formattingPasses, - IFormattingCodeDocumentProvider codeDocumentProvider, - IAdhocWorkspaceFactory adhocWorkspaceFactory) - : RazorFormattingService( - formattingPasses, - codeDocumentProvider, - adhocWorkspaceFactory) +internal class RemoteRazorFormattingService(IFormattingCodeDocumentProvider codeDocumentProvider, IDocumentMappingService documentMappingService, IAdhocWorkspaceFactory adhocWorkspaceFactory, ILoggerFactory loggerFactory) + : RazorFormattingService(codeDocumentProvider, documentMappingService, adhocWorkspaceFactory, loggerFactory) { } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 22d20e22845..8835b479edc 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -25,7 +25,6 @@ using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Settings.Internal; using Moq; using Roslyn.Test.Utilities; using Xunit; @@ -83,14 +82,10 @@ private async Task RunFormattingTestAsync(string input, string expected, int tab var formattingService = await TestRazorFormattingService.CreateWithFullSupportAsync(LoggerFactory, codeDocument, razorLSPOptions); var documentContext = new DocumentContext(uri, documentSnapshot, projectContext: null); - var projectManager = StrictMock.Of(); - var versionCache = new DocumentVersionCache(projectManager); - versionCache.TrackDocumentVersion(documentSnapshot, version: 1); - var client = new FormattingLanguageServerClient(LoggerFactory); client.AddCodeDocument(codeDocument); - var htmlFormatter = new HtmlFormatter(client, versionCache); + var htmlFormatter = new HtmlFormatter(client); var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); // Act @@ -152,14 +147,10 @@ private protected async Task RunOnTypeFormattingTestAsync( } else { - var projectManager = StrictMock.Of(); - var versionCache = new DocumentVersionCache(projectManager); - versionCache.TrackDocumentVersion(documentSnapshot, version: 1); - var client = new FormattingLanguageServerClient(LoggerFactory); client.AddCodeDocument(codeDocument); - var htmlFormatter = new HtmlFormatter(client, versionCache); + var htmlFormatter = new HtmlFormatter(client); var htmlEdits = await htmlFormatter.GetDocumentFormattingEditsAsync(documentSnapshot, uri, options, DisposalToken); edits = await formattingService.GetHtmlOnTypeFormattingEditsAsync(documentContext, htmlEdits, razorOptions, hostDocumentIndex: positionAfterTrigger, triggerCharacter: triggerCharacter, DisposalToken); } @@ -292,7 +283,7 @@ @using Microsoft.AspNetCore.Components.Web ]); var projectEngine = RazorProjectEngine.Create( - new RazorConfiguration(RazorLanguageVersion.Latest, "TestConfiguration", ImmutableArray.Empty, new LanguageServerFlags(forceRuntimeCodeGeneration)), + new RazorConfiguration(RazorLanguageVersion.Latest, "TestConfiguration", Extensions: [], new LanguageServerFlags(forceRuntimeCodeGeneration)), projectFileSystem, builder => { @@ -301,7 +292,7 @@ @using Microsoft.AspNetCore.Components.Web RazorExtensions.Register(builder); }); - var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, ImmutableArray.Create(importsDocument), tagHelpers); + var codeDocument = projectEngine.ProcessDesignTime(sourceDocument, fileKind, [importsDocument], tagHelpers); if (!allowDiagnostics) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs index 01152568edc..fc10917be71 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/TestRazorFormattingService.cs @@ -39,6 +39,8 @@ public static async Task CreateWithFullSupportAsync( await optionsMonitor.UpdateAsync(CancellationToken.None); } - return new RazorFormattingService(mappingService, TestAdhocWorkspaceFactory.Instance, loggerFactory); + var formattingCodeDocumentProvider = new LspFormattingCodeDocumentProvider(); + + return new RazorFormattingService(formattingCodeDocumentProvider, mappingService, TestAdhocWorkspaceFactory.Instance, loggerFactory); } } From 8dc0e5a518bec91e1f84b8132f5cb4d7c506bd03 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 30 Aug 2024 14:55:54 +1000 Subject: [PATCH 199/271] Bump WebTools and remove legacy CLaSP package --- Directory.Packages.props | 2 +- .../FormattingLanguageServerClient.cs | 4 +- .../Formatting_NetFx/WebTools.cs | 61 +++++++++++++------ ...spNetCore.Razor.LanguageServer.Test.csproj | 26 +------- 4 files changed, 49 insertions(+), 44 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 8bfc1b8a0f2..19c6deb856d 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -5,7 +5,7 @@ here should be _ prefixed to indicate that they are not meant to be used outside this file. --> - <_MicrosoftWebToolsPackageVersion>17.9.67-preview-0001 + <_MicrosoftWebToolsPackageVersion>17.11.11-preview-0001 <_MicrosoftVisualStudioShellPackagesVersion>17.11.39721 <_MicrosoftVisualStudioPackagesVersion>17.11.191 <_VisualStudioLanguageServerProtocolVersion>17.12.1-preview diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs index 5c77e198d46..66dc9647845 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs @@ -102,12 +102,12 @@ private async Task CallWebToolsApplyFormattedEd if (!contentTypeService.ContentTypes.Any(t => t.TypeName == HtmlContentTypeDefinition.HtmlContentType)) { - contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, new[] { StandardContentTypeNames.Text }); + contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, [StandardContentTypeNames.Text]); } var textBufferFactoryService = (ITextBufferFactoryService3)exportProvider.GetExportedValue(); var bufferManager = WebTools.BufferManager.New(contentTypeService, textBufferFactoryService, []); - var logger = new ClaspLoggingBridge(_loggerFactory); + var logger = _loggerFactory.GetOrCreateLogger("ApplyFormattedEditsHandler"); var applyFormatEditsHandler = WebTools.ApplyFormatEditsHandler.New(textBufferFactoryService, bufferManager, logger); // Make sure the buffer manager knows about the source document diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs index e29535214fa..ec0430afe16 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs @@ -1,8 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -extern alias LegacyClasp; - using System; using System.Collections.Generic; using System.Collections.Immutable; @@ -10,7 +8,8 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CommonLanguageServerProtocol.Framework; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.VisualStudio.Settings.Internal; using Microsoft.VisualStudio.Text; using Microsoft.VisualStudio.Utilities; using Microsoft.WebTools.Languages.Shared.Editor.Composition; @@ -32,6 +31,7 @@ internal static class WebTools private const string ApplyFormatEditsParamTypeName = "Microsoft.WebTools.Languages.Shared.Editor.LanguageServer.ContainedLanguage.ApplyFormatEditsParam"; private const string ApplyFormatEditsResponseTypeName = "Microsoft.WebTools.Languages.Shared.Editor.LanguageServer.ContainedLanguage.ApplyFormatEditsResponse"; private const string TextChangeTypeName = "Microsoft.WebTools.Languages.Shared.Editor.EditorHelpers.TextChange"; + private const string LspLoggerTypeName = "Microsoft.WebTools.Languages.LanguageServer.Server.Shared.Clasp.LspLogger"; private static Assembly? s_serverAssembly; private static Assembly? s_editorAssembly; @@ -240,29 +240,56 @@ public async Task HandleRequestAsync( public static ApplyFormatEditsHandler New( ITextBufferFactoryService3 textBufferFactoryService, BufferManager bufferManager, - ILspLogger logger) + ILogger logger) { - var instance = CreateInstance(Type, textBufferFactoryService, bufferManager.Instance, new LegacyClaspILspLogger(logger)); + var instance = CreateInstance(Type, textBufferFactoryService, bufferManager.Instance, LspLogger.New(logger).Instance); return new(instance); } + } - /// - /// Wraps the razor logger (from the clasp source package) into the binary clasp logger that webtools uses. - /// - /// - private class LegacyClaspILspLogger(ILspLogger logger) : LegacyClasp.Microsoft.CommonLanguageServerProtocol.Framework.ILspLogger - { - public void LogEndContext(string message, params object[] @params) => logger.LogEndContext(message, @params); + public sealed class LspLogger(object instance) : ReflectedObject(instance) + { + private static Type? s_type; - public void LogError(string message, params object[] @params) => logger.LogError(message, @params); + public static Type Type + => s_type ?? InterlockedOperations.Initialize(ref s_type, + WebTools.GetType(ServerAssembly, LspLoggerTypeName)); - public void LogException(Exception exception, string? message = null, params object[] @params) => logger.LogException(exception, message, @params); + public static RequestContext New(ILogger logger) + { + var instance = CreateInstance(Type, new MicrosoftExtensionsLoggerWrapper(logger)); + return new(instance); + } - public void LogInformation(string message, params object[] @params) => logger.LogInformation(message, @params); + private class MicrosoftExtensionsLoggerWrapper(ILogger logger) : Microsoft.Extensions.Logging.ILogger + { + public IDisposable? BeginScope(TState state) where TState : notnull + { + return NoOpDisposable.Instance; + } - public void LogStartContext(string message, params object[] @params) => logger.LogStartContext(message, @params); + public bool IsEnabled(Microsoft.Extensions.Logging.LogLevel logLevel) + { + return true; + } - public void LogWarning(string message, params object[] @params) => logger.LogWarning(message, @params); + public void Log(Microsoft.Extensions.Logging.LogLevel logLevel, Microsoft.Extensions.Logging.EventId eventId, TState state, Exception? exception, Func formatter) + { + var message = formatter(state, exception); + var level = logLevel switch + { + Microsoft.Extensions.Logging.LogLevel.Trace => LogLevel.Trace, + Microsoft.Extensions.Logging.LogLevel.Debug => LogLevel.Debug, + Microsoft.Extensions.Logging.LogLevel.Information => LogLevel.Information, + Microsoft.Extensions.Logging.LogLevel.Warning => LogLevel.Warning, + Microsoft.Extensions.Logging.LogLevel.Error => LogLevel.Error, + Microsoft.Extensions.Logging.LogLevel.Critical => LogLevel.Critical, + Microsoft.Extensions.Logging.LogLevel.None => LogLevel.None, + _ => throw new NotImplementedException() + }; + + logger.Log(level, message); + } } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj index ab200262e88..b50276628ee 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj @@ -6,18 +6,6 @@ $(DefineConstants);GENERATE_BASELINES $(DefineConstants);__RemoveThisBitTo__GENERATE_BASELINES - - - 4.7.0-1.23178.15 @@ -35,19 +23,9 @@ + - - - - - - - - true - LegacyClasp - - - + From 4d4e9ab735e6d16302e7e248ae7f4485a772dace Mon Sep 17 00:00:00 2001 From: David Barbet Date: Fri, 30 Aug 2024 15:19:30 -0700 Subject: [PATCH 200/271] Update PublishData after VS snap --- eng/config/PublishData.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 0ed6c986efe..17180c95458 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -28,7 +28,7 @@ ], "vsBranch": "main", "vsMajorVersion": 17, - "insertionCreateDraftPR": true, + "insertionCreateDraftPR": false, "insertionTitlePrefix": "[d17.12 P3]" }, "release/dev17.6": { From 3ca44979ccf5fc3d4fad28466e8f589093bfb10c Mon Sep 17 00:00:00 2001 From: David Barbet Date: Fri, 30 Aug 2024 15:34:59 -0700 Subject: [PATCH 201/271] Update PublishData.json --- eng/config/PublishData.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/config/PublishData.json b/eng/config/PublishData.json index 17180c95458..60ddaded238 100644 --- a/eng/config/PublishData.json +++ b/eng/config/PublishData.json @@ -92,7 +92,7 @@ "Shipping", "NonShipping" ], - "vsBranch": "main", + "vsBranch": "rel/d17.12", "vsMajorVersion": 17, "insertionCreateDraftPR": false, "insertionTitlePrefix": "[d17.12 P2]" From 18c310725a019fa9843bf1e07770adac0f39bf0f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 08:15:44 +1000 Subject: [PATCH 202/271] Skip flaky test --- .../RenameTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs index 37e533b0cca..697a10f79a8 100644 --- a/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs +++ b/src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/RenameTests.cs @@ -60,7 +60,7 @@ public async Task Rename_ComponentAttribute_FromCSharpInRazor() await TestServices.Editor.VerifyTextContainsAsync("@ZooperDooper", ControlledHangMitigatingCancellationToken); } - [IdeFact] + [IdeFact(Skip = "https://github.com/dotnet/razor/issues/10820")] public async Task Rename_ComponentAttribute_FromCSharpInCSharp() { // Create the file From cb0ae1321eccd2fa29227199362f679dd0c043db Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:01:37 +1000 Subject: [PATCH 203/271] Move trigger characters and logic to the formatting service So it can be shared --- .../DocumentOnTypeFormattingEndpoint.cs | 48 ++----------------- .../Formatting/IRazorFormattingService.cs | 8 ++++ .../Formatting/RazorFormattingService.cs | 37 ++++++++++++++ .../DocumentOnTypeFormattingEndpointTest.cs | 37 +------------- .../FormattingLanguageServerTestBase.cs | 9 +++- .../RazorFormattingServiceTest.cs | 27 +++++++++++ 6 files changed, 87 insertions(+), 79 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index e72d79f83ce..6568e9deb30 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -15,6 +15,7 @@ using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -36,20 +37,14 @@ internal class DocumentOnTypeFormattingEndpoint( private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); - private static readonly ImmutableArray s_allTriggerCharacters = ["}", ";", "\n", "{"]; - - private static readonly FrozenSet s_csharpTriggerCharacterSet = FrozenSet.ToFrozenSet(["}", ";"], StringComparer.Ordinal); - private static readonly FrozenSet s_htmlTriggerCharacterSet = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"], StringComparer.Ordinal); - private static readonly FrozenSet s_allTriggerCharacterSet = s_allTriggerCharacters.ToFrozenSet(StringComparer.Ordinal); - public bool MutatesSolutionState => false; public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions { - FirstTriggerCharacter = s_allTriggerCharacters[0], - MoreTriggerCharacter = s_allTriggerCharacters.AsSpan()[1..].ToArray(), + FirstTriggerCharacter = RazorFormattingService.AllTriggerCharacters[0], + MoreTriggerCharacter = RazorFormattingService.AllTriggerCharacters.AsSpan()[1..].ToArray(), }; } @@ -74,7 +69,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting return null; } - if (!s_allTriggerCharacterSet.Contains(request.Character)) + if (!RazorFormattingService.AllTriggerCharacterSet.Contains(request.Character)) { _logger.LogWarning($"Unexpected trigger character '{request.Character}'."); return null; @@ -102,24 +97,13 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting return null; } - var triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); - if (triggerCharacterKind is not (RazorLanguageKind.CSharp or RazorLanguageKind.Html)) + if (_razorFormattingService.TryGetOnTypeFormattingTriggerKind(codeDocument, hostDocumentIndex, request.Character, out var triggerCharacterKind)) { - _logger.LogInformation($"Unsupported trigger character language {triggerCharacterKind:G}."); - return null; - } - - if (!IsApplicableTriggerCharacter(request.Character, triggerCharacterKind)) - { - // We were triggered but the trigger character doesn't make sense for the current cursor position. Bail. - _logger.LogInformation($"Unsupported trigger character location."); return null; } cancellationToken.ThrowIfCancellationRequested(); - Debug.Assert(request.Character.Length > 0); - var options = RazorFormattingOptions.From(request.Options, _optionsMonitor.CurrentValue.CodeBlockBraceOnNextLine); TextEdit[] formattedEdits; @@ -147,26 +131,4 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormatting _logger.LogInformation($"Returning {formattedEdits.Length} final formatted results."); return formattedEdits; } - - private static bool IsApplicableTriggerCharacter(string triggerCharacter, RazorLanguageKind languageKind) - { - if (languageKind == RazorLanguageKind.CSharp) - { - return s_csharpTriggerCharacterSet.Contains(triggerCharacter); - } - else if (languageKind == RazorLanguageKind.Html) - { - return s_htmlTriggerCharacterSet.Contains(triggerCharacter); - } - - // Unknown trigger character. - return false; - } - - internal static class TestAccessor - { - public static ImmutableArray GetAllTriggerCharacters() => s_allTriggerCharacters; - public static FrozenSet GetCSharpTriggerCharacterSet() => s_csharpTriggerCharacterSet; - public static FrozenSet GetHtmlTriggerCharacterSet() => s_htmlTriggerCharacterSet; - } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs index 1ad189e90fd..5974e7f18ad 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/IRazorFormattingService.cs @@ -3,7 +3,9 @@ using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; @@ -49,4 +51,10 @@ Task GetCSharpOnTypeFormattingEditsAsync( TextEdit[] csharpEdits, RazorFormattingOptions options, CancellationToken cancellationToken); + + bool TryGetOnTypeFormattingTriggerKind( + RazorCodeDocument codeDocument, + int hostDocumentIndex, + string triggerCharacter, + out RazorLanguageKind triggerCharacterKind); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index d9f012ff881..ea201061f0b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -1,6 +1,8 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; +using System.Collections.Frozen; using System.Collections.Generic; using System.Collections.Immutable; using System.Linq; @@ -11,6 +13,7 @@ using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -20,7 +23,14 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal class RazorFormattingService : IRazorFormattingService { + public static readonly ImmutableArray AllTriggerCharacters = ["}", ";", "\n", "{"]; + public static readonly FrozenSet AllTriggerCharacterSet = AllTriggerCharacters.ToFrozenSet(StringComparer.Ordinal); + + private static readonly FrozenSet s_csharpTriggerCharacterSet = FrozenSet.ToFrozenSet(["}", ";"], StringComparer.Ordinal); + private static readonly FrozenSet s_htmlTriggerCharacterSet = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"], StringComparer.Ordinal); + private readonly IFormattingCodeDocumentProvider _codeDocumentProvider; + private readonly IDocumentMappingService _documentMappingService; private readonly IAdhocWorkspaceFactory _workspaceFactory; private readonly ImmutableArray _documentFormattingPasses; @@ -35,6 +45,7 @@ public RazorFormattingService( ILoggerFactory loggerFactory) { _codeDocumentProvider = codeDocumentProvider; + _documentMappingService = documentMappingService; _workspaceFactory = workspaceFactory; _htmlOnTypeFormattingPass = new HtmlOnTypeFormattingPass(loggerFactory); @@ -185,6 +196,26 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume return razorEdits.SingleOrDefault(); } + public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) + { + triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); + if (triggerCharacterKind is not (RazorLanguageKind.CSharp or RazorLanguageKind.Html)) + { + return false; + } + + if (triggerCharacterKind == RazorLanguageKind.CSharp) + { + return s_csharpTriggerCharacterSet.Contains(triggerCharacter); + } + else if (triggerCharacterKind == RazorLanguageKind.Html) + { + return s_htmlTriggerCharacterSet.Contains(triggerCharacter); + } + + return true; + } + private async Task ApplyFormattedEditsAsync( DocumentContext documentContext, TextEdit[] generatedDocumentEdits, @@ -279,4 +310,10 @@ private static void UnwrapCSharpSnippets(TextEdit[] razorEdits) edit.NewText = edit.NewText.Replace("/*$0*/", "$0"); } } + + internal static class TestAccessor + { + public static FrozenSet GetCSharpTriggerCharacterSet() => s_csharpTriggerCharacterSet; + public static FrozenSet GetHtmlTriggerCharacterSet() => s_htmlTriggerCharacterSet; + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 776cb9a2957..5448d383abf 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -2,8 +2,6 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; @@ -19,37 +17,6 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; public class DocumentOnTypeFormattingEndpointTest(ITestOutputHelper testOutput) : FormattingLanguageServerTestBase(testOutput) { - [Fact] - public void AllTriggerCharacters_IncludesCSharpTriggerCharacters() - { - var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); - - foreach (var character in DocumentOnTypeFormattingEndpoint.TestAccessor.GetCSharpTriggerCharacterSet()) - { - Assert.Contains(character, allChars); - } - } - - [Fact] - public void AllTriggerCharacters_IncludesHtmlTriggerCharacters() - { - var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); - - foreach (var character in DocumentOnTypeFormattingEndpoint.TestAccessor.GetHtmlTriggerCharacterSet()) - { - Assert.Contains(character, allChars); - } - } - - [Fact] - public void AllTriggerCharacters_ContainsUniqueCharacters() - { - var allChars = DocumentOnTypeFormattingEndpoint.TestAccessor.GetAllTriggerCharacters(); - var distinctChars = allChars.Distinct().ToArray(); - - Assert.Equal(distinctChars, allChars); - } - [Fact] public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() { @@ -154,7 +121,7 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var formattingService = new DummyRazorFormattingService(); + var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Html); var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html); @@ -190,7 +157,7 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() var uri = new Uri("file://path/test.razor"); var documentContext = CreateDocumentContext(uri, codeDocument); - var formattingService = new DummyRazorFormattingService(); + var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Razor); var documentMappingService = new Mock(MockBehavior.Strict); documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor); diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index bf6ce5a569e..d14e475aa56 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -10,6 +10,7 @@ using Microsoft.AspNetCore.Razor.Threading; using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit.Abstractions; using Range = Microsoft.VisualStudio.LanguageServer.Protocol.Range; @@ -31,7 +32,7 @@ internal static RazorCodeDocument CreateCodeDocument(string content, ImmutableAr return codeDocument; } - internal class DummyRazorFormattingService : IRazorFormattingService + internal class DummyRazorFormattingService(RazorLanguageKind? languageKind = null) : IRazorFormattingService { public bool Called { get; private set; } @@ -65,5 +66,11 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume { throw new NotImplementedException(); } + + public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) + { + triggerCharacterKind = languageKind ?? RazorLanguageKind.CSharp; + return languageKind is not null; + } } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs index 67a2f3e182d..b3d38ddd5bd 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs @@ -40,4 +40,31 @@ public class Foo{} Assert.Equal(multiEditChange.ToString(), singleEditChange.ToString()); } + + [Fact] + public void AllTriggerCharacters_IncludesCSharpTriggerCharacters() + { + foreach (var character in RazorFormattingService.TestAccessor.GetCSharpTriggerCharacterSet()) + { + Assert.Contains(character, RazorFormattingService.AllTriggerCharacters); + } + } + + [Fact] + public void AllTriggerCharacters_IncludesHtmlTriggerCharacters() + { + foreach (var character in RazorFormattingService.TestAccessor.GetHtmlTriggerCharacterSet()) + { + Assert.Contains(character, RazorFormattingService.AllTriggerCharacters); + } + } + + [Fact] + public void AllTriggerCharacters_ContainsUniqueCharacters() + { + var allChars = RazorFormattingService.AllTriggerCharacters; + var distinctChars = allChars.Distinct().ToArray(); + + Assert.Equal(distinctChars, allChars); + } } From 3da875b6fe51c63c4a3754f9a0352670f9aad35c Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:02:42 +1000 Subject: [PATCH 204/271] Create remote formatting service that delegates to the Razor formatting service --- eng/targets/Services.props | 1 + .../Formatting/RazorFormattingOptions.cs | 5 + .../Remote/IRemoteFormattingService.cs | 26 +++ .../Remote/RazorServices.cs | 1 + .../Formatting/RemoteFormattingService.cs | 175 ++++++++++++++++++ 5 files changed, 208 insertions(+) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs diff --git a/eng/targets/Services.props b/eng/targets/Services.props index b2476eab94a..03343f4a39a 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -29,5 +29,6 @@ + diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs index a0397ec80f5..a1ab2f6a3e3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -1,17 +1,22 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System.Runtime.Serialization; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.CodeAnalysis.Razor.Formatting; +[DataContract] internal readonly record struct RazorFormattingOptions { public static readonly RazorFormattingOptions Default = new(); + [DataMember(Order = 0)] public bool InsertSpaces { get; init; } = true; + [DataMember(Order = 1)] public int TabSize { get; init; } = 4; + [DataMember(Order = 2)] public bool CodeBlockBraceOnNextLine { get; init; } = false; public RazorFormattingOptions() diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs new file mode 100644 index 00000000000..8a1b7aa3798 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs @@ -0,0 +1,26 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Text; + +namespace Microsoft.CodeAnalysis.Razor.Remote; + +internal interface IRemoteFormattingService +{ + ValueTask> GetDocumentFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, RazorFormattingOptions options, CancellationToken cancellationToken); + ValueTask> GetRangeFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, LinePositionSpan linePositionSpan, RazorFormattingOptions options, CancellationToken cancellationToken); + ValueTask> GetOnTypeFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, LinePosition linePosition, string triggerCharacter, RazorFormattingOptions options, CancellationToken cancellationToken); + ValueTask GetOnTypeFormattingTriggerKindAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, LinePosition linePosition, string triggerCharacter, CancellationToken cancellationToken); + + internal enum TriggerKind + { + Invalid, + ValidHtml, + ValidCSharp, + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs index 558b737d4c4..1974d72c494 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs @@ -22,6 +22,7 @@ internal static class RazorServices (typeof(IRemoteFoldingRangeService), null), (typeof(IRemoteDocumentHighlightService), null), (typeof(IRemoteAutoInsertService), null), + (typeof(IRemoteFormattingService), null), ]; // Internal for testing diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs new file mode 100644 index 00000000000..e0dc5d35acb --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs @@ -0,0 +1,175 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Response = Microsoft.CodeAnalysis.Razor.Remote.IRemoteFormattingService.TriggerKind; + +namespace Microsoft.CodeAnalysis.Remote.Razor; + +internal sealed class RemoteFormattingService(in ServiceArgs args) : RazorDocumentServiceBase(in args), IRemoteFormattingService +{ + internal sealed class Factory : FactoryBase + { + protected override IRemoteFormattingService CreateService(in ServiceArgs args) + => new RemoteFormattingService(in args); + } + + private readonly IRazorFormattingService _formattingService = args.ExportProvider.GetExportedValue(); + + public ValueTask> GetDocumentFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + RazorFormattingOptions options, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => GetDocumentFormattingEditsAsync(context, htmlChanges, options, cancellationToken), + cancellationToken); + + private async ValueTask> GetDocumentFormattingEditsAsync( + RemoteDocumentContext context, + ImmutableArray htmlChanges, + RazorFormattingOptions options, + CancellationToken cancellationToken) + { + var sourceText = await context.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var htmlEdits = htmlChanges.Select(sourceText.GetTextEdit).ToArray(); + + var edits = await _formattingService.GetDocumentFormattingEditsAsync(context, htmlEdits, range: null, options, cancellationToken).ConfigureAwait(false); + + if (edits is null) + { + return ImmutableArray.Empty; + } + + return edits.SelectAsArray(sourceText.GetTextChange); + } + + public ValueTask> GetRangeFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + LinePositionSpan linePositionSpan, + RazorFormattingOptions options, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => GetRangeFormattingEditsAsync(context, htmlChanges, linePositionSpan, options, cancellationToken), + cancellationToken); + + private async ValueTask> GetRangeFormattingEditsAsync( + RemoteDocumentContext context, + ImmutableArray htmlChanges, + LinePositionSpan linePositionSpan, + RazorFormattingOptions options, + CancellationToken cancellationToken) + { + var sourceText = await context.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var htmlEdits = htmlChanges.Select(sourceText.GetTextEdit).ToArray(); + + var edits = await _formattingService.GetDocumentFormattingEditsAsync(context, htmlEdits, range: linePositionSpan.ToRange(), options, cancellationToken).ConfigureAwait(false); + + if (edits is null) + { + return ImmutableArray.Empty; + } + + return edits.SelectAsArray(sourceText.GetTextChange); + } + + public ValueTask> GetOnTypeFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + LinePosition linePosition, + string character, + RazorFormattingOptions options, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => GetOnTypeFormattingEditsAsync(context, htmlChanges, linePosition, character, options, cancellationToken), + cancellationToken); + + private async ValueTask> GetOnTypeFormattingEditsAsync(RemoteDocumentContext context, ImmutableArray htmlChanges, LinePosition linePosition, string triggerCharacter, RazorFormattingOptions options, CancellationToken cancellationToken) + { + var codeDocument = await context.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + var sourceText = await context.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + if (!sourceText.TryGetAbsoluteIndex(linePosition, out var hostDocumentIndex)) + { + return []; + } + + if (!_formattingService.TryGetOnTypeFormattingTriggerKind(codeDocument, hostDocumentIndex, triggerCharacter, out var triggerCharacterKind)) + { + return []; + } + + TextEdit[] result; + if (triggerCharacterKind is RazorLanguageKind.Html) + { + var htmlEdits = htmlChanges.Select(sourceText.GetTextEdit).ToArray(); + result = await _formattingService.GetHtmlOnTypeFormattingEditsAsync(context, htmlEdits, options, hostDocumentIndex, triggerCharacter[0], cancellationToken).ConfigureAwait(false); + } + else if (triggerCharacterKind is RazorLanguageKind.CSharp) + { + result = await _formattingService.GetCSharpOnTypeFormattingEditsAsync(context, options, hostDocumentIndex, triggerCharacter[0], cancellationToken).ConfigureAwait(false); + } + else + { + Assumed.Unreachable(); + return []; + } + + return result.SelectAsArray(sourceText.GetTextChange); + } + + public ValueTask GetOnTypeFormattingTriggerKindAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + LinePosition linePosition, + string triggerCharacter, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => IsValidOnTypeFormattingTriggerAsync(context, linePosition, triggerCharacter, cancellationToken), + cancellationToken); + + private async ValueTask IsValidOnTypeFormattingTriggerAsync(RemoteDocumentContext context, LinePosition linePosition, string triggerCharacter, CancellationToken cancellationToken) + { + var codeDocument = await context.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + var sourceText = await context.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + if (!sourceText.TryGetAbsoluteIndex(linePosition, out var hostDocumentIndex)) + { + return Response.Invalid; + } + + if (!_formattingService.TryGetOnTypeFormattingTriggerKind(codeDocument, hostDocumentIndex, triggerCharacter, out var triggerCharacterKind)) + { + return Response.Invalid; + } + + if (triggerCharacterKind is RazorLanguageKind.Html) + { + return Response.ValidHtml; + } + + return Response.ValidCSharp; + } +} From 2a266248b3638a991f2009a857797142d1db810d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:03:10 +1000 Subject: [PATCH 205/271] Fix a bug from a previous PR --- .../Formatting/LspFormattingCodeDocumentProvider.cs | 4 ++-- .../Formatting/RazorFormattingService.cs | 2 +- .../Formatting/RemoteFormattingCodeDocumentProvider.cs | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs index eaf9bfa091b..e47da7f437d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/LspFormattingCodeDocumentProvider.cs @@ -12,7 +12,7 @@ internal sealed class LspFormattingCodeDocumentProvider : IFormattingCodeDocumen { public Task GetCodeDocumentAsync(IDocumentSnapshot snapshot) { - var useDesignTimeGeneratedOutput = snapshot.Project.Configuration.LanguageServerFlags?.ForceRuntimeCodeGeneration ?? false; - return snapshot.GetGeneratedOutputAsync(useDesignTimeGeneratedOutput); + // Formatting always uses design time + return snapshot.GetGeneratedOutputAsync(forceDesignTimeGeneratedOutput: true); } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index ea201061f0b..99d63fe9d32 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -233,7 +233,7 @@ private async Task ApplyFormattedEditsAsync( var documentSnapshot = documentContext.Snapshot; var uri = documentContext.Uri; - var codeDocument = await documentSnapshot.GetGeneratedOutputAsync().ConfigureAwait(false); + var codeDocument = await _codeDocumentProvider.GetCodeDocumentAsync(documentSnapshot).ConfigureAwait(false); using var context = FormattingContext.CreateForOnTypeFormatting( uri, documentSnapshot, diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs index 92a0ccd1ae6..64c90c21cb5 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingCodeDocumentProvider.cs @@ -14,6 +14,7 @@ internal sealed class RemoteFormattingCodeDocumentProvider : IFormattingCodeDocu { public Task GetCodeDocumentAsync(IDocumentSnapshot snapshot) { - return snapshot.GetGeneratedOutputAsync(); + // Formatting always uses design time + return snapshot.GetGeneratedOutputAsync(forceDesignTimeGeneratedOutput: true); } } From 90c7b476a58f755ccd886f53b3b59e5d5f2c2587 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:04:49 +1000 Subject: [PATCH 206/271] Move WebTools calling code to a shared layer --- .../FormattingLanguageServerClient.cs | 109 +++-------------- ...spNetCore.Razor.LanguageServer.Test.csproj | 13 -- .../Formatting_NetFx/HtmlFormatting.cs | 111 ++++++++++++++++++ .../Formatting_NetFx/WebTools.cs | 3 +- ...spNetCore.Razor.Test.Common.Tooling.csproj | 13 ++ 5 files changed, 142 insertions(+), 107 deletions(-) create mode 100644 src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormatting.cs rename src/Razor/test/{Microsoft.AspNetCore.Razor.LanguageServer.Test => Microsoft.AspNetCore.Razor.Test.Common.Tooling}/Formatting_NetFx/WebTools.cs (99%) diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs index 66dc9647845..f647e7d31d6 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerClient.cs @@ -3,25 +3,17 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.AspNetCore.Razor.Test.Common.Mef; using Microsoft.AspNetCore.Razor.Utilities; -using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.Protocol.Formatting; -using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Microsoft.VisualStudio.Text; -using Microsoft.VisualStudio.Utilities; -using Microsoft.WebTools.Languages.Shared.ContentTypes; using Newtonsoft.Json.Linq; namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; @@ -40,52 +32,28 @@ public void AddCodeDocument(RazorCodeDocument codeDocument) _documents.Add("/" + path, codeDocument); } - private Task FormatAsync(DocumentOnTypeFormattingParams @params) + private async Task FormatAsync(DocumentOnTypeFormattingParams @params) { var generatedHtml = GetGeneratedHtml(@params.TextDocument.Uri); - var generatedHtmlSource = SourceText.From(generatedHtml, Encoding.UTF8); - var absoluteIndex = generatedHtmlSource.GetRequiredAbsoluteIndex(@params.Position); - - var request = $$""" - { - "Options": - { - "UseSpaces": {{(@params.Options.InsertSpaces ? "true" : "false")}}, - "TabSize": {{@params.Options.TabSize}}, - "IndentSize": {{@params.Options.TabSize}} - }, - "Uri": "{{@params.TextDocument.Uri}}", - "GeneratedChanges": [], - "OperationType": "FormatOnType", - "SpanToFormat": - { - "Start": {{absoluteIndex}}, - "End": {{absoluteIndex}} - } - } - """; - - return CallWebToolsApplyFormattedEditsHandlerAsync(request, @params.TextDocument.Uri, generatedHtml); + + var edits = await HtmlFormatting.GetOnTypeFormattingEditsAsync(_loggerFactory, @params.TextDocument.Uri, generatedHtml, @params.Position, @params.Options.InsertSpaces, @params.Options.TabSize); + + return new() + { + Edits = edits + }; } - private Task FormatAsync(DocumentFormattingParams @params) + private async Task FormatAsync(DocumentFormattingParams @params) { var generatedHtml = GetGeneratedHtml(@params.TextDocument.Uri); - var request = $$""" - { - "Options": - { - "UseSpaces": {{(@params.Options.InsertSpaces ? "true" : "false")}}, - "TabSize": {{@params.Options.TabSize}}, - "IndentSize": {{@params.Options.TabSize}} - }, - "Uri": "{{@params.TextDocument.Uri}}", - "GeneratedChanges": [], - } - """; - - return CallWebToolsApplyFormattedEditsHandlerAsync(request, @params.TextDocument.Uri, generatedHtml); + var edits = await HtmlFormatting.GetDocumentFormattingEditsAsync(_loggerFactory, @params.TextDocument.Uri, generatedHtml, @params.Options.InsertSpaces, @params.Options.TabSize); + + return new() + { + Edits = edits + }; } private string GetGeneratedHtml(Uri uri) @@ -95,51 +63,6 @@ private string GetGeneratedHtml(Uri uri) return generatedHtml.Replace("\r", "").Replace("\n", "\r\n"); } - private async Task CallWebToolsApplyFormattedEditsHandlerAsync(string serializedValue, Uri documentUri, string generatedHtml) - { - var exportProvider = TestComposition.Editor.ExportProviderFactory.CreateExportProvider(); - var contentTypeService = exportProvider.GetExportedValue(); - - if (!contentTypeService.ContentTypes.Any(t => t.TypeName == HtmlContentTypeDefinition.HtmlContentType)) - { - contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, [StandardContentTypeNames.Text]); - } - - var textBufferFactoryService = (ITextBufferFactoryService3)exportProvider.GetExportedValue(); - var bufferManager = WebTools.BufferManager.New(contentTypeService, textBufferFactoryService, []); - var logger = _loggerFactory.GetOrCreateLogger("ApplyFormattedEditsHandler"); - var applyFormatEditsHandler = WebTools.ApplyFormatEditsHandler.New(textBufferFactoryService, bufferManager, logger); - - // Make sure the buffer manager knows about the source document - var textSnapshot = bufferManager.CreateBuffer( - documentUri: documentUri, - contentTypeName: HtmlContentTypeDefinition.HtmlContentType, - initialContent: generatedHtml, - snapshotVersionFromLSP: 0); - - var requestContext = WebTools.RequestContext.New(textSnapshot); - - var request = WebTools.ApplyFormatEditsParam.DeserializeFrom(serializedValue); - var response = await applyFormatEditsHandler.HandleRequestAsync(request, requestContext, CancellationToken.None); - - var sourceText = SourceText.From(generatedHtml); - - using var edits = new PooledArrayBuilder(); - - foreach (var textChange in response.TextChanges) - { - var span = new TextSpan(textChange.Position, textChange.Length); - var edit = VsLspFactory.CreateTextEdit(sourceText.GetRange(span), textChange.NewText); - - edits.Add(edit); - } - - return new() - { - Edits = edits.ToArray() - }; - } - public async Task SendRequestAsync(string method, TParams @params, CancellationToken cancellationToken) { if (@params is DocumentFormattingParams formattingParams && diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj index b50276628ee..685173189f4 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Microsoft.AspNetCore.Razor.LanguageServer.Test.csproj @@ -13,19 +13,6 @@ - - - - - - - - - - - - - diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormatting.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormatting.cs new file mode 100644 index 00000000000..1879dfadf1d --- /dev/null +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/HtmlFormatting.cs @@ -0,0 +1,111 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Text; +using Microsoft.VisualStudio.Utilities; +using Microsoft.WebTools.Languages.Shared.ContentTypes; + +namespace Microsoft.CodeAnalysis.Razor.Formatting; + +internal static class HtmlFormatting +{ + public static Task GetDocumentFormattingEditsAsync(ILoggerFactory loggerFactory, Uri uri, string generatedHtml, bool insertSpaces, int tabSize) + { + var request = $$""" + { + "Options": + { + "UseSpaces": {{(insertSpaces ? "true" : "false")}}, + "TabSize": {{tabSize}}, + "IndentSize": {{tabSize}} + }, + "Uri": "{{uri}}", + "GeneratedChanges": [], + } + """; + + return CallWebToolsApplyFormattedEditsHandlerAsync(loggerFactory, request, uri, generatedHtml); + } + + public static Task GetOnTypeFormattingEditsAsync(ILoggerFactory loggerFactory, Uri uri, string generatedHtml, Position position, bool insertSpaces, int tabSize) + { + var generatedHtmlSource = SourceText.From(generatedHtml, Encoding.UTF8); + var absoluteIndex = generatedHtmlSource.GetRequiredAbsoluteIndex(position); + + var request = $$""" + { + "Options": + { + "UseSpaces": {{(insertSpaces ? "true" : "false")}}, + "TabSize": {{tabSize}}, + "IndentSize": {{tabSize}} + }, + "Uri": "{{uri}}", + "GeneratedChanges": [], + "OperationType": "FormatOnType", + "SpanToFormat": + { + "Start": {{absoluteIndex}}, + "End": {{absoluteIndex}} + } + } + """; + + return CallWebToolsApplyFormattedEditsHandlerAsync(loggerFactory, request, uri, generatedHtml); + } + + private static async Task CallWebToolsApplyFormattedEditsHandlerAsync(ILoggerFactory loggerFactory, string serializedValue, Uri documentUri, string generatedHtml) + { + var exportProvider = TestComposition.Editor.ExportProviderFactory.CreateExportProvider(); + var contentTypeService = exportProvider.GetExportedValue(); + + lock (contentTypeService) + { + if (!contentTypeService.ContentTypes.Any(t => t.TypeName == HtmlContentTypeDefinition.HtmlContentType)) + { + contentTypeService.AddContentType(HtmlContentTypeDefinition.HtmlContentType, [StandardContentTypeNames.Text]); + } + } + + var textBufferFactoryService = (ITextBufferFactoryService3)exportProvider.GetExportedValue(); + var bufferManager = WebTools.BufferManager.New(contentTypeService, textBufferFactoryService, []); + var logger = loggerFactory.GetOrCreateLogger("ApplyFormattedEditsHandler"); + var applyFormatEditsHandler = WebTools.ApplyFormatEditsHandler.New(textBufferFactoryService, bufferManager, logger); + + // Make sure the buffer manager knows about the source document + var textSnapshot = bufferManager.CreateBuffer( + documentUri: documentUri, + contentTypeName: HtmlContentTypeDefinition.HtmlContentType, + initialContent: generatedHtml, + snapshotVersionFromLSP: 0); + + var requestContext = WebTools.RequestContext.New(textSnapshot); + + var request = WebTools.ApplyFormatEditsParam.DeserializeFrom(serializedValue); + var response = await applyFormatEditsHandler.HandleRequestAsync(request, requestContext, CancellationToken.None); + + var sourceText = SourceText.From(generatedHtml); + + using var edits = new PooledArrayBuilder(); + + foreach (var textChange in response.TextChanges) + { + var span = new TextSpan(textChange.Position, textChange.Length); + var edit = VsLspFactory.CreateTextEdit(sourceText.GetRange(span), textChange.NewText); + + edits.Add(edit); + } + + return edits.ToArray(); + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs similarity index 99% rename from src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs rename to src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs index ec0430afe16..1077a3b09ec 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/WebTools.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Formatting_NetFx/WebTools.cs @@ -7,6 +7,7 @@ using System.Reflection; using System.Threading; using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.CodeAnalysis.Razor.Logging; using Microsoft.VisualStudio.Settings.Internal; @@ -16,7 +17,7 @@ using Microsoft.WebTools.Languages.Shared.Editor.Text; using Newtonsoft.Json; -namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; +namespace Microsoft.CodeAnalysis.Razor.Formatting; /// /// Provides reflection-based access to the Web Tools LSP infrastructure needed for tests. diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj index 6caeb6b2982..89019499fa8 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/Microsoft.AspNetCore.Razor.Test.Common.Tooling.csproj @@ -35,6 +35,19 @@ + + + + + + + + + + + + + From 2cbbdf56908fe13105a023ac97604084e1bf1128 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:05:10 +1000 Subject: [PATCH 207/271] Create cohosting endpoints --- .../CohostDocumentFormattingEndpoint.cs | 140 ++++++++++++++ .../Cohost/CohostOnTypeFormattingEndpoint.cs | 176 ++++++++++++++++++ .../Cohost/CohostRangeFormattingEndpoint.cs | 147 +++++++++++++++ 3 files changed, 463 insertions(+) create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs new file mode 100644 index 00000000000..8589644a08a --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs @@ -0,0 +1,140 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(Methods.TextDocumentFormattingName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostDocumentFormattingEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostDocumentFormattingEndpoint( + IRemoteServiceInvoker remoteServiceInvoker, + IHtmlDocumentSynchronizer htmlDocumentSynchronizer, + LSPRequestInvoker requestInvoker, + IClientSettingsManager clientSettingsManager, + ILoggerFactory loggerFactory) + : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.TextDocument?.Formatting?.DynamicRegistration is true) + { + return new Registration() + { + Method = Methods.TextDocumentFormattingName, + RegisterOptions = new DocumentFormattingRegistrationOptions() + { + DocumentSelector = filter + } + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(DocumentFormattingParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override Task HandleRequestAsync(DocumentFormattingParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => HandleRequestAsync(request, context.TextDocument.AssumeNotNull(), cancellationToken); + + private async Task HandleRequestAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + _logger.LogDebug($"Getting Html formatting changes for {razorDocument.FilePath}"); + var htmlResult = await GetHtmlFormattingEditsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); + + if (htmlResult is not { } htmlEdits) + { + // We prefer to return null, so the client will try again + _logger.LogDebug($"Didn't get any edits back from Html"); + return null; + } + + var sourceText = await razorDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var htmlChanges = htmlEdits.SelectAsArray(sourceText.GetTextChange); + + var options = RazorFormattingOptions.From(request.Options, _clientSettingsManager.GetClientSettings().AdvancedSettings.CodeBlockBraceOnNextLine); + + _logger.LogDebug($"Calling OOP with the {htmlChanges.Length} html edits, so it can fill in the rest"); + var remoteResult = await _remoteServiceInvoker.TryInvokeAsync>( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => service.GetDocumentFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, options, cancellationToken), + cancellationToken).ConfigureAwait(false); + + if (remoteResult is [_, ..] allChanges) + { + _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + + return allChanges.Select(sourceText.GetTextEdit).ToArray(); + } + + return null; + } + + private async Task GetHtmlFormattingEditsAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); + if (htmlDocument is null) + { + return null; + } + + request.TextDocument = request.TextDocument.WithUri(htmlDocument.Uri); + + _logger.LogDebug($"Requesting document formatting edits for {htmlDocument.Uri}"); + + var result = await _requestInvoker.ReinvokeRequestOnServerAsync( + htmlDocument.Buffer, + Methods.TextDocumentFormattingName, + RazorLSPConstants.HtmlLanguageServerName, + request, + cancellationToken).ConfigureAwait(false); + + if (result?.Response is null) + { + _logger.LogDebug($"Didn't get any ranges back from Html. Returning null so we can abandon the whole thing"); + return null; + } + + return result.Response; + } + + internal TestAccessor GetTestAccessor() => new(this); + + internal readonly struct TestAccessor(CohostDocumentFormattingEndpoint instance) + { + public Task HandleRequestAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + => instance.HandleRequestAsync(request, razorDocument, cancellationToken); + } +} + diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs new file mode 100644 index 00000000000..e5cd437628f --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs @@ -0,0 +1,176 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(Methods.TextDocumentOnTypeFormattingName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostOnTypeFormattingEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostOnTypeFormattingEndpoint( + IRemoteServiceInvoker remoteServiceInvoker, + IHtmlDocumentSynchronizer htmlDocumentSynchronizer, + LSPRequestInvoker requestInvoker, + IClientSettingsManager clientSettingsManager, + ILoggerFactory loggerFactory) + : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.TextDocument?.Formatting?.DynamicRegistration is true) + { + return new Registration() + { + Method = Methods.TextDocumentOnTypeFormattingName, + RegisterOptions = new DocumentOnTypeFormattingRegistrationOptions() + { + DocumentSelector = filter, + FirstTriggerCharacter = RazorFormattingService.AllTriggerCharacters[0], + MoreTriggerCharacter = RazorFormattingService.AllTriggerCharacters.AsSpan()[1..].ToArray(), + } + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(DocumentOnTypeFormattingParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override Task HandleRequestAsync(DocumentOnTypeFormattingParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => HandleRequestAsync(request, context.TextDocument.AssumeNotNull(), cancellationToken); + + private async Task HandleRequestAsync(DocumentOnTypeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var clientSettings = _clientSettingsManager.GetClientSettings(); + if (!clientSettings.AdvancedSettings.FormatOnType) + { + _logger.LogInformation($"Formatting on type disabled."); + return null; + } + + if (!RazorFormattingService.AllTriggerCharacterSet.Contains(request.Character)) + { + _logger.LogWarning($"Unexpected trigger character '{request.Character}'."); + return null; + } + + // We have to go to OOP to find out if we want Html formatting for this request. This is a little unfortunate + // but just asking Html for formatting, just in case, would be bad for a couple of reasons. Firstly, the Html + // trigger characters are a superset of the C# triggers, so we can't use that as a sign. Secondly, whilst we + // might be making one Html request, it could be then calling CSS or TypeScript servers, so our single request + // to OOP could potentially save a few requests downstream. Lastly, our request to OOP is MessagePack which is + // generally faster than Json anyway. + var triggerKind = await _remoteServiceInvoker.TryInvokeAsync( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => service.GetOnTypeFormattingTriggerKindAsync(solutionInfo, razorDocument.Id, request.Position.ToLinePosition(), request.Character, cancellationToken), + cancellationToken).ConfigureAwait(false); + + if (triggerKind == IRemoteFormattingService.TriggerKind.Invalid) + { + return null; + } + + var sourceText = await razorDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + + ImmutableArray htmlChanges = []; + if (triggerKind == IRemoteFormattingService.TriggerKind.ValidHtml) + { + _logger.LogDebug($"Getting Html formatting changes for {razorDocument.FilePath}"); + var htmlResult = await GetHtmlFormattingEditsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); + + if (htmlResult is not { } htmlEdits) + { + // We prefer to return null, so the client will try again + _logger.LogDebug($"Didn't get any edits back from Html"); + return null; + } + + htmlChanges = htmlEdits.SelectAsArray(sourceText.GetTextChange); + } + + var options = RazorFormattingOptions.From(request.Options, clientSettings.AdvancedSettings.CodeBlockBraceOnNextLine); + + _logger.LogDebug($"Calling OOP with the {htmlChanges.Length} html edits, so it can fill in the rest"); + var remoteResult = await _remoteServiceInvoker.TryInvokeAsync>( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => service.GetOnTypeFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, request.Position.ToLinePosition(), request.Character, options, cancellationToken), + cancellationToken).ConfigureAwait(false); + + if (remoteResult is [_, ..] allChanges) + { + _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + + return allChanges.Select(sourceText.GetTextEdit).ToArray(); + } + + return null; + } + + private async Task GetHtmlFormattingEditsAsync(DocumentOnTypeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); + if (htmlDocument is null) + { + return null; + } + + request.TextDocument = request.TextDocument.WithUri(htmlDocument.Uri); + + _logger.LogDebug($"Requesting document formatting edits for {htmlDocument.Uri}"); + + var result = await _requestInvoker.ReinvokeRequestOnServerAsync( + htmlDocument.Buffer, + Methods.TextDocumentOnTypeFormattingName, + RazorLSPConstants.HtmlLanguageServerName, + request, + cancellationToken).ConfigureAwait(false); + + if (result?.Response is null) + { + _logger.LogDebug($"Didn't get any ranges back from Html. Returning null so we can abandon the whole thing"); + return null; + } + + return result.Response; + } + + internal TestAccessor GetTestAccessor() => new(this); + + internal readonly struct TestAccessor(CohostOnTypeFormattingEndpoint instance) + { + public Task HandleRequestAsync(DocumentOnTypeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + => instance.HandleRequestAsync(request, razorDocument, cancellationToken); + } +} + diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs new file mode 100644 index 00000000000..9be30b7eabe --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs @@ -0,0 +1,147 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Composition; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.CodeAnalysis.Razor.Logging; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(Methods.TextDocumentRangeFormattingName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostRangeFormattingEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostRangeFormattingEndpoint( + IRemoteServiceInvoker remoteServiceInvoker, + IHtmlDocumentSynchronizer htmlDocumentSynchronizer, + LSPRequestInvoker requestInvoker, + IClientSettingsManager clientSettingsManager, + ILoggerFactory loggerFactory) + : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly IClientSettingsManager _clientSettingsManager = clientSettingsManager; + private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.TextDocument?.Formatting?.DynamicRegistration is true) + { + return new Registration() + { + Method = Methods.TextDocumentRangeFormattingName, + RegisterOptions = new DocumentRangeFormattingRegistrationOptions() + { + DocumentSelector = filter + } + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(DocumentRangeFormattingParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override Task HandleRequestAsync(DocumentRangeFormattingParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => HandleRequestAsync(request, context.TextDocument.AssumeNotNull(), cancellationToken); + + private async Task HandleRequestAsync(DocumentRangeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + _logger.LogDebug($"Getting Html formatting changes for {razorDocument.FilePath}"); + var htmlResult = await GetHtmlFormattingEditsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); + + if (htmlResult is not { } htmlEdits) + { + // We prefer to return null, so the client will try again + _logger.LogDebug($"Didn't get any edits back from Html"); + return null; + } + + var sourceText = await razorDocument.GetTextAsync(cancellationToken).ConfigureAwait(false); + var htmlChanges = htmlEdits.SelectAsArray(sourceText.GetTextChange); + + var options = RazorFormattingOptions.From(request.Options, _clientSettingsManager.GetClientSettings().AdvancedSettings.CodeBlockBraceOnNextLine); + + _logger.LogDebug($"Calling OOP with the {htmlChanges.Length} html edits, so it can fill in the rest"); + var remoteResult = await _remoteServiceInvoker.TryInvokeAsync>( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => service.GetRangeFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, request.Range.ToLinePositionSpan(), options, cancellationToken), + cancellationToken).ConfigureAwait(false); + + if (remoteResult is [_, ..] allChanges) + { + _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + + return allChanges.Select(sourceText.GetTextEdit).ToArray(); + } + + return null; + } + + private async Task GetHtmlFormattingEditsAsync(DocumentRangeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); + if (htmlDocument is null) + { + return null; + } + + // We don't actually request range formatting results from Html, because our formatting engine can't deal with + // relative formatting results. Instead we request full document formatting, and filter the edits inside the + // formatting service to only the ones we care about. + var formattingRequest = new DocumentFormattingParams + { + TextDocument = request.TextDocument.WithUri(htmlDocument.Uri), + Options = request.Options + }; + + _logger.LogDebug($"Requesting document formatting edits for {htmlDocument.Uri}"); + + var result = await _requestInvoker.ReinvokeRequestOnServerAsync( + htmlDocument.Buffer, + Methods.TextDocumentFormattingName, + RazorLSPConstants.HtmlLanguageServerName, + formattingRequest, + cancellationToken).ConfigureAwait(false); + + if (result?.Response is null) + { + _logger.LogDebug($"Didn't get any ranges back from Html. Returning null so we can abandon the whole thing"); + return null; + } + + return result.Response; + } + + internal TestAccessor GetTestAccessor() => new(this); + + internal readonly struct TestAccessor(CohostRangeFormattingEndpoint instance) + { + public Task HandleRequestAsync(DocumentRangeFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + => instance.HandleRequestAsync(request, razorDocument, cancellationToken); + } +} + From 6c3b12be1e103dc4388605558dd3b6ea56b94677 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:05:36 +1000 Subject: [PATCH 208/271] Turn off the old endpoints --- .../Extensions/IServiceCollectionExtensions.cs | 14 +++++++++----- .../RazorLanguageServer.cs | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 5b5a1911208..b717027d9e7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -56,15 +56,19 @@ public static void AddLifeCycleServices(this IServiceCollection services, RazorL services.AddSingleton(clientConnection); } - public static void AddFormattingServices(this IServiceCollection services) + public static void AddFormattingServices(this IServiceCollection services, LanguageServerFeatureOptions featureOptions) { // Formatting - services.AddSingleton(); services.AddSingleton(); - services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); - services.AddHandlerWithCapabilities(); + if (!featureOptions.UseRazorCohostServer) + { + services.AddSingleton(); + + services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); + services.AddHandlerWithCapabilities(); + } } public static void AddCompletionServices(this IServiceCollection services) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index d3162a0e5b1..763edb83c35 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -135,7 +135,7 @@ protected override ILspServices ConstructLspServices() services.AddSemanticTokensServices(featureOptions); services.AddDocumentManagementServices(featureOptions); services.AddCompletionServices(); - services.AddFormattingServices(); + services.AddFormattingServices(featureOptions); services.AddCodeActionsServices(); services.AddOptionsServices(_lspOptions); services.AddHoverServices(); From a336b7fe2b1d92904392b7a9d1842662dcb22f24 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:06:09 +1000 Subject: [PATCH 209/271] Create basic tests These don't test the full capabilities of the formatting engine, just that it runs in cohosting --- .../CohostDocumentFormattingEndpointTest.cs | 144 ++++++++++++++++ .../CohostOnTypeFormattingEndpointTest.cs | 158 ++++++++++++++++++ .../CohostRangeFormattingEndpointTest.cs | 139 +++++++++++++++ 3 files changed, 441 insertions(+) create mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs create mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs create mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs new file mode 100644 index 00000000000..3c8f9b268b0 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentFormattingEndpointTest.cs @@ -0,0 +1,144 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[UseExportProvider] +public class CohostDocumentFormattingEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + // All of the formatting tests in the language server exercise the formatting engine and cover various edge cases + // and provide regression prevention. The tests here are not exhaustive, but they validate the the cohost endpoints + // call into the formatting engine at least, and handles C#, Html and Razor formatting changes correctly. + + [Fact] + public Task Formatting() + => VerifyDocumentFormattingAsync( + input: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + + """, + expected: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + + """); + + private async Task VerifyDocumentFormattingAsync(string input, string expected) + { + var document = CreateProjectAndRazorDocument(input); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await HtmlFormatting.GetDocumentFormattingEditsAsync(LoggerFactory, uri, generatedHtml, insertSpaces: true, tabSize: 4); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentFormattingName, htmlEdits)]); + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostDocumentFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + } + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs new file mode 100644 index 00000000000..b39ca778abe --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostOnTypeFormattingEndpointTest.cs @@ -0,0 +1,158 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.TestPlatform.ObjectModel; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[UseExportProvider] +public class CohostOnTypeFormattingEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task InvalidTrigger() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if(true){} + } + """, + triggerCharacter: 'h'); + } + + [Fact] + public async Task CSharp_InvalidTrigger() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if(true){} + } + """, + triggerCharacter: '\n'); + } + + [Fact] + public async Task CSharp() + { + await VerifyOnTypeFormattingAsync( + input: """ + @{ + if(true){}$$ + } + """, + expected: """ + @{ + if (true) { } + } + """, + triggerCharacter: '}'); + } + + [Fact] + public async Task FormatsSimpleHtmlTag_OnType() + { + await VerifyOnTypeFormattingAsync( + input: """ + + + Hello + + + + """, + expected: """ + + + Hello + + + + """, + triggerCharacter: ';', + html: true); + } + + private async Task VerifyOnTypeFormattingAsync(TestCode input, string expected, char triggerCharacter, bool html = false) + { + var document = CreateProjectAndRazorDocument(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + var position = inputText.GetPosition(input.Position); + + LSPRequestInvoker requestInvoker; + if (html) + { + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await HtmlFormatting.GetOnTypeFormattingEditsAsync(LoggerFactory, uri, generatedHtml, position, insertSpaces: true, tabSize: 4); + + requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentOnTypeFormattingName, htmlEdits)]); + } + else + { + // We use a mock here so that it will throw if called + requestInvoker = StrictMock.Of(); + } + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostOnTypeFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentOnTypeFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + }, + Character = triggerCharacter.ToString(), + Position = position + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + if (edits is null) + { + Assert.Equal(expected, input.Text); + return; + } + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs new file mode 100644 index 00000000000..32d03e28002 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostRangeFormattingEndpointTest.cs @@ -0,0 +1,139 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.AspNetCore.Razor.Test.Common.Mef; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Formatting; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Microsoft.VisualStudio.Razor.Settings; +using Microsoft.VisualStudio.Threading; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +[UseExportProvider] +public class CohostRangeFormattingEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public Task RangeFormatting() + => VerifyRangeFormattingAsync( + input: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+ [|
+ @{ +
+
+ This is heavily nested +
+
+ } +
|] + } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + """, + expected: """ + @preservewhitespace true + +
+ + @{ +

+ @{ + var t = 1; + if (true) + { + + } + } +

+
+ @{ +
+
+ This is heavily nested +
+
+ } +
+ } + + @code { + private void M(string thisIsMyString) + { + var x = 5; + + var y = "Hello"; + + M("Hello"); + } + } + """); + + private async Task VerifyRangeFormattingAsync(TestCode input, string expected) + { + var document = CreateProjectAndRazorDocument(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlDocumentPublisher = new HtmlDocumentPublisher(RemoteServiceInvoker, StrictMock.Of(), StrictMock.Of(), LoggerFactory); + var generatedHtml = await htmlDocumentPublisher.GetHtmlSourceFromOOPAsync(document, DisposalToken); + Assert.NotNull(generatedHtml); + + var uri = new Uri(document.CreateUri(), $"{document.FilePath}{FeatureOptions.HtmlVirtualDocumentSuffix}"); + var htmlEdits = await HtmlFormatting.GetDocumentFormattingEditsAsync(LoggerFactory, uri, generatedHtml, insertSpaces: true, tabSize: 4); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentFormattingName, htmlEdits)]); + + var clientSettingsManager = new ClientSettingsManager(changeTriggers: []); + + var endpoint = new CohostRangeFormattingEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, clientSettingsManager, LoggerFactory); + + var request = new DocumentRangeFormattingParams() + { + TextDocument = new TextDocumentIdentifier() { Uri = document.CreateUri() }, + Options = new FormattingOptions() + { + TabSize = 4, + InsertSpaces = true + }, + Range = inputText.GetRange(input.Span) + }; + + var edits = await endpoint.GetTestAccessor().HandleRequestAsync(request, document, DisposalToken); + + var changes = edits.Select(inputText.GetTextChange); + var finalText = inputText.WithChanges(changes); + + AssertEx.EqualOrDiff(expected, finalText.ToString()); + } +} From 55c51a3a9d0218c9983d01a68ad9a20fdaf5075f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Mon, 2 Sep 2024 15:34:32 +1000 Subject: [PATCH 210/271] Apply suggestions from code review --- .../Formatting/RazorFormattingService.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 99d63fe9d32..c5f28c682c7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -199,21 +199,16 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) { triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); - if (triggerCharacterKind is not (RazorLanguageKind.CSharp or RazorLanguageKind.Html)) - { - return false; - } - - if (triggerCharacterKind == RazorLanguageKind.CSharp) + if (triggerCharacterKind is RazorLanguageKind.CSharp) { return s_csharpTriggerCharacterSet.Contains(triggerCharacter); } - else if (triggerCharacterKind == RazorLanguageKind.Html) + else if (triggerCharacterKind is RazorLanguageKind.Html) { return s_htmlTriggerCharacterSet.Contains(triggerCharacter); } - return true; + return false; } private async Task ApplyFormattedEditsAsync( From 4a9669226e1d37fd2da827790dda66d2863b9211 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" Date: Mon, 2 Sep 2024 12:51:26 +0000 Subject: [PATCH 211/271] Update dependencies from https://github.com/dotnet/source-build-reference-packages build 20240828.1 Microsoft.SourceBuild.Intermediate.source-build-reference-packages From Version 10.0.0-alpha.1.24421.1 -> To Version 10.0.0-alpha.1.24428.1 --- eng/Version.Details.xml | 4 ++-- eng/Versions.props | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 6eecf640008..0e40c75311d 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -6,9 +6,9 @@ 839cdfb0ecca5e0be3dbccd926e7651ef50fdf10 - + https://github.com/dotnet/source-build-reference-packages - bdd698774daa248301c236f09b97015610ca2842 + 6bcf90f99d13da86c5e9753a6f34b6484673d0a0 diff --git a/eng/Versions.props b/eng/Versions.props index 29508bb3e05..3e183febe6d 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 10.0.0-alpha.1.24421.1 + 10.0.0-alpha.1.24428.1 9.0.0-beta.24352.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 56128c3c26608077bb196ba6790ca44797c1fc2b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 29 Aug 2024 17:42:10 +1000 Subject: [PATCH 212/271] Refactor out spell check endpoints to services, and clean up a little --- .../IServiceCollectionExtensions.cs | 3 + .../SpellCheck/DocumentSpellCheckEndpoint.cs | 187 ++---------------- .../SpellCheck/LspCSharpSpellCheckService.cs | 74 +++++++ .../SpellCheck/ICSharpSpellCheckService.cs | 14 ++ .../SpellCheck/ISpellCheckService.cs | 13 ++ .../SpellCheck/SpellCheckRange.cs | 6 + .../SpellCheck/SpellCheckService.cs | 137 +++++++++++++ .../DocumentSpellCheckEndpointTest.cs | 5 +- 8 files changed, 263 insertions(+), 176 deletions(-) create mode 100644 src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ISpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckRange.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index 5b5a1911208..bd27fef9adc 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -27,6 +27,7 @@ using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Razor.SemanticTokens; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.CommonLanguageServerProtocol.Framework; using Microsoft.Extensions.DependencyInjection; @@ -159,6 +160,8 @@ public static void AddTextDocumentServices(this IServiceCollection services, Lan services.AddHandlerWithCapabilities(); } + services.AddSingleton(); + services.AddSingleton(); services.AddHandlerWithCapabilities(); services.AddHandler(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index 625c7a6086b..5de64a1a7c9 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -2,38 +2,19 @@ // Licensed under the MIT license. See License.txt in the project root for license information. using System; -using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Language.Syntax; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; -using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; -using Microsoft.AspNetCore.Razor.PooledObjects; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; -using Microsoft.CodeAnalysis.Razor.ProjectSystem; -using Microsoft.CodeAnalysis.Razor.Protocol; -using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.VisualStudio.LanguageServer.Protocol; namespace Microsoft.AspNetCore.Razor.LanguageServer.SpellCheck; [RazorLanguageServerEndpoint(VSInternalMethods.TextDocumentSpellCheckableRangesName)] -internal sealed class DocumentSpellCheckEndpoint : IRazorRequestHandler, ICapabilitiesProvider +internal sealed class DocumentSpellCheckEndpoint( + ISpellCheckService spellCheckService) : IRazorRequestHandler, ICapabilitiesProvider { - private readonly IDocumentMappingService _documentMappingService; - private readonly LanguageServerFeatureOptions _languageServerFeatureOptions; - private readonly IClientConnection _clientConnection; - - public DocumentSpellCheckEndpoint( - IDocumentMappingService documentMappingService, - LanguageServerFeatureOptions languageServerFeatureOptions, - IClientConnection clientConnection) - { - _documentMappingService = documentMappingService ?? throw new ArgumentNullException(nameof(documentMappingService)); - _languageServerFeatureOptions = languageServerFeatureOptions ?? throw new ArgumentNullException(nameof(languageServerFeatureOptions)); - _clientConnection = clientConnection ?? throw new ArgumentNullException(nameof(clientConnection)); - } + private readonly ISpellCheckService _spellCheckService = spellCheckService; public bool MutatesSolutionState => false; @@ -43,14 +24,7 @@ public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, V } public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellCheckableParams request) - { - if (request.TextDocument is null) - { - throw new ArgumentNullException(nameof(request.TextDocument)); - } - - return request.TextDocument; - } + => request.TextDocument; public async Task HandleRequestAsync(VSInternalDocumentSpellCheckableParams request, RazorRequestContext requestContext, CancellationToken cancellationToken) { @@ -60,150 +34,13 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellC return null; } - using var _ = ListPool.GetPooledObject(out var ranges); - - await AddRazorSpellCheckRangesAsync(ranges, documentContext, cancellationToken).ConfigureAwait(false); - - if (_languageServerFeatureOptions.SingleServerSupport) - { - await AddCSharpSpellCheckRangesAsync(ranges, documentContext, cancellationToken).ConfigureAwait(false); - } - - return new[] - { - new VSInternalSpellCheckableRangeReport - { - Ranges = ConvertSpellCheckRangesToIntTriples(ranges), - ResultId = Guid.NewGuid().ToString() - } - }; - } - - private static async Task AddRazorSpellCheckRangesAsync(List ranges, DocumentContext documentContext, CancellationToken cancellationToken) - { - var tree = await documentContext.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - - // We don't want to report spelling errors in script or style tags, so we avoid descending into them at all, which - // means we don't need complicated logic, and it performs a bit better. We assume any C# in them will still be reported - // by Roslyn. - // In an ideal world we wouldn't need this logic at all, as we would defer to the Html LSP server to provide spell checking - // but it doesn't currently support it. When that support is added, we can remove all of this but the RazorCommentBlockSyntax - // handling. - foreach (var node in tree.Root.DescendantNodes(n => n is not MarkupElementSyntax { StartTag.Name.Content: "script" or "style" })) - { - if (node is RazorCommentBlockSyntax commentBlockSyntax) - { - ranges.Add(new((int)VSInternalSpellCheckableRangeKind.Comment, commentBlockSyntax.Comment.SpanStart, commentBlockSyntax.Comment.Span.Length)); - } - else if (node is MarkupTextLiteralSyntax textLiteralSyntax) - { - // Attribute names are text literals, but we don't want to spell check them because either C# will, - // whether they're component attributes based on property names, or they come from tag helper attribute - // parameters as strings, or they're Html attributes which are not necessarily expected to be real words. - if (node.Parent is MarkupTagHelperAttributeSyntax or - MarkupAttributeBlockSyntax or - MarkupMinimizedAttributeBlockSyntax or - MarkupTagHelperDirectiveAttributeSyntax or - MarkupMinimizedTagHelperAttributeSyntax or - MarkupMinimizedTagHelperDirectiveAttributeSyntax or - MarkupMiscAttributeContentSyntax) - { - continue; - } - - // Text literals appear everywhere in Razor to hold newlines and indentation, so its worth saving the tokens - if (textLiteralSyntax.ContainsOnlyWhitespace()) - { - continue; - } - - if (textLiteralSyntax.Span.Length == 0) - { - continue; - } - - ranges.Add(new((int)VSInternalSpellCheckableRangeKind.String, textLiteralSyntax.SpanStart, textLiteralSyntax.Span.Length)); - } - } - } - - private async Task AddCSharpSpellCheckRangesAsync(List ranges, DocumentContext documentContext, CancellationToken cancellationToken) - { - var delegatedParams = new DelegatedSpellCheckParams(documentContext.GetTextDocumentIdentifierAndVersion()); - var delegatedResponse = await _clientConnection.SendRequestAsync( - CustomMessageNames.RazorSpellCheckEndpoint, - delegatedParams, - cancellationToken).ConfigureAwait(false); + var data = await _spellCheckService.GetSpellCheckRangeTriplesAsync(documentContext, cancellationToken).ConfigureAwait(false); - if (delegatedResponse is null) - { - return; - } - - var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - var csharpDocument = codeDocument.GetCSharpDocument(); - - foreach (var report in delegatedResponse) - { - if (report.Ranges is not { } csharpRanges) - { - continue; - } - - // Since we get C# tokens that have relative starts, we need to convert them back to absolute indexes - // so we can sort them with the Razor tokens later - var absoluteCSharpStartIndex = 0; - for (var i = 0; i < csharpRanges.Length; i += 3) - { - var kind = csharpRanges[i]; - var start = csharpRanges[i + 1]; - var length = csharpRanges[i + 2]; - - absoluteCSharpStartIndex += start; - - // We need to map the start index to produce results, and we validate that we can map the end index so we don't have - // squiggles that go from C# into Razor/Html. - if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) && - _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3)) - { - ranges.Add(new(kind, hostDocumentIndex, length)); - } - - absoluteCSharpStartIndex += length; - } - } - } - - private static int[] ConvertSpellCheckRangesToIntTriples(List ranges) - { - // Important to sort first, or the client will just ignore anything we say - ranges.Sort(CompareSpellCheckRanges); - - using var _ = ListPool.GetPooledObject(out var data); - data.SetCapacityIfLarger(ranges.Count * 3); - - var lastAbsoluteEndIndex = 0; - foreach (var range in ranges) - { - if (range.Length == 0) - { - continue; - } - - data.Add(range.Kind); - data.Add(range.AbsoluteStartIndex - lastAbsoluteEndIndex); - data.Add(range.Length); - - lastAbsoluteEndIndex = range.AbsoluteStartIndex + range.Length; - } - - return data.ToArray(); - } - - private record struct SpellCheckRange(int Kind, int AbsoluteStartIndex, int Length); - - private static int CompareSpellCheckRanges(SpellCheckRange x, SpellCheckRange y) - { - return x.AbsoluteStartIndex.CompareTo(y.AbsoluteStartIndex); + return [new VSInternalSpellCheckableRangeReport + { + Ranges =data, + ResultId = Guid.NewGuid().ToString() + } + ]; } } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs new file mode 100644 index 00000000000..764c9c1f31e --- /dev/null +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs @@ -0,0 +1,74 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Linq; +using System.Text; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.SpellCheck; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.AspNetCore.Razor.LanguageServer.SpellCheck; + +internal sealed class LspCSharpSpellCheckService( + LanguageServerFeatureOptions languageServerFeatureOptions, + IClientConnection clientConnection) : ICSharpSpellCheckService +{ + private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; + private readonly IClientConnection _clientConnection = clientConnection; + + public async Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken) + { + if (!_languageServerFeatureOptions.SingleServerSupport) + { + return []; + } + + var delegatedParams = new DelegatedSpellCheckParams(documentContext.GetTextDocumentIdentifierAndVersion()); + var delegatedResponse = await _clientConnection.SendRequestAsync( + CustomMessageNames.RazorSpellCheckEndpoint, + delegatedParams, + cancellationToken).ConfigureAwait(false); + + if (delegatedResponse is null) + { + return []; + } + + using var ranges = new PooledArrayBuilder(); + foreach (var report in delegatedResponse) + { + if (report.Ranges is not { } csharpRanges) + { + continue; + } + + // Since we get C# tokens that have relative starts, we need to convert them back to absolute indexes + // so we can sort them with the Razor tokens later + var absoluteCSharpStartIndex = 0; + for (var i = 0; i < csharpRanges.Length; i += 3) + { + var kind = csharpRanges[i]; + var start = csharpRanges[i + 1]; + var length = csharpRanges[i + 2]; + + absoluteCSharpStartIndex += start; + + ranges.Add(new(kind, absoluteCSharpStartIndex, length)); + + absoluteCSharpStartIndex += length; + } + } + + return ranges.ToImmutable(); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs new file mode 100644 index 00000000000..de7341567b6 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs @@ -0,0 +1,14 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor.SpellCheck; + +internal interface ICSharpSpellCheckService +{ + Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ISpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ISpellCheckService.cs new file mode 100644 index 00000000000..dc45deee3b4 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ISpellCheckService.cs @@ -0,0 +1,13 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Razor.SpellCheck; + +internal interface ISpellCheckService +{ + Task GetSpellCheckRangeTriplesAsync(DocumentContext documentContext, CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckRange.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckRange.cs new file mode 100644 index 00000000000..472d213f336 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckRange.cs @@ -0,0 +1,6 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +namespace Microsoft.CodeAnalysis.Razor.SpellCheck; + +internal readonly record struct SpellCheckRange(int Kind, int AbsoluteStartIndex, int Length); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs new file mode 100644 index 00000000000..78f0441e383 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs @@ -0,0 +1,137 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.Language.Syntax; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.CodeAnalysis.Razor.SpellCheck; + +internal class SpellCheckService( + ICSharpSpellCheckService csharpSpellCheckService, + IDocumentMappingService documentMappingService) : ISpellCheckService +{ + private readonly ICSharpSpellCheckService _csharpSpellCheckService = csharpSpellCheckService; + private readonly IDocumentMappingService _documentMappingService = documentMappingService; + + public async Task GetSpellCheckRangeTriplesAsync(DocumentContext documentContext, CancellationToken cancellationToken) + { + using var ranges = new PooledArrayBuilder(); + + var syntaxTree = await documentContext.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); + + AddRazorSpellCheckRanges(ref ranges.AsRef(), syntaxTree); + + var csharpRanges = await _csharpSpellCheckService.GetCSharpSpellCheckRangesAsync(documentContext, cancellationToken).ConfigureAwait(false); + + if (csharpRanges.Length > 0) + { + var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + AddCSharpSpellCheckRanges(ref ranges.AsRef(), csharpRanges, codeDocument); + } + + return ConvertSpellCheckRangesToIntTriples(ranges.ToImmutable()); + } + + private static void AddRazorSpellCheckRanges(ref PooledArrayBuilder ranges, RazorSyntaxTree syntaxTree) + { + // We don't want to report spelling errors in script or style tags, so we avoid descending into them at all, which + // means we don't need complicated logic, and it performs a bit better. We assume any C# in them will still be reported + // by Roslyn. + // In an ideal world we wouldn't need this logic at all, as we would defer to the Html LSP server to provide spell checking + // but it doesn't currently support it. When that support is added, we can remove all of this but the RazorCommentBlockSyntax + // handling. + foreach (var node in syntaxTree.Root.DescendantNodes(static n => n is not MarkupElementSyntax { StartTag.Name.Content: "script" or "style" })) + { + if (node is RazorCommentBlockSyntax commentBlockSyntax) + { + ranges.Add(new((int)VSInternalSpellCheckableRangeKind.Comment, commentBlockSyntax.Comment.SpanStart, commentBlockSyntax.Comment.Span.Length)); + } + else if (node is MarkupTextLiteralSyntax textLiteralSyntax) + { + // Attribute names are text literals, but we don't want to spell check them because either C# will, + // whether they're component attributes based on property names, or they come from tag helper attribute + // parameters as strings, or they're Html attributes which are not necessarily expected to be real words. + if (node.Parent is MarkupTagHelperAttributeSyntax or + MarkupAttributeBlockSyntax or + MarkupMinimizedAttributeBlockSyntax or + MarkupTagHelperDirectiveAttributeSyntax or + MarkupMinimizedTagHelperAttributeSyntax or + MarkupMinimizedTagHelperDirectiveAttributeSyntax or + MarkupMiscAttributeContentSyntax) + { + continue; + } + + // Text literals appear everywhere in Razor to hold newlines and indentation, so its worth saving the tokens + if (textLiteralSyntax.ContainsOnlyWhitespace()) + { + continue; + } + + if (textLiteralSyntax.Span.Length == 0) + { + continue; + } + + ranges.Add(new((int)VSInternalSpellCheckableRangeKind.String, textLiteralSyntax.SpanStart, textLiteralSyntax.Span.Length)); + } + } + } + + private void AddCSharpSpellCheckRanges(ref PooledArrayBuilder ranges, ImmutableArray csharpRanges, RazorCodeDocument codeDocument) + { + var csharpDocument = codeDocument.GetCSharpDocument(); + + foreach (var report in csharpRanges) + { + var absoluteCSharpStartIndex = report.AbsoluteStartIndex; + var length = report.Length; + + // We need to map the start index to produce results, and we validate that we can map the end index so we don't have + // squiggles that go from C# into Razor/Html. + if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) && + _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3)) + { + ranges.Add(new(report.Kind, hostDocumentIndex, length)); + } + } + } + + private static int[] ConvertSpellCheckRangesToIntTriples(ImmutableArray ranges) + { + // Important to sort first as we're calculating relative indexes + ranges = ranges.OrderAsArray(CompareSpellCheckRanges); + + using var data = new PooledArrayBuilder(ranges.Length * 3); + + var lastAbsoluteEndIndex = 0; + foreach (var range in ranges) + { + if (range.Length == 0) + { + continue; + } + + data.Add(range.Kind); + data.Add(range.AbsoluteStartIndex - lastAbsoluteEndIndex); + data.Add(range.Length); + + lastAbsoluteEndIndex = range.AbsoluteStartIndex + range.Length; + } + + return data.ToArray(); + } + + private static int CompareSpellCheckRanges(SpellCheckRange x, SpellCheckRange y) + { + return x.AbsoluteStartIndex.CompareTo(y.AbsoluteStartIndex); + } +} diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs index 72f9c894e4f..5e547834463 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs @@ -7,6 +7,7 @@ using System.Linq; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.LanguageServer.EndpointContracts; +using Microsoft.CodeAnalysis.Razor.SpellCheck; using Microsoft.CodeAnalysis.Testing; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -174,7 +175,9 @@ private async Task ValidateSpellCheckRangesAsync(string originalInput, string? f var documentContext = CreateDocumentContext(uri, codeDocument); var requestContext = new RazorRequestContext(documentContext, null!, "lsp/method", uri: null); - var endpoint = new DocumentSpellCheckEndpoint(DocumentMappingService, LanguageServerFeatureOptions, languageServer); + var csharpSpellCheckService = new LspCSharpSpellCheckService(LanguageServerFeatureOptions, languageServer); + var spellCheckService = new SpellCheckService(csharpSpellCheckService, DocumentMappingService); + var endpoint = new DocumentSpellCheckEndpoint(spellCheckService); var request = new VSInternalDocumentSpellCheckableParams { From 4a44a99239697e3a5b9d5efcbf5a65ef029433da Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 3 Sep 2024 08:47:03 +1000 Subject: [PATCH 213/271] Create cohost spell check endpoints and services --- eng/targets/Services.props | 1 + .../IServiceCollectionExtensions.cs | 9 ++- .../SpellCheck/DocumentSpellCheckEndpoint.cs | 14 ++-- .../Remote/IRemoteSpellCheckService.cs | 16 ++++ .../Remote/RazorServices.cs | 1 + .../SpellCheck/OOPSpellCheckService.cs | 17 ++++ .../RemoteCSharpSpellCheckService.cs | 30 +++++++ .../SpellCheck/RemoteSpellCheckService.cs | 34 ++++++++ .../CohostDocumentSpellCheckEndpoint.cs | 80 +++++++++++++++++++ .../CohostWorkspaceSpellCheckEndpoint.cs | 34 ++++++++ 10 files changed, 226 insertions(+), 10 deletions(-) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteSpellCheckService.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs diff --git a/eng/targets/Services.props b/eng/targets/Services.props index b2476eab94a..e2db181385e 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -29,5 +29,6 @@ +
diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index bd27fef9adc..e4a7dc87af7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -158,12 +158,13 @@ public static void AddTextDocumentServices(this IServiceCollection services, Lan { services.AddHandlerWithCapabilities(); services.AddHandlerWithCapabilities(); + + services.AddSingleton(); + services.AddSingleton(); + services.AddHandlerWithCapabilities(); + services.AddHandler(); } - services.AddSingleton(); - services.AddSingleton(); - services.AddHandlerWithCapabilities(); - services.AddHandler(); services.AddHandlerWithCapabilities(); services.AddHandler(); diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index 5de64a1a7c9..aa2173d784d 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -36,11 +36,13 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellC var data = await _spellCheckService.GetSpellCheckRangeTriplesAsync(documentContext, cancellationToken).ConfigureAwait(false); - return [new VSInternalSpellCheckableRangeReport - { - Ranges =data, - ResultId = Guid.NewGuid().ToString() - } - ]; + return + [ + new VSInternalSpellCheckableRangeReport + { + Ranges =data, + ResultId = Guid.NewGuid().ToString() + } + ]; } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSpellCheckService.cs new file mode 100644 index 00000000000..f7233564653 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteSpellCheckService.cs @@ -0,0 +1,16 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; + +namespace Microsoft.CodeAnalysis.Razor.Remote; + +internal interface IRemoteSpellCheckService +{ + ValueTask GetSpellCheckRangeTriplesAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId razorDocumentId, + CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs index 558b737d4c4..a4e46afb63b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs @@ -22,6 +22,7 @@ internal static class RazorServices (typeof(IRemoteFoldingRangeService), null), (typeof(IRemoteDocumentHighlightService), null), (typeof(IRemoteAutoInsertService), null), + (typeof(IRemoteSpellCheckService), null), ]; // Internal for testing diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs new file mode 100644 index 00000000000..f34e86b686d --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs @@ -0,0 +1,17 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.SpellCheck; + +namespace Microsoft.CodeAnalysis.Remote.Razor.SpellCheck; + +[Export(typeof(ISpellCheckService)), Shared] +[method: ImportingConstructor] +internal sealed class OOPSpellCheckService( + ICSharpSpellCheckService csharpSpellCheckService, + IDocumentMappingService documentMappingService) + : SpellCheckService(csharpSpellCheckService, documentMappingService) +{ +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs new file mode 100644 index 00000000000..d2779d745ab --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using System.Composition; +using System.Diagnostics; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Razor.SpellCheck; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Remote.Razor.SpellCheck; + +[Export(typeof(ICSharpSpellCheckService)), Shared] +[method: ImportingConstructor] +internal class RemoteCSharpSpellCheckService() : ICSharpSpellCheckService +{ + public async Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken) + { + // We have a razor document, lets find the generated C# document + Debug.Assert(documentContext is RemoteDocumentContext, "This method only works on document snapshots created in the OOP process"); + var snapshot = (RemoteDocumentSnapshot)documentContext.Snapshot; + var generatedDocument = await snapshot.GetGeneratedDocumentAsync().ConfigureAwait(false); + + var csharpRanges = await ExternalAccess.Razor.Cohost.Handlers.SpellCheck.GetSpellCheckSpansAsync(generatedDocument, cancellationToken).ConfigureAwait(false); + + return csharpRanges.SelectAsArray(r => new SpellCheckRange((int)r.Kind, r.StartIndex, r.Length)); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteSpellCheckService.cs new file mode 100644 index 00000000000..161fbf7b5e3 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteSpellCheckService.cs @@ -0,0 +1,34 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Razor.SpellCheck; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; + +namespace Microsoft.CodeAnalysis.Remote.Razor; + +internal sealed partial class RemoteSpellCheckService(in ServiceArgs args) : RazorDocumentServiceBase(in args), IRemoteSpellCheckService +{ + internal sealed class Factory : FactoryBase + { + protected override IRemoteSpellCheckService CreateService(in ServiceArgs args) + => new RemoteSpellCheckService(in args); + } + + private readonly ISpellCheckService _spellCheckService = args.ExportProvider.GetExportedValue(); + + public ValueTask GetSpellCheckRangeTriplesAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId razorDocumentId, CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + razorDocumentId, + context => GetSpellCheckRangeTriplesAsync(context, cancellationToken), + cancellationToken); + + private async ValueTask GetSpellCheckRangeTriplesAsync(RemoteDocumentContext context, CancellationToken cancellationToken) + { + return await _spellCheckService.GetSpellCheckRangeTriplesAsync(context, cancellationToken).ConfigureAwait(false); + } +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs new file mode 100644 index 00000000000..9aa87a0cd69 --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs @@ -0,0 +1,80 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(VSInternalMethods.TextDocumentSpellCheckableRangesName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostDocumentSpellCheckEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostDocumentSpellCheckEndpoint( + IRemoteServiceInvoker remoteServiceInvoker) + : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.SupportsVisualStudioExtensions) + { + return new Registration + { + Method = VSInternalMethods.TextDocumentSpellCheckableRangesName, + RegisterOptions = new TextDocumentRegistrationOptions() + { + DocumentSelector = filter + } + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(VSInternalDocumentSpellCheckableParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override Task HandleRequestAsync(VSInternalDocumentSpellCheckableParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => HandleRequestAsync(context.TextDocument.AssumeNotNull(), cancellationToken); + + private async Task HandleRequestAsync(TextDocument razorDocument, CancellationToken cancellationToken) + { + var data = await _remoteServiceInvoker.TryInvokeAsync( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => service.GetSpellCheckRangeTriplesAsync(solutionInfo, razorDocument.Id, cancellationToken), + cancellationToken).ConfigureAwait(false); + + return + [ + new VSInternalSpellCheckableRangeReport + { + Ranges = data, + ResultId = Guid.NewGuid().ToString() + } + ]; + } + + internal TestAccessor GetTestAccessor() => new(this); + + internal readonly struct TestAccessor(CohostDocumentSpellCheckEndpoint instance) + { + public Task HandleRequestAsync(TextDocument razorDocument, CancellationToken cancellationToken) + => instance.HandleRequestAsync(razorDocument, cancellationToken); + } +} diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs new file mode 100644 index 00000000000..cad02498732 --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs @@ -0,0 +1,34 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Threading; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.VisualStudio.LanguageServer.Protocol; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(VSInternalMethods.WorkspaceSpellCheckableRangesName)] +[ExportCohostStatelessLspService(typeof(CohostWorkspaceSpellCheckEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal class CohostWorkspaceSpellCheckEndpoint( + IRemoteServiceInvoker remoteServiceInvoker) + : AbstractRazorCohostRequestHandler +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => false; + + // Razor files generally don't do anything at the workspace level + + protected override Task HandleRequestAsync(VSInternalWorkspaceSpellCheckableParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => SpecializedTasks.EmptyArray(); +} From 391f3227044b4de829c4fb900d06a6e79c2e5836 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 3 Sep 2024 09:31:12 +1000 Subject: [PATCH 214/271] Test --- .../TestCode.cs | 3 + .../CohostDocumentSpellCheckEndpointTest.cs | 100 ++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs index d19cbc5281e..6930bda0d33 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.Test.Common.Tooling/TestCode.cs @@ -10,6 +10,7 @@ namespace Microsoft.AspNetCore.Razor.Test.Common; internal readonly struct TestCode { + public string OriginalInput { get; } public string Text { get; } public ImmutableArray Positions { get; } @@ -17,6 +18,8 @@ internal readonly struct TestCode public TestCode(string input, bool treatPositionIndicatorsAsCode = false) { + OriginalInput = input; + if (treatPositionIndicatorsAsCode) { TestFileMarkupParser.GetSpans(input, treatPositionIndicatorsAsCode, out var text, out var nameToSpanMap); diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs new file mode 100644 index 00000000000..6711a4bdc2b --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostDocumentSpellCheckEndpointTest.cs @@ -0,0 +1,100 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis.Text; +using Roslyn.Test.Utilities; +using Xunit; +using Xunit.Abstractions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostDocumentSpellCheckEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task Handle() + { + var input = """ + @page [|"this is csharp"|] + +
[| + + Eat more chickin. + + |]
+ + + + + + @{ var [|x|] = [|"csharp"|]; + + @*[| Eat more chickin. |]*@ + +
+ + @code + { + void [|M|]() + { + [|// Eat more chickin|] + } + } + """; + + await VerifySemanticTokensAsync(input); + } + + private async Task VerifySemanticTokensAsync(TestCode input) + { + var document = CreateProjectAndRazorDocument(input.Text); + var sourceText = await document.GetTextAsync(DisposalToken); + + var endpoint = new CohostDocumentSpellCheckEndpoint(RemoteServiceInvoker); + + var span = new LinePositionSpan(new(0, 0), new(sourceText.Lines.Count, 0)); + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(document, DisposalToken); + + var ranges = result.First().Ranges.AssumeNotNull(); + + // To make for easier test failure analysis, we convert the ranges back to the test input, so we can show a diff + // rather than "Expected 23, got 53" and leave the developer to deal with what that means. + // As a bonus, this also ensures the ranges array has the right number of elements (ie, multiple of 3) + var absoluteRanges = new List<(int Start, int End)>(); + var absoluteStart = 0; + for (var i = 0; i < ranges.Length; i += 3) + { + var kind = ranges[i]; + var start = ranges[i + 1]; + var length = ranges[i + 2]; + + absoluteStart += start; + absoluteRanges.Add((absoluteStart, absoluteStart + length)); + absoluteStart += length; + } + + // Make sure the response is sorted correctly, or the IDE will complain + Assert.True(absoluteRanges.SequenceEqual(absoluteRanges.OrderBy(r => r.Start)), "Results are not in order!"); + + absoluteRanges.Reverse(); + + var actual = input.Text; + foreach (var (start, end) in absoluteRanges) + { + actual = actual.Insert(end, "|]").Insert(start, "[|"); + } + + AssertEx.EqualOrDiff(input.OriginalInput, actual); + } +} From a7cd940cd7800ce5e791ac9033d9a495f9944cf3 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 3 Sep 2024 16:21:10 +1000 Subject: [PATCH 215/271] Cohost go to implementation --- eng/targets/Services.props | 1 + .../RazorLanguageServer.cs | 4 +- .../IRemoteGoToImplementationService.cs | 19 ++ .../Remote/RazorServices.cs | 1 + .../RemoteGoToDefinitionService.cs | 15 +- .../RemoteGoToImplementationService.cs | 111 ++++++++++++ .../RazorDocumentServiceBase.cs | 33 +++- .../CohostGoToImplementationEndpoint.cs | 153 ++++++++++++++++ .../CohostGoToImplementationEndpointTest.cs | 166 ++++++++++++++++++ 9 files changed, 484 insertions(+), 19 deletions(-) create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteGoToImplementationService.cs create mode 100644 src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToImplementation/RemoteGoToImplementationService.cs create mode 100644 src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToImplementationEndpoint.cs create mode 100644 src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs diff --git a/eng/targets/Services.props b/eng/targets/Services.props index b2476eab94a..07c6ab44565 100644 --- a/eng/targets/Services.props +++ b/eng/targets/Services.props @@ -29,5 +29,6 @@ + diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs index d3162a0e5b1..f1034646716 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/RazorLanguageServer.cs @@ -184,10 +184,10 @@ static void AddHandlers(IServiceCollection services, LanguageServerFeatureOption // Transient because it should only be used once and I'm hoping it doesn't stick around. services.AddTransient(sp => sp.GetRequiredService()); - services.AddHandlerWithCapabilities(); - if (!featureOptions.UseRazorCohostServer) { + services.AddHandlerWithCapabilities(); + services.AddSingleton(); services.AddHandlerWithCapabilities(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteGoToImplementationService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteGoToImplementationService.cs new file mode 100644 index 00000000000..41311404578 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteGoToImplementationService.cs @@ -0,0 +1,19 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using RoslynLocation = Roslyn.LanguageServer.Protocol.Location; +using RoslynPosition = Roslyn.LanguageServer.Protocol.Position; + +namespace Microsoft.CodeAnalysis.Razor.Remote; + +internal interface IRemoteGoToImplementationService : IRemoteJsonService +{ + ValueTask> GetImplementationAsync( + JsonSerializableRazorPinnedSolutionInfoWrapper solutionInfo, + JsonSerializableDocumentId razorDocumentId, + RoslynPosition position, + CancellationToken cancellationToken); +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs index 558b737d4c4..1a86184e8a2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/RazorServices.cs @@ -32,6 +32,7 @@ internal static class RazorServices (typeof(IRemoteInlayHintService), null), (typeof(IRemoteDocumentSymbolService), null), (typeof(IRemoteRenameService), null), + (typeof(IRemoteGoToImplementationService), null), ]; private const string ComponentName = "Razor"; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToDefinition/RemoteGoToDefinitionService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToDefinition/RemoteGoToDefinitionService.cs index 58d6abd3e0a..6169c994349 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToDefinition/RemoteGoToDefinitionService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToDefinition/RemoteGoToDefinitionService.cs @@ -58,20 +58,7 @@ protected override IRemoteGoToDefinitionService CreateService(in ServiceArgs arg return NoFurtherHandling; } - var positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex); - - if (positionInfo.LanguageKind == RazorLanguageKind.Html) - { - // Sometimes Html can actually be mapped to C#, like for example component attributes, which map to - // C# properties, even though they appear entirely in a Html context. Since remapping is pretty cheap - // it's easier to just try mapping, and see what happens, rather than checking for specific syntax nodes. - if (DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out VsPosition? csharpPosition, out _)) - { - // We're just gonna pretend this mapped perfectly normally onto C#. Moving this logic to the actual position info - // calculating code is possible, but could have untold effects, so opt-in is better (for now?) - positionInfo = positionInfo with { LanguageKind = RazorLanguageKind.CSharp, Position = csharpPosition }; - } - } + var positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex, preferCSharpOverHtml: true); if (positionInfo.LanguageKind is RazorLanguageKind.Html or RazorLanguageKind.Razor) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToImplementation/RemoteGoToImplementationService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToImplementation/RemoteGoToImplementationService.cs new file mode 100644 index 00000000000..7121cd6dbf0 --- /dev/null +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/GoToImplementation/RemoteGoToImplementationService.cs @@ -0,0 +1,111 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Language; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Protocol; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Remote.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Roslyn.LanguageServer.Protocol; +using static Microsoft.CodeAnalysis.Razor.Remote.RemoteResponse; +using ExternalHandlers = Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost.Handlers; +using RoslynLocation = Roslyn.LanguageServer.Protocol.Location; +using RoslynPosition = Roslyn.LanguageServer.Protocol.Position; +using VsPosition = Microsoft.VisualStudio.LanguageServer.Protocol.Position; + +namespace Microsoft.CodeAnalysis.Remote.Razor; + +internal sealed class RemoteGoToImplementationService(in ServiceArgs args) : RazorDocumentServiceBase(in args), IRemoteGoToImplementationService +{ + internal sealed class Factory : FactoryBase + { + protected override IRemoteGoToImplementationService CreateService(in ServiceArgs args) + => new RemoteGoToImplementationService(in args); + } + + protected override IDocumentPositionInfoStrategy DocumentPositionInfoStrategy => PreferAttributeNameDocumentPositionInfoStrategy.Instance; + + public ValueTask> GetImplementationAsync( + JsonSerializableRazorPinnedSolutionInfoWrapper solutionInfo, + JsonSerializableDocumentId documentId, + RoslynPosition position, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => GetImplementationAsync(context, position, cancellationToken), + cancellationToken); + + private async ValueTask> GetImplementationAsync( + RemoteDocumentContext context, + RoslynPosition position, + CancellationToken cancellationToken) + { + var codeDocument = await context.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); + + if (!codeDocument.Source.Text.TryGetAbsoluteIndex(position, out var hostDocumentIndex)) + { + return NoFurtherHandling; + } + + var positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex, preferCSharpOverHtml: true); + + if (positionInfo.LanguageKind is RazorLanguageKind.Razor) + { + return NoFurtherHandling; + } + + if (positionInfo.LanguageKind is RazorLanguageKind.Html) + { + return CallHtml; + } + + if (!DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out var mappedPosition, out _)) + { + // If we can't map to the generated C# file, we're done. + return NoFurtherHandling; + } + + // Finally, call into C#. + var generatedDocument = await context.Snapshot.GetGeneratedDocumentAsync().ConfigureAwait(false); + + var locations = await ExternalHandlers.GoToImplementation + .FindImplementationsAsync( + generatedDocument, + mappedPosition, + supportsVisualStudioExtensions: true, + cancellationToken) + .ConfigureAwait(false); + + if (locations is null and not []) + { + // C# didn't return anything, so we're done. + return NoFurtherHandling; + } + + // Map the C# locations back to the Razor file. + using var mappedLocations = new PooledArrayBuilder(locations.Length); + + foreach (var location in locations) + { + var (uri, range) = location; + + var (mappedDocumentUri, mappedRange) = await DocumentMappingService + .MapToHostDocumentUriAndRangeAsync(context.Snapshot, uri, range.ToLinePositionSpan(), cancellationToken) + .ConfigureAwait(false); + + var mappedLocation = RoslynLspFactory.CreateLocation(mappedDocumentUri, mappedRange); + + mappedLocations.Add(mappedLocation); + } + + return Results(mappedLocations.ToArray()); + } +} diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorDocumentServiceBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorDocumentServiceBase.cs index 9327d9931e7..557fc66d271 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorDocumentServiceBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/RazorDocumentServiceBase.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.CodeAnalysis.ExternalAccess.Razor; using Microsoft.CodeAnalysis.Razor.DocumentMapping; +using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.CodeAnalysis.Remote.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -24,11 +25,34 @@ internal abstract class RazorDocumentServiceBase(in ServiceArgs args) : RazorBro protected virtual IDocumentPositionInfoStrategy DocumentPositionInfoStrategy { get; } = DefaultDocumentPositionInfoStrategy.Instance; protected DocumentPositionInfo GetPositionInfo(RazorCodeDocument codeDocument, int hostDocumentIndex) + => GetPositionInfo(codeDocument, hostDocumentIndex, preferCSharpOverHtml: false); + + protected DocumentPositionInfo GetPositionInfo(RazorCodeDocument codeDocument, int hostDocumentIndex, bool preferCSharpOverHtml) { - return DocumentPositionInfoStrategy.GetPositionInfo(DocumentMappingService, codeDocument, hostDocumentIndex); + var positionInfo = DocumentPositionInfoStrategy.GetPositionInfo(DocumentMappingService, codeDocument, hostDocumentIndex); + + if (preferCSharpOverHtml && positionInfo.LanguageKind == RazorLanguageKind.Html) + { + // Sometimes Html can actually be mapped to C#, like for example component attributes, which map to + // C# properties, even though they appear entirely in a Html context. Since remapping is pretty cheap + // it's easier to just try mapping, and see what happens, rather than checking for specific syntax nodes. + if (DocumentMappingService.TryMapToGeneratedDocumentPosition(codeDocument.GetCSharpDocument(), positionInfo.HostDocumentIndex, out VsPosition? csharpPosition, out _)) + { + // We're just gonna pretend this mapped perfectly normally onto C#. Moving this logic to the actual position info + // calculating code is possible, but could have untold effects, so opt-in is better (for now?) + + // TODO: Not using a with operator here because it doesn't work in OOP for some reason. + positionInfo = new DocumentPositionInfo(RazorLanguageKind.CSharp, csharpPosition, positionInfo.HostDocumentIndex); + } + } + + return positionInfo; } protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, RoslynPosition position, out DocumentPositionInfo positionInfo) + => TryGetDocumentPositionInfo(codeDocument, position, preferCSharpOverHtml: false, out positionInfo); + + protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, RoslynPosition position, bool preferCSharpOverHtml, out DocumentPositionInfo positionInfo) { if (!codeDocument.Source.Text.TryGetAbsoluteIndex(position, out var hostDocumentIndex)) { @@ -36,11 +60,14 @@ protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, Roslyn return false; } - positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex); + positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex, preferCSharpOverHtml); return true; } protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, VsPosition position, out DocumentPositionInfo positionInfo) + => TryGetDocumentPositionInfo(codeDocument, position, preferCSharpOverHtml: false, out positionInfo); + + protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, VsPosition position, bool preferCSharpOverHtml, out DocumentPositionInfo positionInfo) { if (!codeDocument.Source.Text.TryGetAbsoluteIndex(position, out var hostDocumentIndex)) { @@ -48,7 +75,7 @@ protected bool TryGetDocumentPositionInfo(RazorCodeDocument codeDocument, VsPosi return false; } - positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex); + positionInfo = GetPositionInfo(codeDocument, hostDocumentIndex, preferCSharpOverHtml); return true; } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToImplementationEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToImplementationEndpoint.cs new file mode 100644 index 00000000000..be8e197bbbd --- /dev/null +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToImplementationEndpoint.cs @@ -0,0 +1,153 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Composition; +using System.Threading; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; +using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Razor.Workspaces; +using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using RoslynLspFactory = Roslyn.LanguageServer.Protocol.RoslynLspFactory; +using RoslynLspLocation = Roslyn.LanguageServer.Protocol.Location; +using VsLspLocation = Microsoft.VisualStudio.LanguageServer.Protocol.Location; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +#pragma warning disable RS0030 // Do not use banned APIs +[Shared] +[CohostEndpoint(Methods.TextDocumentImplementationName)] +[Export(typeof(IDynamicRegistrationProvider))] +[ExportCohostStatelessLspService(typeof(CohostGoToImplementationEndpoint))] +[method: ImportingConstructor] +#pragma warning restore RS0030 // Do not use banned APIs +internal sealed class CohostGoToImplementationEndpoint( + IRemoteServiceInvoker remoteServiceInvoker, + IHtmlDocumentSynchronizer htmlDocumentSynchronizer, + LSPRequestInvoker requestInvoker, + IFilePathService filePathService) + : AbstractRazorCohostDocumentRequestHandler?>, IDynamicRegistrationProvider +{ + private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; + private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; + private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly IFilePathService _filePathService = filePathService; + + protected override bool MutatesSolutionState => false; + + protected override bool RequiresLSPSolution => true; + + public Registration? GetRegistration(VSInternalClientCapabilities clientCapabilities, DocumentFilter[] filter, RazorCohostRequestContext requestContext) + { + if (clientCapabilities.TextDocument?.Implementation?.DynamicRegistration == true) + { + return new Registration + { + Method = Methods.TextDocumentImplementationName, + RegisterOptions = new ImplementationOptions() + }; + } + + return null; + } + + protected override RazorTextDocumentIdentifier? GetRazorTextDocumentIdentifier(TextDocumentPositionParams request) + => request.TextDocument.ToRazorTextDocumentIdentifier(); + + protected override Task?> HandleRequestAsync(TextDocumentPositionParams request, RazorCohostRequestContext context, CancellationToken cancellationToken) + => HandleRequestAsync( + request, + context.TextDocument.AssumeNotNull(), + cancellationToken); + + private async Task?> HandleRequestAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var position = RoslynLspFactory.CreatePosition(request.Position.ToLinePosition()); + + var response = await _remoteServiceInvoker + .TryInvokeAsync>( + razorDocument.Project.Solution, + (service, solutionInfo, cancellationToken) => + service.GetImplementationAsync(solutionInfo, razorDocument.Id, position, cancellationToken), + cancellationToken) + .ConfigureAwait(false); + + if (response.Result is RoslynLspLocation[] locations) + { + return locations; + } + + if (response.StopHandling) + { + return null; + } + + return await GetHtmlImplementationsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); + } + + private async Task?> GetHtmlImplementationsAsync(TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken) + { + var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); + if (htmlDocument is null) + { + return null; + } + + request.TextDocument = request.TextDocument.WithUri(htmlDocument.Uri); + + var result = await _requestInvoker + .ReinvokeRequestOnServerAsync?>( + htmlDocument.Buffer, + Methods.TextDocumentImplementationName, + RazorLSPConstants.HtmlLanguageServerName, + request, + cancellationToken) + .ConfigureAwait(false); + + if (result is not { Response: { } response }) + { + return null; + } + + if (response.TryGetFirst(out var locations)) + { + foreach (var location in locations) + { + RemapVirtualHtmlUri(location); + } + + return locations; + } + else if (response.TryGetSecond(out var referenceItems)) + { + foreach (var referenceItem in referenceItems) + { + RemapVirtualHtmlUri(referenceItem.Location); + } + + return referenceItems; + } + + return null; + } + + private void RemapVirtualHtmlUri(VsLspLocation location) + { + if (_filePathService.IsVirtualHtmlFile(location.Uri)) + { + location.Uri = _filePathService.GetRazorDocumentUri(location.Uri); + } + } + + internal TestAccessor GetTestAccessor() => new(this); + + internal readonly struct TestAccessor(CohostGoToImplementationEndpoint instance) + { + public Task?> HandleRequestAsync( + TextDocumentPositionParams request, TextDocument razorDocument, CancellationToken cancellationToken) + => instance.HandleRequestAsync(request, razorDocument, cancellationToken); + } +} diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs new file mode 100644 index 00000000000..170ca71d6a6 --- /dev/null +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs @@ -0,0 +1,166 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Razor.Test.Common; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Remote.Razor; +using Microsoft.CodeAnalysis.Text; +using Microsoft.VisualStudio.LanguageServer.Protocol; +using Xunit; +using Xunit.Abstractions; +using LspLocation = Microsoft.VisualStudio.LanguageServer.Protocol.Location; +using RoslynLspExtensions = Roslyn.LanguageServer.Protocol.RoslynLspExtensions; + +namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; + +public class CohostGoToImplementationEndpointTest(ITestOutputHelper testOutputHelper) : CohostEndpointTestBase(testOutputHelper) +{ + [Fact] + public async Task CSharp_Method() + { + var input = """ +
+ + @{ + var x = Ge$$tX(); + } + + @code + { + void [|GetX|]() + { + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task CSharp_Field() + { + var input = """ +
+ + @{ + var x = GetX(); + } + + @code + { + private string [|_name|]; + + string GetX() + { + return _na$$me; + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task CSharp_Multiple() + { + var input = """ +
+ + @code + { + class [|Base|] { } + class [|Derived1|] : Base { } + class [|Derived2|] : Base { } + + void M(Ba$$se b) + { + } + } + """; + + await VerifyCSharpGoToImplementationAsync(input); + } + + [Fact] + public async Task Html() + { + // This really just validates Uri remapping, the actual response is largely arbitrary + + TestCode input = """ +
+ + + """; + + var document = CreateProjectAndRazorDocument(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlResponse = new SumType?(new LspLocation[] + { + new LspLocation + { + Uri = new Uri(document.CreateUri(), document.Name + FeatureOptions.HtmlVirtualDocumentSuffix), + Range = inputText.GetRange(input.Span), + }, + }); + + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentImplementationName, htmlResponse)]); + + await VerifyGoToImplementationResultAsync(input, document, requestInvoker); + } + + private async Task VerifyCSharpGoToImplementationAsync(TestCode input) + { + var document = CreateProjectAndRazorDocument(input.Text); + + var requestInvoker = new TestLSPRequestInvoker(); + + await VerifyGoToImplementationResultAsync(input, document, requestInvoker); + } + + private async Task VerifyGoToImplementationResultAsync(TestCode input, TextDocument document, TestLSPRequestInvoker requestInvoker) + { + var inputText = await document.GetTextAsync(DisposalToken); + + var filePathService = new RemoteFilePathService(FeatureOptions); + var endpoint = new CohostGoToImplementationEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, filePathService); + + var position = inputText.GetPosition(input.Position); + var textDocumentPositionParams = new TextDocumentPositionParams + { + Position = position, + TextDocument = new TextDocumentIdentifier { Uri = document.CreateUri() }, + }; + + var result = await endpoint.GetTestAccessor().HandleRequestAsync(textDocumentPositionParams, document, DisposalToken); + + if (result.Value.TryGetFirst(out var roslynLocations)) + { + var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + var actual = roslynLocations.Select(l => RoslynLspExtensions.ToLinePositionSpan(l.Range)).OrderBy(r => r.Start.Line).ToArray(); + Assert.Equal(expected, actual); + + Assert.All(roslynLocations, l => l.Uri.Equals(document.CreateUri())); + } + else if (result.Value.TryGetSecond(out var vsLocations)) + { + var expected = input.Spans.Select(s => inputText.GetRange(s).ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + var actual = vsLocations.Select(l => l.Range.ToLinePositionSpan()).OrderBy(r => r.Start.Line).ToArray(); + Assert.Equal(expected, actual); + + Assert.All(vsLocations, l => l.Uri.Equals(document.CreateUri())); + } + else + { + Assert.Fail($"Unsupported result type: {result.Value.GetType()}"); + } + } +} From 1e82de71fe84cb32730c50976201825f385badc1 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 3 Sep 2024 16:54:11 +1000 Subject: [PATCH 216/271] Add failing test, and add verification to existing tests --- .../CohostGoToDefinitionEndpointTest.cs | 60 +++++++++++++++++-- 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs index 1c61c7d714f..b0ac0d7e9d3 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -14,6 +15,7 @@ using RoslynDocumentLink = Roslyn.LanguageServer.Protocol.DocumentLink; using RoslynLocation = Roslyn.LanguageServer.Protocol.Location; using RoslynLspExtensions = Roslyn.LanguageServer.Protocol.RoslynLspExtensions; +using TextDocument = Microsoft.CodeAnalysis.TextDocument; namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; @@ -157,7 +159,7 @@ public partial class SurveyPrompt : ComponentBase """; var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, - (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); Assert.NotNull(result.Value.Second); @@ -283,7 +285,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #endregion var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, - (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); Assert.NotNull(result.Value.Second); @@ -295,24 +297,70 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. Assert.Equal(range, location.Range); } + [Fact] + public async Task Html() + { + // This really just validates Uri remapping, the actual response is largely arbitrary + + TestCode input = """ +
+ + + """; + + var document = CreateProjectAndRazorDocument(input.Text); + var inputText = await document.GetTextAsync(DisposalToken); + + var htmlResponse = new SumType?(new Location[] + { + new Location + { + Uri = new Uri(document.CreateUri(), document.Name + FeatureOptions.HtmlVirtualDocumentSuffix), + Range = inputText.GetRange(input.Span), + }, + }); + + await VerifyGoToDefinitionAsync(input, htmlResponse: htmlResponse); + } + private static string FileName(string projectRelativeFileName) => Path.Combine(TestProjectData.SomeProjectPath, projectRelativeFileName); - private async Task VerifyGoToDefinitionAsync(TestCode input, string? fileKind = null, params (string fileName, string contents)[]? additionalFiles) + private async Task VerifyGoToDefinitionAsync(TestCode input, string? fileKind = null, SumType? htmlResponse = null) { - var result = await GetGoToDefinitionResultAsync(input, fileKind, additionalFiles); + var document = CreateProjectAndRazorDocument(input.Text, fileKind); + var result = await GetGoToDefinitionResultAsync(document, input, htmlResponse); Assumes.NotNull(result); + + Assert.NotNull(result.Value.Second); + var locations = result.Value.Second; + var location = Assert.Single(locations); + + var text = SourceText.From(input.Text); + var range = RoslynLspExtensions.GetRange(text, input.Span); + Assert.Equal(range, location.Range); + + Assert.Equal(document.CreateUri(), location.Uri); } - private async Task?> GetGoToDefinitionResultAsync( + private Task?> GetGoToDefinitionResultAsync( TestCode input, string? fileKind = null, params (string fileName, string contents)[]? additionalFiles) { var document = CreateProjectAndRazorDocument(input.Text, fileKind, additionalFiles); + return GetGoToDefinitionResultAsync(document, input, htmlResponse: null); + } + private async Task?> GetGoToDefinitionResultAsync( + TextDocument document, TestCode input, SumType? htmlResponse) + { var inputText = await document.GetTextAsync(DisposalToken); var position = inputText.GetPosition(input.Position); - var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentDefinitionName, null)]); + var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentDefinitionName, htmlResponse)]); var endpoint = new CohostGoToDefinitionEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker); From f867a039260f841791ebeb96a5e729a1ae0be608 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 3 Sep 2024 16:57:46 +1000 Subject: [PATCH 217/271] Remap Html uris if we get them --- .../Cohost/CohostGoToDefinitionEndpoint.cs | 22 +++++++++++++++---- .../CohostGoToDefinitionEndpointTest.cs | 4 +++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToDefinitionEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToDefinitionEndpoint.cs index fbab17f6a38..a13efe7ba4a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToDefinitionEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostGoToDefinitionEndpoint.cs @@ -10,6 +10,7 @@ using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; using Microsoft.CodeAnalysis.Razor.Remote; +using Microsoft.CodeAnalysis.Razor.Workspaces; using Microsoft.VisualStudio.LanguageServer.ContainedLanguage; using Microsoft.VisualStudio.LanguageServer.Protocol; using static Roslyn.LanguageServer.Protocol.RoslynLspExtensions; @@ -30,12 +31,14 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; internal sealed class CohostGoToDefinitionEndpoint( IRemoteServiceInvoker remoteServiceInvoker, IHtmlDocumentSynchronizer htmlDocumentSynchronizer, - LSPRequestInvoker requestInvoker) + LSPRequestInvoker requestInvoker, + IFilePathService filePathService) : AbstractRazorCohostDocumentRequestHandler?>, IDynamicRegistrationProvider { private readonly IRemoteServiceInvoker _remoteServiceInvoker = remoteServiceInvoker; private readonly IHtmlDocumentSynchronizer _htmlDocumentSynchronizer = htmlDocumentSynchronizer; private readonly LSPRequestInvoker _requestInvoker = requestInvoker; + private readonly IFilePathService _filePathService = filePathService; protected override bool MutatesSolutionState => false; @@ -115,11 +118,11 @@ internal sealed class CohostGoToDefinitionEndpoint( if (response.TryGetFirst(out var singleLocation)) { - return RoslynLspFactory.CreateLocation(singleLocation.Uri, singleLocation.Range.ToLinePositionSpan()); + return RoslynLspFactory.CreateLocation(RemapVirtualHtmlUri(singleLocation.Uri), singleLocation.Range.ToLinePositionSpan()); } else if (response.TryGetSecond(out var multipleLocations)) { - return Array.ConvertAll(multipleLocations, static l => RoslynLspFactory.CreateLocation(l.Uri, l.Range.ToLinePositionSpan())); + return Array.ConvertAll(multipleLocations, l => RoslynLspFactory.CreateLocation(RemapVirtualHtmlUri(l.Uri), l.Range.ToLinePositionSpan())); } else if (response.TryGetThird(out var documentLinks)) { @@ -129,7 +132,7 @@ internal sealed class CohostGoToDefinitionEndpoint( { if (documentLink.Target is Uri target) { - builder.Add(RoslynLspFactory.CreateDocumentLink(target, documentLink.Range.ToLinePositionSpan())); + builder.Add(RoslynLspFactory.CreateDocumentLink(RemapVirtualHtmlUri(target), documentLink.Range.ToLinePositionSpan())); } } @@ -139,6 +142,17 @@ internal sealed class CohostGoToDefinitionEndpoint( return null; } + private Uri RemapVirtualHtmlUri(Uri uri) + { + if (_filePathService.IsVirtualHtmlFile(uri)) + { + return _filePathService.GetRazorDocumentUri(uri); + } + + return uri; + } + + internal TestAccessor GetTestAccessor() => new(this); internal readonly struct TestAccessor(CohostGoToDefinitionEndpoint instance) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs index b0ac0d7e9d3..7e0cc0a8b1e 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs @@ -8,6 +8,7 @@ using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Test.Common; using Microsoft.CodeAnalysis.ExternalAccess.Razor; +using Microsoft.CodeAnalysis.Remote.Razor; using Microsoft.CodeAnalysis.Text; using Microsoft.VisualStudio.LanguageServer.Protocol; using Xunit; @@ -362,7 +363,8 @@ private async Task VerifyGoToDefinitionAsync(TestCode input, string? fileKind = var requestInvoker = new TestLSPRequestInvoker([(Methods.TextDocumentDefinitionName, htmlResponse)]); - var endpoint = new CohostGoToDefinitionEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker); + var filePathService = new VisualStudioFilePathService(FeatureOptions); + var endpoint = new CohostGoToDefinitionEndpoint(RemoteServiceInvoker, TestHtmlDocumentSynchronizer.Instance, requestInvoker, filePathService); var textDocumentPositionParams = new TextDocumentPositionParams { From 277c780a686d629913b9bd5c985d0c58b661fcde Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 3 Sep 2024 10:53:32 -0700 Subject: [PATCH 218/271] Clarify [EventHandler] tag helper discovery logic and avoid exception --- ...EventHandlerTagHelperDescriptorProvider.cs | 66 +++-- ...tHandlerTagHelperDescriptorProviderTest.cs | 267 ++++++++++++++++-- 2 files changed, 290 insertions(+), 43 deletions(-) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs index f89840fde8b..ff052c408d2 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/EventHandlerTagHelperDescriptorProvider.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; +using System.Collections.Immutable; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; using Microsoft.AspNetCore.Razor.Language.Components; @@ -54,14 +55,14 @@ protected override void Collect(ISymbol symbol, ICollection { if (SymbolEqualityComparer.Default.Equals(attribute.AttributeClass, _eventHandlerAttribute)) { - if (!AttributeArgs.TryGet(attribute, out var values)) + if (!AttributeArgs.TryGet(attribute, out var args)) { - // If this occurs, the EventHandlerAttribute type has been broken. - Assumed.Unreachable(); + // If this occurs, the [EventHandler] was defined incorrectly, so we can't create a tag helper. + continue; } var (typeName, namespaceName) = displayNames.GetNames(); - results.Add(CreateTagHelper(typeName, namespaceName, type.Name, values)); + results.Add(CreateTagHelper(typeName, namespaceName, type.Name, args)); } } } @@ -70,8 +71,8 @@ protected override void Collect(ISymbol symbol, ICollection private readonly record struct AttributeArgs( string Attribute, INamedTypeSymbol EventArgsType, - bool EnableStopPropagation, - bool EnablePreventDefault) + bool EnableStopPropagation = false, + bool EnablePreventDefault = false) { public static bool TryGet(AttributeData attribute, out AttributeArgs args) { @@ -80,34 +81,49 @@ public static bool TryGet(AttributeData attribute, out AttributeArgs args) // - EventHandlerAttribute(string attributeName, Type eventArgsType); // - EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault); - args = default; - var arguments = attribute.ConstructorArguments; - if (arguments.Length is not (2 or 4)) - { - return false; - } + return TryGetFromTwoArguments(arguments, out args) || + TryGetFromFourArguments(arguments, out args); - if (arguments[0] is not { Value: string attributeName } || - arguments[1] is not { Value: INamedTypeSymbol eventArgsType }) + static bool TryGetFromTwoArguments(ImmutableArray arguments, out AttributeArgs args) { + // Ctor 1: EventHandlerAttribute(string attributeName, Type eventArgsType); + + if (arguments is [ + { Value: string attributeName }, + { Value: INamedTypeSymbol eventArgsType }]) + { + args = new(attributeName, eventArgsType); + return true; + } + + args = default; return false; } - // TODO: The enablePreventDefault and enableStopPropagation arguments are incorrectly swapped! - // However, they have been that way since the 4-argument constructor variant was introduced - // in https://github.com/dotnet/razor/commit/7635bba6ef2d3e6798d0846ceb96da6d5908e1b0. - // Fixing this is tracked be https://github.com/dotnet/razor/issues/10497 - - if (arguments is not [.., { Value: bool enablePreventDefault }, { Value: bool enableStopPropagation }]) + static bool TryGetFromFourArguments(ImmutableArray arguments, out AttributeArgs args) { - enableStopPropagation = false; - enablePreventDefault = false; - } + // Ctor 2: EventHandlerAttribute(string attributeName, Type eventArgsType, bool enableStopPropagation, bool enablePreventDefault); + + // TODO: The enablePreventDefault and enableStopPropagation arguments are incorrectly swapped! + // However, they have been that way since the 4-argument constructor variant was introduced + // in https://github.com/dotnet/razor/commit/7635bba6ef2d3e6798d0846ceb96da6d5908e1b0. + // Fixing this is tracked be https://github.com/dotnet/razor/issues/10497 + + if (arguments is [ + { Value: string attributeName }, + { Value: INamedTypeSymbol eventArgsType }, + { Value: bool enablePreventDefault }, + { Value: bool enableStopPropagation }]) + { + args = new(attributeName, eventArgsType, enableStopPropagation, enablePreventDefault); + return true; + } - args = new(attributeName, eventArgsType, enableStopPropagation, enablePreventDefault); - return true; + args = default; + return false; + } } } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs index 101927ad544..397035db55b 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor/test/EventHandlerTagHelperDescriptorProviderTest.cs @@ -1,8 +1,6 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. -#nullable disable - using System.Collections.Generic; using System.Linq; using Microsoft.AspNetCore.Razor.Language; @@ -14,22 +12,22 @@ namespace Microsoft.CodeAnalysis.Razor; public class EventHandlerTagHelperDescriptorProviderTest : TagHelperDescriptorProviderTestBase { [Fact] - public void Execute_EventHandler_CreatesDescriptor() + public void Execute_EventHandler_TwoArgumentsCreatesDescriptor() { // Arrange - var compilation = BaseCompilation.AddSyntaxTrees(Parse(@" -using System; -using Microsoft.AspNetCore.Components; -using Microsoft.AspNetCore.Components.Web; + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; -namespace Test -{ - [EventHandler(""onclick"", typeof(Action))] - public class EventHandlers - { - } -} -")); + namespace Test + { + [EventHandler("onclick", typeof(Action))] + public class EventHandlers + { + } + } + """)); Assert.Empty(compilation.GetDiagnostics()); @@ -102,9 +100,9 @@ public class EventHandlers Assert.Collection( attribute.Metadata.OrderBy(kvp => kvp.Key), - kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), - kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), - kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), + kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); Assert.Equal( "Sets the '@onclick' attribute to the provided string or delegate value. " + @@ -122,6 +120,239 @@ public class EventHandlers Assert.False(attribute.IsEnum); } + [Fact] + public void Execute_EventHandler_FourArgumentsCreatesDescriptorWithDiagnostic() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick", typeof(Action), true, true)] + public class EventHandlers + { + } + } + """)); + + Assert.Empty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + var item = Assert.Single(matches); + + // These are features Event Handler Tag Helpers don't use. Verifying them once here and + // then ignoring them. + Assert.Empty(item.AllowedChildTags); + Assert.Null(item.TagOutputHint); + + // These are features that are invariants of all Event Handler Helpers. Verifying them once + // here and then ignoring them. + Assert.Empty(item.Diagnostics); + Assert.False(item.HasErrors); + Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, item.Kind); + Assert.Equal(bool.TrueString, item.Metadata[TagHelperMetadata.Common.ClassifyAttributesOnly]); + Assert.Equal(ComponentMetadata.EventHandler.RuntimeName, item.Metadata[TagHelperMetadata.Runtime.Name]); + Assert.False(item.IsDefaultKind()); + Assert.False(item.KindUsesDefaultTagHelperRuntime()); + Assert.False(item.IsComponentOrChildContentTagHelper); + Assert.True(item.CaseSensitive); + + Assert.Equal( + "Sets the '@onclick' attribute to the provided string or delegate value. " + + "A delegate value should be of type 'System.Action'.", + item.Documentation); + + // These are all trivially derived from the assembly/namespace/type name + Assert.Equal("Microsoft.AspNetCore.Components", item.AssemblyName); + Assert.Equal("onclick", item.Name); + Assert.Equal("Test.EventHandlers", item.DisplayName); + Assert.Equal("Test.EventHandlers", item.GetTypeName()); + + Assert.Equal(3, item.TagMatchingRules.Length); + + var catchAllRule = item.TagMatchingRules[0]; + Assert.Empty(catchAllRule.Diagnostics); + Assert.False(catchAllRule.HasErrors); + Assert.Null(catchAllRule.ParentTag); + Assert.Equal("*", catchAllRule.TagName); + Assert.Equal(TagStructure.Unspecified, catchAllRule.TagStructure); + + var catchAllRequiredAttribute = Assert.Single(catchAllRule.Attributes); + Assert.Empty(catchAllRequiredAttribute.Diagnostics); + Assert.Equal("@onclick", catchAllRequiredAttribute.DisplayName); + Assert.Equal("@onclick", catchAllRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, catchAllRequiredAttribute.NameComparison); + Assert.Null(catchAllRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, catchAllRequiredAttribute.ValueComparison); + + var preventDefaultRule = item.TagMatchingRules[1]; + Assert.Empty(preventDefaultRule.Diagnostics); + Assert.False(preventDefaultRule.HasErrors); + Assert.Null(preventDefaultRule.ParentTag); + Assert.Equal("*", preventDefaultRule.TagName); + Assert.Equal(TagStructure.Unspecified, preventDefaultRule.TagStructure); + + var preventDefaultRequiredAttribute = Assert.Single(preventDefaultRule.Attributes); + Assert.Empty(preventDefaultRequiredAttribute.Diagnostics); + Assert.Equal("@onclick:preventDefault", preventDefaultRequiredAttribute.DisplayName); + Assert.Equal("@onclick:preventDefault", preventDefaultRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, preventDefaultRequiredAttribute.NameComparison); + Assert.Null(preventDefaultRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, preventDefaultRequiredAttribute.ValueComparison); + + var stopPropagationRule = item.TagMatchingRules[2]; + Assert.Empty(stopPropagationRule.Diagnostics); + Assert.False(stopPropagationRule.HasErrors); + Assert.Null(stopPropagationRule.ParentTag); + Assert.Equal("*", stopPropagationRule.TagName); + Assert.Equal(TagStructure.Unspecified, stopPropagationRule.TagStructure); + + var stopPropagationRequiredAttribute = Assert.Single(stopPropagationRule.Attributes); + Assert.Empty(stopPropagationRequiredAttribute.Diagnostics); + Assert.Equal("@onclick:stopPropagation", stopPropagationRequiredAttribute.DisplayName); + Assert.Equal("@onclick:stopPropagation", stopPropagationRequiredAttribute.Name); + Assert.Equal(RequiredAttributeDescriptor.NameComparisonMode.FullMatch, stopPropagationRequiredAttribute.NameComparison); + Assert.Null(stopPropagationRequiredAttribute.Value); + Assert.Equal(RequiredAttributeDescriptor.ValueComparisonMode.None, stopPropagationRequiredAttribute.ValueComparison); + + var attribute = Assert.Single(item.BoundAttributes); + + // Invariants + Assert.Empty(attribute.Diagnostics); + Assert.False(attribute.HasErrors); + Assert.Equal(ComponentMetadata.EventHandler.TagHelperKind, attribute.Kind); + Assert.False(attribute.IsDefaultKind()); + Assert.False(attribute.HasIndexer); + Assert.Null(attribute.IndexerNamePrefix); + Assert.Null(attribute.IndexerTypeName); + Assert.False(attribute.IsIndexerBooleanProperty); + Assert.False(attribute.IsIndexerStringProperty); + + Assert.Collection( + attribute.Metadata.OrderBy(kvp => kvp.Key), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Common.DirectiveAttribute, bool.TrueString)), + kvp => Assert.Equal(kvp, new KeyValuePair("Common.PropertyName", "onclick")), + kvp => Assert.Equal(kvp, new KeyValuePair(ComponentMetadata.Component.WeaklyTypedKey, bool.TrueString))); + + Assert.Equal( + "Sets the '@onclick' attribute to the provided string or delegate value. " + + "A delegate value should be of type 'System.Action'.", + attribute.Documentation); + + Assert.Equal("@onclick", attribute.Name); + Assert.Equal("onclick", attribute.GetPropertyName()); + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback> Test.EventHandlers.onclick", attribute.DisplayName); + + // Defined from the property type + Assert.Equal("Microsoft.AspNetCore.Components.EventCallback>", attribute.TypeName); + Assert.False(attribute.IsStringProperty); + Assert.False(attribute.IsBooleanProperty); + Assert.False(attribute.IsEnum); + } + + [Fact] + public void Execute_EventHandler_NoArgumentsDoesNotCreateDescriptor() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + + [Fact] + public void Execute_EventHandler_OneArgumentDoesNotCreateDescriptor() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick")] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + + [Fact] + public void Execute_EventHandler_ThreeArgumentsDoesNotCreateDiagnostic() + { + // Arrange + var compilation = BaseCompilation.AddSyntaxTrees(Parse(""" + using System; + using Microsoft.AspNetCore.Components; + using Microsoft.AspNetCore.Components.Web; + + namespace Test + { + [EventHandler("onclick", typeof(Action), true)] + public class EventHandlers + { + } + } + """)); + + Assert.NotEmpty(compilation.GetDiagnostics()); + + var context = new TagHelperDescriptorProviderContext(compilation); + var provider = new EventHandlerTagHelperDescriptorProvider(); + + // Act + provider.Execute(context); + + // Assert + var matches = GetEventHandlerTagHelpers(context); + Assert.Empty(matches); + } + private static TagHelperDescriptor[] GetEventHandlerTagHelpers(TagHelperDescriptorProviderContext context) { return ExcludeBuiltInComponents(context).Where(t => t.IsEventHandlerTagHelper()).ToArray(); From abc48b312c93e396dbf1f42be79dc8cbd4d445a6 Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 3 Sep 2024 13:30:01 -0700 Subject: [PATCH 219/271] Test that the DrainToImmutableOrdered* methods actually drain --- ...NetCore.Razor.Utilities.Shared.Test.csproj | 1 + .../PooledObjects/Extensions.cs | 15 +++++++ .../PooledArrayBuilderOrderingTests.cs | 44 +++++++++++++++---- .../PooledObjects/TestArrayBuilderPool`1.cs | 30 +++++++++++++ .../PooledObjects/PooledArrayBuilder`1.cs | 20 +++++++-- 5 files changed, 99 insertions(+), 11 deletions(-) create mode 100644 src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs create mode 100644 src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj index 470d326cc87..b10885404af 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/Microsoft.AspNetCore.Razor.Utilities.Shared.Test.csproj @@ -4,6 +4,7 @@ $(DefaultNetCoreTargetFrameworks) $(TargetFrameworks);$(DefaultNetFxTargetFramework) True + false diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs new file mode 100644 index 00000000000..53de1ae5329 --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/Extensions.cs @@ -0,0 +1,15 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System; +using Microsoft.AspNetCore.Razor.PooledObjects; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.PooledObjects; + +internal static class Extensions +{ + public static void Validate(this ref readonly PooledArrayBuilder builder, Action.TestAccessor> validator) + { + validator(builder.GetTestAccessor()); + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs index c1d4a196eb1..515ee999523 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderOrderingTests.cs @@ -102,87 +102,115 @@ public void ToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) { - using var builder = new PooledArrayBuilder(capacity: data.Length); + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrdered(); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderTestData_OddBeforeEven))] public void DrainToImmutableOrdered_OddBeforeEven(ImmutableArray data, ImmutableArray expected) { - using var builder = new PooledArrayBuilder(capacity: data.Length); + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrdered(OddBeforeEven); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderDescendingTestData))] public void DrainToImmutableOrderedDescending(ImmutableArray data, ImmutableArray expected) { - using var builder = new PooledArrayBuilder(capacity: data.Length); + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedDescending(); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderDescendingTestData_OddBeforeEven))] public void DrainToImmutableOrderedDescending_OddBeforeEven(ImmutableArray data, ImmutableArray expected) { - using var builder = new PooledArrayBuilder(capacity: data.Length); + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedDescending(OddBeforeEven); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderByTestData))] public void DrainToImmutableOrderedBy(ImmutableArray> data, ImmutableArray> expected) { - using var builder = new PooledArrayBuilder>(capacity: data.Length); + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderByTestData_OddBeforeEven))] public void DrainToImmutableOrderedBy_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) { - using var builder = new PooledArrayBuilder>(capacity: data.Length); + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedBy(static x => x.Value, OddBeforeEven); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderByDescendingTestData))] public void DrainToImmutableOrderedByDescending(ImmutableArray> data, ImmutableArray> expected) { - using var builder = new PooledArrayBuilder>(capacity: data.Length); + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value); AssertEqual(expected, sorted); + AssertIsDrained(in builder); } [Theory] [MemberData(nameof(OrderByDescendingTestData_OddBeforeEven))] public void DrainToImmutableOrderedByDescending_OddBeforeEven(ImmutableArray> data, ImmutableArray> expected) { - using var builder = new PooledArrayBuilder>(capacity: data.Length); + var builderPool = TestArrayBuilderPool>.Create(); + using var builder = new PooledArrayBuilder>(capacity: data.Length, builderPool); builder.AddRange(data); var sorted = builder.DrainToImmutableOrderedByDescending(static x => x.Value, OddBeforeEven); AssertEqual(expected, sorted); + AssertIsDrained(in builder); + } + + private static void AssertIsDrained(ref readonly PooledArrayBuilder builder) + { + builder.Validate(static t => + { + Assert.NotNull(t.InnerArrayBuilder); + Assert.Empty(t.InnerArrayBuilder); + + // After draining, the capacity of the inner array builder should be 0. + Assert.Equal(0, t.InnerArrayBuilder.Capacity); + }); } } diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs new file mode 100644 index 00000000000..8380389a86d --- /dev/null +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/TestArrayBuilderPool`1.cs @@ -0,0 +1,30 @@ +// Copyright (c) .NET Foundation. All rights reserved. +// Licensed under the MIT license. See License.txt in the project root for license information. + +using System.Collections.Immutable; +using Microsoft.AspNetCore.Razor.PooledObjects; +using Microsoft.Extensions.ObjectPool; + +namespace Microsoft.AspNetCore.Razor.Utilities.Shared.Test.PooledObjects; + +internal static class TestArrayBuilderPool +{ + public static ObjectPool.Builder> Create( + IPooledObjectPolicy.Builder>? policy = null, int size = 1) + => DefaultPool.Create(policy ?? NoReturnPolicy.Instance, size); + + public sealed class NoReturnPolicy : IPooledObjectPolicy.Builder> + { + public static readonly NoReturnPolicy Instance = new(); + + private NoReturnPolicy() + { + } + + public ImmutableArray.Builder Create() + => ImmutableArray.CreateBuilder(); + + public bool Return(ImmutableArray.Builder obj) + => false; + } +} diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs index 6d4f984552a..c684d50fac6 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs @@ -9,6 +9,7 @@ using System.Runtime.CompilerServices; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Utilities; +using Microsoft.Extensions.ObjectPool; namespace Microsoft.AspNetCore.Razor.PooledObjects; @@ -33,6 +34,8 @@ internal partial struct PooledArrayBuilder : IDisposable ///
private const int InlineCapacity = 4; + private ObjectPool.Builder>? _builderPool; + /// /// A builder to be used as storage after the first time that the number /// of items exceeds . Once the builder is used, @@ -56,9 +59,10 @@ internal partial struct PooledArrayBuilder : IDisposable /// private int _inlineCount; - public PooledArrayBuilder(int? capacity = null) + public PooledArrayBuilder(int? capacity = null, ObjectPool.Builder>? builderPool = null) { _capacity = capacity is > InlineCapacity ? capacity : null; + _builderPool = builderPool; _element0 = default!; _element1 = default!; _element2 = default!; @@ -81,7 +85,7 @@ public void Dispose() // stack after the last use of a reference to them. if (_builder is { } builder) { - ArrayBuilderPool.Default.Return(builder); + _builderPool?.Return(builder); _builder = null; } } @@ -1314,7 +1318,8 @@ private void MoveInlineItemsToBuilder() { Debug.Assert(_builder is null); - var builder = ArrayBuilderPool.Default.Get(); + _builderPool ??= ArrayBuilderPool.Default; + var builder = _builderPool.Get(); if (_capacity is int capacity) { @@ -1525,4 +1530,13 @@ public ImmutableArray DrainToImmutableOrderedByDescending(Func return result; } + + internal readonly TestAccessor GetTestAccessor() => new(in this); + + internal readonly struct TestAccessor(ref readonly PooledArrayBuilder builder) + { + public ImmutableArray.Builder? InnerArrayBuilder { get; } = builder._builder; + public int? Capacity { get; } = builder._capacity; + public int InlineItemCount { get; } = builder._inlineCount; + } } From 5c0677ad275e64300b897de0f6e8856ebe13f07b Mon Sep 17 00:00:00 2001 From: Dustin Campbell Date: Tue, 3 Sep 2024 14:46:52 -0700 Subject: [PATCH 220/271] Ensure PooledArrayBuilder resets capacity of builder after drain It is perfectly legal for a PooledArrayBuilder to be drained via one of the DrainToImmutable* methods and then continue adding items to the builder. However, if the inner ImmutableArray.Builder's capacity was set to 0 during the drain, its capacity will not be reset to any specified value when adding new items. This change fixes that. --- .../PooledObjects/PooledArrayBuilderTests.cs | 55 +++++++++++++++++ .../PooledObjects/PooledArrayBuilder`1.cs | 61 +++++++++++++++---- 2 files changed, 104 insertions(+), 12 deletions(-) diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs index 03129b86b02..c029b9d7aca 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared.Test/PooledObjects/PooledArrayBuilderTests.cs @@ -86,6 +86,61 @@ public void RemoveAtIndex(int count, int removeIndex) } } + [Fact] + public void UseDrainAndReuse() + { + var builderPool = TestArrayBuilderPool.Create(); + using var builder = new PooledArrayBuilder(capacity: 10, builderPool); + + for (var i = 0; i < 10; i++) + { + builder.Add(i); + } + + // Verify that the builder contains 10 items within its inner array builder. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Equal(10, t.InnerArrayBuilder.Count); + Assert.Equal(10, t.InnerArrayBuilder.Capacity); + }); + + var result = builder.DrainToImmutable(); + + // After draining, the builder should contain 0 items in its inner array builder + // and the capacity should have been set to 0. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Empty(t.InnerArrayBuilder); + Assert.Equal(0, t.InnerArrayBuilder.Capacity); + }); + + // Add another 10 items to the builder. At the end, the inner array builder + // should hold 10 items with a capacity of 10. + for (var i = 0; i < 10; i++) + { + builder.Add(i); + } + + // Verify that the builder contains 10 items within its inner array builder. + builder.Validate(static t => + { + Assert.Equal(0, t.InlineItemCount); + Assert.Equal(10, t.Capacity); + Assert.NotNull(t.InnerArrayBuilder); + + Assert.Equal(10, t.InnerArrayBuilder.Count); + Assert.Equal(10, t.InnerArrayBuilder.Capacity); + }); + } + private static Func IsEven => x => x % 2 == 0; private static Func IsOdd => x => x % 2 != 0; diff --git a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs index c684d50fac6..11f9ae42214 100644 --- a/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs +++ b/src/Shared/Microsoft.AspNetCore.Razor.Utilities.Shared/PooledObjects/PooledArrayBuilder`1.cs @@ -83,13 +83,50 @@ public void Dispose() // Return _builder to the pool if necessary. Note that we don't need to clear the inline elements here // because this type is intended to be allocated on the stack and the GC can reclaim objects from the // stack after the last use of a reference to them. - if (_builder is { } builder) + if (_builder is { } innerBuilder) { - _builderPool?.Return(builder); + _builderPool?.Return(innerBuilder); _builder = null; } } + /// + /// Retrieves the inner . + /// + /// + /// Returns if is available; otherwise + /// + /// + /// This should only be used by methods that will not add to the inner . + /// + private readonly bool TryGetBuilder([NotNullWhen(true)] out ImmutableArray.Builder? builder) + { + builder = _builder; + return builder is not null; + } + + /// + /// Retrieves the inner and resets its capacity if necessary. + /// + /// + /// Returns if is available; otherwise + /// + /// + /// This should only be used by methods that will add to the inner . + /// + private readonly bool TryGetBuilderAndEnsureCapacity([NotNullWhen(true)] out ImmutableArray.Builder? builder) + { + if (TryGetBuilder(out builder)) + { + if (builder.Capacity == 0 && _capacity is int capacity) + { + builder.Capacity = capacity; + } + } + + return builder is not null; + } + [MethodImpl(MethodImplOptions.AggressiveInlining)] private void ClearInlineElement(int index) { @@ -112,7 +149,7 @@ public T this[int index] [MethodImpl(MethodImplOptions.AggressiveInlining)] readonly get { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder[index]; } @@ -128,7 +165,7 @@ readonly get [MethodImpl(MethodImplOptions.AggressiveInlining)] set { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { builder[index] = value; return; @@ -198,7 +235,7 @@ public readonly int Count public void Add(T item) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.Add(item); } @@ -233,7 +270,7 @@ public void AddRange(ReadOnlySpan items) return; } - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.AddRange(items); } @@ -254,7 +291,7 @@ public void AddRange(ReadOnlySpan items) public void AddRange(IEnumerable items) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.AddRange(items); return; @@ -296,7 +333,7 @@ public void AddRange(IEnumerable items) public void Clear() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { // Keep using a real builder to avoid churn in the object pool. builder.Clear(); @@ -314,7 +351,7 @@ public readonly Enumerator GetEnumerator() public void RemoveAt(int index) { - if (_builder is { } builder) + if (TryGetBuilderAndEnsureCapacity(out var builder)) { builder.RemoveAt(index); return; @@ -384,7 +421,7 @@ public void RemoveAt(Index index) /// An immutable array. public ImmutableArray DrainToImmutable() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.DrainToImmutable(); } @@ -400,7 +437,7 @@ public ImmutableArray DrainToImmutable() public readonly ImmutableArray ToImmutable() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.ToImmutable(); } @@ -424,7 +461,7 @@ private readonly ImmutableArray InlineItemsToImmutableArray() public readonly T[] ToArray() { - if (_builder is { } builder) + if (TryGetBuilder(out var builder)) { return builder.ToArray(); } From 467ff246de4cc165cb9d841ee273c77aaf7b516f Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 4 Sep 2024 11:04:31 +1000 Subject: [PATCH 221/271] PR feedback --- .../CohostGoToDefinitionEndpointTest.cs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs index 7e0cc0a8b1e..b97fe4ef07a 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToDefinitionEndpointTest.cs @@ -160,7 +160,7 @@ public partial class SurveyPrompt : ComponentBase """; var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, - (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); Assert.NotNull(result.Value.Second); @@ -286,7 +286,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #endregion var result = await GetGoToDefinitionResultAsync(input, FileKinds.Component, - (FileName("SurveyPrompt.razor"), surveyPrompt.Text), + (FileName("SurveyPrompt.razor"), surveyPrompt.Text), (FileName("SurveyPrompt.razor.g.cs"), surveyPromptGeneratedCode.Text)); Assert.NotNull(result.Value.Second); @@ -304,14 +304,14 @@ public async Task Html() // This really just validates Uri remapping, the actual response is largely arbitrary TestCode input = """ -
+
- - """; + + """; var document = CreateProjectAndRazorDocument(input.Text); var inputText = await document.GetTextAsync(DisposalToken); @@ -355,6 +355,7 @@ private async Task VerifyGoToDefinitionAsync(TestCode input, string? fileKind = var document = CreateProjectAndRazorDocument(input.Text, fileKind, additionalFiles); return GetGoToDefinitionResultAsync(document, input, htmlResponse: null); } + private async Task?> GetGoToDefinitionResultAsync( TextDocument document, TestCode input, SumType? htmlResponse) { From d9e380b533723825b65b74ac5ca3157b1f5e251a Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 4 Sep 2024 11:17:50 +1000 Subject: [PATCH 222/271] Rename service --- .../Extensions/IServiceCollectionExtensions.cs | 2 +- ...ellCheckService.cs => LspCSharpSpellCheckRangeProvider.cs} | 4 ++-- ...SpellCheckService.cs => ICSharpSpellCheckRangeProvider.cs} | 2 +- .../SpellCheck/SpellCheckService.cs | 4 ++-- .../SpellCheck/OOPSpellCheckService.cs | 2 +- ...CheckService.cs => RemoteCSharpSpellCheckRangeProvider.cs} | 4 ++-- .../SpellCheck/DocumentSpellCheckEndpointTest.cs | 2 +- 7 files changed, 10 insertions(+), 10 deletions(-) rename src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/{LspCSharpSpellCheckService.cs => LspCSharpSpellCheckRangeProvider.cs} (95%) rename src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/{ICSharpSpellCheckService.cs => ICSharpSpellCheckRangeProvider.cs} (90%) rename src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/{RemoteCSharpSpellCheckService.cs => RemoteCSharpSpellCheckRangeProvider.cs} (90%) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs index e4a7dc87af7..91ecc7a562f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Extensions/IServiceCollectionExtensions.cs @@ -160,7 +160,7 @@ public static void AddTextDocumentServices(this IServiceCollection services, Lan services.AddHandlerWithCapabilities(); services.AddSingleton(); - services.AddSingleton(); + services.AddSingleton(); services.AddHandlerWithCapabilities(); services.AddHandler(); } diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs similarity index 95% rename from src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs rename to src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs index 764c9c1f31e..97cf038f3c7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckService.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/LspCSharpSpellCheckRangeProvider.cs @@ -19,9 +19,9 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.SpellCheck; -internal sealed class LspCSharpSpellCheckService( +internal sealed class LspCSharpSpellCheckRangeProvider( LanguageServerFeatureOptions languageServerFeatureOptions, - IClientConnection clientConnection) : ICSharpSpellCheckService + IClientConnection clientConnection) : ICSharpSpellCheckRangeProvider { private readonly LanguageServerFeatureOptions _languageServerFeatureOptions = languageServerFeatureOptions; private readonly IClientConnection _clientConnection = clientConnection; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckRangeProvider.cs similarity index 90% rename from src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckRangeProvider.cs index de7341567b6..b25dc9f42dd 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/ICSharpSpellCheckRangeProvider.cs @@ -8,7 +8,7 @@ namespace Microsoft.CodeAnalysis.Razor.SpellCheck; -internal interface ICSharpSpellCheckService +internal interface ICSharpSpellCheckRangeProvider { Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs index 78f0441e383..5690e39cff0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs @@ -15,10 +15,10 @@ namespace Microsoft.CodeAnalysis.Razor.SpellCheck; internal class SpellCheckService( - ICSharpSpellCheckService csharpSpellCheckService, + ICSharpSpellCheckRangeProvider csharpSpellCheckService, IDocumentMappingService documentMappingService) : ISpellCheckService { - private readonly ICSharpSpellCheckService _csharpSpellCheckService = csharpSpellCheckService; + private readonly ICSharpSpellCheckRangeProvider _csharpSpellCheckService = csharpSpellCheckService; private readonly IDocumentMappingService _documentMappingService = documentMappingService; public async Task GetSpellCheckRangeTriplesAsync(DocumentContext documentContext, CancellationToken cancellationToken) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs index f34e86b686d..1eecb538056 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/OOPSpellCheckService.cs @@ -10,7 +10,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.SpellCheck; [Export(typeof(ISpellCheckService)), Shared] [method: ImportingConstructor] internal sealed class OOPSpellCheckService( - ICSharpSpellCheckService csharpSpellCheckService, + ICSharpSpellCheckRangeProvider csharpSpellCheckService, IDocumentMappingService documentMappingService) : SpellCheckService(csharpSpellCheckService, documentMappingService) { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckRangeProvider.cs similarity index 90% rename from src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs rename to src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckRangeProvider.cs index d2779d745ab..970a1d51388 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/SpellCheck/RemoteCSharpSpellCheckRangeProvider.cs @@ -12,9 +12,9 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.SpellCheck; -[Export(typeof(ICSharpSpellCheckService)), Shared] +[Export(typeof(ICSharpSpellCheckRangeProvider)), Shared] [method: ImportingConstructor] -internal class RemoteCSharpSpellCheckService() : ICSharpSpellCheckService +internal class RemoteCSharpSpellCheckRangeProvider() : ICSharpSpellCheckRangeProvider { public async Task> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs index 5e547834463..a81ed10c7f1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/SpellCheck/DocumentSpellCheckEndpointTest.cs @@ -175,7 +175,7 @@ private async Task ValidateSpellCheckRangesAsync(string originalInput, string? f var documentContext = CreateDocumentContext(uri, codeDocument); var requestContext = new RazorRequestContext(documentContext, null!, "lsp/method", uri: null); - var csharpSpellCheckService = new LspCSharpSpellCheckService(LanguageServerFeatureOptions, languageServer); + var csharpSpellCheckService = new LspCSharpSpellCheckRangeProvider(LanguageServerFeatureOptions, languageServer); var spellCheckService = new SpellCheckService(csharpSpellCheckService, DocumentMappingService); var endpoint = new DocumentSpellCheckEndpoint(spellCheckService); From 84c2983392827a137e6b55be48f03a7a0dceb6b8 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 4 Sep 2024 11:21:13 +1000 Subject: [PATCH 223/271] Whitespace --- .../CohostGoToImplementationEndpointTest.cs | 78 +++++++++---------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs index 170ca71d6a6..4ee5dab2c8d 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostGoToImplementationEndpointTest.cs @@ -23,19 +23,19 @@ public class CohostGoToImplementationEndpointTest(ITestOutputHelper testOutputHe public async Task CSharp_Method() { var input = """ -
+
- @{ - var x = Ge$$tX(); - } + @{ + var x = Ge$$tX(); + } - @code + @code + { + void [|GetX|]() { - void [|GetX|]() - { - } } - """; + } + """; await VerifyCSharpGoToImplementationAsync(input); } @@ -44,22 +44,22 @@ public async Task CSharp_Method() public async Task CSharp_Field() { var input = """ -
+
- @{ - var x = GetX(); - } + @{ + var x = GetX(); + } - @code - { - private string [|_name|]; + @code + { + private string [|_name|]; - string GetX() - { - return _na$$me; - } + string GetX() + { + return _na$$me; } - """; + } + """; await VerifyCSharpGoToImplementationAsync(input); } @@ -68,19 +68,19 @@ string GetX() public async Task CSharp_Multiple() { var input = """ -
+
- @code - { - class [|Base|] { } - class [|Derived1|] : Base { } - class [|Derived2|] : Base { } + @code + { + class [|Base|] { } + class [|Derived1|] : Base { } + class [|Derived2|] : Base { } - void M(Ba$$se b) - { - } + void M(Ba$$se b) + { } - """; + } + """; await VerifyCSharpGoToImplementationAsync(input); } @@ -91,14 +91,14 @@ public async Task Html() // This really just validates Uri remapping, the actual response is largely arbitrary TestCode input = """ -
- - - """; +
+ + + """; var document = CreateProjectAndRazorDocument(input.Text); var inputText = await document.GetTextAsync(DisposalToken); From 074043b5163041beaaf1adf8a9acd75c0bf0a856 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 4 Sep 2024 13:35:33 +1000 Subject: [PATCH 224/271] Remove IsImportDocument Was only used in one place, and that place could never have any result except false due to a FileKind check above --- .../IDocumentSnapshotExtensions.cs | 6 --- .../ProjectSystem/IProjectSnapshot.cs | 1 - .../ProjectSystem/ProjectSnapshot.cs | 10 ----- .../ProjectSystem/RemoteProjectSnapshot.cs | 6 --- .../EphemeralProjectSnapshot.cs | 10 ----- .../DefaultProjectSnapshotTest.cs | 37 ------------------- .../CohostUriPresentationEndpointTest.cs | 20 ++++++++++ 7 files changed, 20 insertions(+), 70 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs index 6b6ec6a9360..62a90f11432 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IDocumentSnapshotExtensions.cs @@ -27,12 +27,6 @@ internal static class IDocumentSnapshotExtensions var project = documentSnapshot.Project; - // If the document is an import document, then it can't be a component - if (project.IsImportDocument(documentSnapshot)) - { - return null; - } - // If we got this far, we can check for tag helpers var tagHelpers = await project.GetTagHelpersAsync(cancellationToken).ConfigureAwait(false); foreach (var tagHelper in tagHelpers) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs index 56459d179bc..070e8a325e8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs @@ -39,7 +39,6 @@ internal interface IProjectSnapshot RazorProjectEngine GetProjectEngine(); IDocumentSnapshot? GetDocument(string filePath); bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSnapshot? document); - bool IsImportDocument(IDocumentSnapshot document); /// /// If the provided document is an import document, gets the other documents in the project diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs index ff80c8c93a7..066808d200a 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs @@ -79,16 +79,6 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna return document is not null; } - public bool IsImportDocument(IDocumentSnapshot document) - { - if (document is null) - { - throw new ArgumentNullException(nameof(document)); - } - - return document.TargetPath is { } targetPath && State.ImportsToRelatedDocuments.ContainsKey(targetPath); - } - public ImmutableArray GetRelatedDocuments(IDocumentSnapshot document) { if (document is null) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs index cfd8e70171a..8e59270f35b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs @@ -176,12 +176,6 @@ public ImmutableArray GetRelatedDocuments(IDocumentSnapshot d return builder.DrainToImmutable(); } - public bool IsImportDocument(IDocumentSnapshot document) - { - return document.TargetPath is { } targetPath && - _importsToRelatedDocumentsLazy.Value.ContainsKey(targetPath); - } - private RazorConfiguration CreateRazorConfiguration() { // See RazorSourceGenerator.RazorProviders.cs diff --git a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs index e0d3b2670a7..16b41408362 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs @@ -72,16 +72,6 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna return false; } - public bool IsImportDocument(IDocumentSnapshot document) - { - if (document is null) - { - throw new ArgumentNullException(nameof(document)); - } - - return false; - } - public ImmutableArray GetRelatedDocuments(IDocumentSnapshot document) { if (document is null) diff --git a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs index 4c8734c90c7..b661352b3e0 100644 --- a/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs +++ b/src/Razor/test/Microsoft.CodeAnalysis.Razor.Workspaces.Test/ProjectSystem/DefaultProjectSnapshotTest.cs @@ -61,43 +61,6 @@ public void ProjectSnapshot_CachesDocumentSnapshots() d => Assert.Same(d.Value, snapshot.GetDocument(d.Key))); } - [Fact] - public void IsImportDocument_NonImportDocument_ReturnsFalse() - { - // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) - .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader); - var snapshot = new ProjectSnapshot(state); - - var document = snapshot.GetDocument(_documents[0].FilePath); - Assert.NotNull(document); - - // Act - var result = snapshot.IsImportDocument(document); - - // Assert - Assert.False(result); - } - - [Fact] - public void IsImportDocument_ImportDocument_ReturnsTrue() - { - // Arrange - var state = ProjectState.Create(ProjectEngineFactoryProvider, _hostProject, _projectWorkspaceState) - .WithAddedHostDocument(_documents[0], DocumentState.EmptyLoader) - .WithAddedHostDocument(TestProjectData.SomeProjectImportFile, DocumentState.EmptyLoader); - var snapshot = new ProjectSnapshot(state); - - var document = snapshot.GetDocument(TestProjectData.SomeProjectImportFile.FilePath); - Assert.NotNull(document); - - // Act - var result = snapshot.IsImportDocument(document); - - // Assert - Assert.True(result); - } - [Fact] public void GetRelatedDocuments_NonImportDocument_ReturnsEmpty() { diff --git a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs index 981e8f7a8b9..d1f965f0b76 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LanguageServices.Razor.Test/Cohost/CohostUriPresentationEndpointTest.cs @@ -97,6 +97,26 @@ public class Component : Microsoft.AspNetCore.Components.ComponentBase expected: ""); } + [Fact] + public async Task ImportsFile() + { + await VerifyUriPresentationAsync( + input: """ + This is a Razor document. + +
+ [||] +
+ + The end. + """, + additionalFiles: [ + (File("_Imports.razor"), "") + ], + uris: [FileUri("_Imports.razor")], + expected: null); + } + [Fact] public async Task Html_IntoCSharp_NoTag() { From 7107165cd47ce9ccd41a7bc006a231fb76b9d99e Mon Sep 17 00:00:00 2001 From: David Wengier Date: Wed, 4 Sep 2024 13:58:57 +1000 Subject: [PATCH 225/271] Remove GetRelatedDocuments from IProjectSnapshot This is only called from the LSP server, and shouldn't be called from cohosting, so now it can't be! --- .../ProjectSystem/IProjectSnapshot.cs | 9 ----- .../ProjectSystem/ProjectChangeEventArgs.cs | 10 +++--- .../ProjectSystem/ProjectSnapshot.cs | 5 +++ .../ProjectSnapshotManager.Entry.cs | 4 +-- .../ProjectSystem/ProjectSnapshotManager.cs | 6 ++-- .../ProjectSystem/RemoteProjectSnapshot.cs | 36 ------------------- .../EphemeralProjectSnapshot.cs | 10 ------ .../VisualStudioDocumentTrackerTest.cs | 11 +++--- 8 files changed, 22 insertions(+), 69 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs index 070e8a325e8..5201a448104 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshot.cs @@ -39,13 +39,4 @@ internal interface IProjectSnapshot RazorProjectEngine GetProjectEngine(); IDocumentSnapshot? GetDocument(string filePath); bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSnapshot? document); - - /// - /// If the provided document is an import document, gets the other documents in the project - /// that include directives specified by the provided document. Otherwise returns an empty - /// list. - /// - /// The document. - /// A list of related documents. - ImmutableArray GetRelatedDocuments(IDocumentSnapshot document); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs index 9d2843994e0..be4ce51e13b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs @@ -8,12 +8,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem; internal class ProjectChangeEventArgs : EventArgs { - public ProjectChangeEventArgs(IProjectSnapshot older, IProjectSnapshot newer, ProjectChangeKind kind) + public ProjectChangeEventArgs(ProjectSnapshot older, ProjectSnapshot newer, ProjectChangeKind kind) : this(older, newer, null, kind, false) { } - public ProjectChangeEventArgs(IProjectSnapshot? older, IProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind, bool solutionIsClosing) + public ProjectChangeEventArgs(ProjectSnapshot? older, ProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind, bool solutionIsClosing) { if (older is null && newer is null) { @@ -29,9 +29,9 @@ public ProjectChangeEventArgs(IProjectSnapshot? older, IProjectSnapshot? newer, ProjectKey = (older ?? newer)!.Key; } - public IProjectSnapshot? Older { get; } + public ProjectSnapshot? Older { get; } - public IProjectSnapshot? Newer { get; } + public ProjectSnapshot? Newer { get; } public ProjectKey ProjectKey { get; } @@ -43,6 +43,6 @@ public ProjectChangeEventArgs(IProjectSnapshot? older, IProjectSnapshot? newer, public bool SolutionIsClosing { get; } - public static ProjectChangeEventArgs CreateTestInstance(IProjectSnapshot older, IProjectSnapshot newer, string documentFilePath, ProjectChangeKind kind, bool solutionIsClosing = false) => + public static ProjectChangeEventArgs CreateTestInstance(ProjectSnapshot older, ProjectSnapshot newer, string documentFilePath, ProjectChangeKind kind, bool solutionIsClosing = false) => new(older, newer, documentFilePath, kind, solutionIsClosing); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs index 066808d200a..1278e741d68 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshot.cs @@ -79,6 +79,11 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna return document is not null; } + /// + /// If the provided document is an import document, gets the other documents in the project + /// that include directives specified by the provided document. Otherwise returns an empty + /// list. + /// public ImmutableArray GetRelatedDocuments(IDocumentSnapshot document) { if (document is null) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs index 48341f3dd5d..c02de7a1bad 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs @@ -7,9 +7,9 @@ internal partial class ProjectSnapshotManager { private sealed record Entry(ProjectState State) { - private IProjectSnapshot? _snapshotUnsafe; + private ProjectSnapshot? _snapshotUnsafe; - public IProjectSnapshot GetSnapshot() + public ProjectSnapshot GetSnapshot() { return _snapshotUnsafe ??= new ProjectSnapshot(State); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs index 40f7d967401..96c5e4b8d65 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs @@ -383,7 +383,7 @@ private void SolutionClosed() } } - private void NotifyListeners(IProjectSnapshot? older, IProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind) + private void NotifyListeners(ProjectSnapshot? older, ProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind) { if (!_initialized) { @@ -421,8 +421,8 @@ private bool TryUpdate( ProjectKey projectKey, string? documentFilePath, IUpdateProjectAction action, - [NotNullWhen(true)] out IProjectSnapshot? oldSnapshot, - [NotNullWhen(true)] out IProjectSnapshot? newSnapshot) + [NotNullWhen(true)] out ProjectSnapshot? oldSnapshot, + [NotNullWhen(true)] out ProjectSnapshot? newSnapshot) { using var upgradeableLock = _readerWriterLock.DisposableUpgradeableRead(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs index 8e59270f35b..6d5d2ec6040 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/ProjectSystem/RemoteProjectSnapshot.cs @@ -11,7 +11,6 @@ using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.PooledObjects; using Microsoft.AspNetCore.Razor.ProjectEngineHost; using Microsoft.AspNetCore.Razor.ProjectSystem; using Microsoft.AspNetCore.Razor.Telemetry; @@ -32,7 +31,6 @@ internal class RemoteProjectSnapshot : IProjectSnapshot private readonly ITelemetryReporter _telemetryReporter; private readonly Lazy _lazyConfiguration; private readonly Lazy _lazyProjectEngine; - private readonly Lazy>> _importsToRelatedDocumentsLazy; private ImmutableArray _tagHelpers; @@ -56,18 +54,6 @@ public RemoteProjectSnapshot(Project project, DocumentSnapshotFactory documentSn builder.SetSupportLocalizedComponentNames(); }); }); - - _importsToRelatedDocumentsLazy = new Lazy>>(() => - { - var importsToRelatedDocuments = ImmutableDictionary.Create>(FilePathNormalizingComparer.Instance); - foreach (var documentFilePath in DocumentFilePaths) - { - var importTargetPaths = ProjectState.GetImportDocumentTargetPaths(documentFilePath, FileKinds.GetFileKindFromFilePath(documentFilePath), _lazyProjectEngine.Value); - importsToRelatedDocuments = ProjectState.AddToImportsToRelatedDocuments(importsToRelatedDocuments, documentFilePath, importTargetPaths); - } - - return importsToRelatedDocuments; - }); } public RazorConfiguration Configuration => throw new InvalidOperationException("Should not be called for cohosted projects."); @@ -154,28 +140,6 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna /// internal RazorProjectEngine GetProjectEngine_CohostOnly() => _lazyProjectEngine.Value; - public ImmutableArray GetRelatedDocuments(IDocumentSnapshot document) - { - var targetPath = document.TargetPath.AssumeNotNull(); - - if (!_importsToRelatedDocumentsLazy.Value.TryGetValue(targetPath, out var relatedDocuments)) - { - return []; - } - - using var builder = new PooledArrayBuilder(relatedDocuments.Length); - - foreach (var relatedDocumentFilePath in relatedDocuments) - { - if (TryGetDocument(relatedDocumentFilePath, out var relatedDocument)) - { - builder.Add(relatedDocument); - } - } - - return builder.DrainToImmutable(); - } - private RazorConfiguration CreateRazorConfiguration() { // See RazorSourceGenerator.RazorProviders.cs diff --git a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs index 16b41408362..ebc897de409 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LegacyEditor.Razor/EphemeralProjectSnapshot.cs @@ -72,16 +72,6 @@ public bool TryGetDocument(string filePath, [NotNullWhen(true)] out IDocumentSna return false; } - public ImmutableArray GetRelatedDocuments(IDocumentSnapshot document) - { - if (document is null) - { - throw new ArgumentNullException(nameof(document)); - } - - return ImmutableArray.Empty; - } - public RazorProjectEngine GetProjectEngine() { return _projectEngine.Value; diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs index ea936cb99b2..1ce0405fbdb 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs @@ -161,7 +161,8 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_hostProject.Key), ProjectChangeKind.ProjectAdded); + var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); + var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectAdded); var called = false; _documentTracker.ContextChanged += (sender, args) => @@ -187,7 +188,8 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_hostProject.Key), ProjectChangeKind.ProjectChanged); + var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); + var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectChanged); var called = false; _documentTracker.ContextChanged += (sender, args) => @@ -213,7 +215,7 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var project = _projectManager.GetLoadedProject(_hostProject.Key); + var project = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); await _projectManager.UpdateAsync(updater => { @@ -247,7 +249,8 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_otherHostProject); }); - var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_otherHostProject.Key), ProjectChangeKind.ProjectChanged); + var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_otherHostProject.Key); + var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectChanged); var called = false; _documentTracker.ContextChanged += (sender, args) => called = true; From 4ec65fb914d964d3207edf5a3b8b5dab998d9d60 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 23:00:10 -0700 Subject: [PATCH 226/271] [main] Update dependencies from dotnet/arcade (#10816) * Update dependencies from https://github.com/dotnet/arcade build 20240829.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24426.3 -> To Version 9.0.0-beta.24429.3 * Update dependencies from https://github.com/dotnet/arcade build 20240829.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24429.3 -> To Version 9.0.0-beta.24429.5 * Failed to perform coherency update for one or more dependencies. --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 613a3732666..25e8a53eb8f 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - e3bdd9a0f2a65fe037ba1adb2261eea48a840fa4 + d21db44e84b9038ea7b2add139adee2303d46800 - + https://github.com/dotnet/arcade - e3bdd9a0f2a65fe037ba1adb2261eea48a840fa4 + d21db44e84b9038ea7b2add139adee2303d46800 diff --git a/eng/Versions.props b/eng/Versions.props index c4680833301..af72d6b3939 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24426.3 + 9.0.0-beta.24429.5 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.12.0-2.24419.3 diff --git a/global.json b/global.json index 2e613368edb..88f4f0ce315 100644 --- a/global.json +++ b/global.json @@ -22,7 +22,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24426.3", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24429.5", "Microsoft.Build.NoTargets": "3.7.0" } } From 41acbdeb665c11bf26fea16b017ebf54e6a74e22 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Tue, 3 Sep 2024 23:00:56 -0700 Subject: [PATCH 227/271] Update dependencies from https://github.com/dotnet/arcade build 20240826.2 (#10808) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24421.4 -> To Version 8.0.0-beta.24426.2 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a674ac10379..100731f89a8 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - 4460b755f3c7c89e9660d9580ff79afc4218dd85 + 80264e60280e2815e7d65871081ccac04a32445c - + https://github.com/dotnet/arcade - 4460b755f3c7c89e9660d9580ff79afc4218dd85 + 80264e60280e2815e7d65871081ccac04a32445c diff --git a/eng/Versions.props b/eng/Versions.props index 76c5f9ea272..9296f591371 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 8.0.0-beta.24421.4 + 8.0.0-beta.24426.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.11.0-3.24303.3 diff --git a/global.json b/global.json index bbd507f30dc..0b7a32c0065 100644 --- a/global.json +++ b/global.json @@ -21,7 +21,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24421.4", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24426.2", "Microsoft.Build.NoTargets": "3.7.0" } } From 187962c1773a6056402dd1d92099abaea5c7fdac Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 09:00:43 +0200 Subject: [PATCH 228/271] [release/dev17.10] Update dependencies from dotnet/arcade (#10529) * Update dependencies from https://github.com/dotnet/arcade build 20240624.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.1 * Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 * Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 * Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 * Update dependencies from https://github.com/dotnet/arcade build 20240624.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24324.7 * Update dependencies from https://github.com/dotnet/arcade build 20240626.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24326.4 * Update dependencies from https://github.com/dotnet/arcade build 20240626.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24326.4 * Update dependencies from https://github.com/dotnet/arcade build 20240628.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24328.2 * Update dependencies from https://github.com/dotnet/arcade build 20240628.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24328.2 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240702.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24352.1 * Update dependencies from https://github.com/dotnet/arcade build 20240709.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24359.3 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240710.5 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24360.5 * Update dependencies from https://github.com/dotnet/arcade build 20240716.7 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24366.7 * Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 * Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 * Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 * Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 * Update dependencies from https://github.com/dotnet/arcade build 20240717.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24367.1 * Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 * Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 * Update dependencies from https://github.com/dotnet/arcade build 20240722.3 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24372.3 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240726.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24321.3 -> To Version 8.0.0-beta.24376.1 * Update dependencies from https://github.com/dotnet/arcade build 20240812.1 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24376.1 -> To Version 8.0.0-beta.24412.1 * Update dependencies from https://github.com/dotnet/arcade build 20240813.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24412.1 -> To Version 8.0.0-beta.24413.2 * Update dependencies from https://github.com/dotnet/arcade build 20240821.4 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24413.2 -> To Version 8.0.0-beta.24421.4 * Update dependencies from https://github.com/dotnet/arcade build 20240826.2 Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 8.0.0-beta.24421.4 -> To Version 8.0.0-beta.24426.2 --------- Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 +++--- eng/Versions.props | 2 +- eng/common/post-build/publish-using-darc.ps1 | 15 +++++----- eng/common/sdl/NuGet.config | 4 +-- eng/common/sdl/execute-all-sdl-tools.ps1 | 4 +-- eng/common/sdl/init-sdl.ps1 | 8 ------ eng/common/sdl/sdl.ps1 | 4 ++- .../job/publish-build-assets.yml | 23 +++++++++------ .../post-build/post-build.yml | 10 ++++--- .../templates-official/steps/execute-sdl.yml | 2 -- .../steps/get-federated-access-token.yml | 14 +++++++++- .../templates/job/publish-build-assets.yml | 23 +++++++++------ .../templates/post-build/post-build.yml | 10 ++++--- .../post-build/setup-maestro-vars.yml | 28 +++++++++---------- eng/common/templates/steps/execute-sdl.yml | 7 +++-- .../steps/get-federated-access-token.yml | 14 +++++++++- .../templates/steps/telemetry-start.yml | 2 +- global.json | 6 ++-- 18 files changed, 106 insertions(+), 78 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 2acd2fa2f13..580471ed8d7 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - a95bcc256e9bdf47394e4dab04872811c16daaea + 80264e60280e2815e7d65871081ccac04a32445c - + https://github.com/dotnet/arcade - a95bcc256e9bdf47394e4dab04872811c16daaea + 80264e60280e2815e7d65871081ccac04a32445c diff --git a/eng/Versions.props b/eng/Versions.props index 0133b0532fc..5a870c4ddec 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24113.1 - 8.0.0-beta.24321.3 + 8.0.0-beta.24426.2 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.10.0-3.24169.7 diff --git a/eng/common/post-build/publish-using-darc.ps1 b/eng/common/post-build/publish-using-darc.ps1 index 5a3a32ea8d7..238945cb5ab 100644 --- a/eng/common/post-build/publish-using-darc.ps1 +++ b/eng/common/post-build/publish-using-darc.ps1 @@ -2,7 +2,6 @@ param( [Parameter(Mandatory=$true)][int] $BuildId, [Parameter(Mandatory=$true)][int] $PublishingInfraVersion, [Parameter(Mandatory=$true)][string] $AzdoToken, - [Parameter(Mandatory=$true)][string] $MaestroToken, [Parameter(Mandatory=$false)][string] $MaestroApiEndPoint = 'https://maestro.dot.net', [Parameter(Mandatory=$true)][string] $WaitPublishingFinish, [Parameter(Mandatory=$false)][string] $ArtifactsPublishingAdditionalParameters, @@ -31,13 +30,13 @@ try { } & $darc add-build-to-channel ` - --id $buildId ` - --publishing-infra-version $PublishingInfraVersion ` - --default-channels ` - --source-branch main ` - --azdev-pat $AzdoToken ` - --bar-uri $MaestroApiEndPoint ` - --password $MaestroToken ` + --id $buildId ` + --publishing-infra-version $PublishingInfraVersion ` + --default-channels ` + --source-branch main ` + --azdev-pat "$AzdoToken" ` + --bar-uri "$MaestroApiEndPoint" ` + --ci ` @optionalParams if ($LastExitCode -ne 0) { diff --git a/eng/common/sdl/NuGet.config b/eng/common/sdl/NuGet.config index 3849bdb3cf5..5bfbb02ef04 100644 --- a/eng/common/sdl/NuGet.config +++ b/eng/common/sdl/NuGet.config @@ -5,11 +5,11 @@ - + - + diff --git a/eng/common/sdl/execute-all-sdl-tools.ps1 b/eng/common/sdl/execute-all-sdl-tools.ps1 index 4715d75e974..81ded5b7f47 100644 --- a/eng/common/sdl/execute-all-sdl-tools.ps1 +++ b/eng/common/sdl/execute-all-sdl-tools.ps1 @@ -6,7 +6,6 @@ Param( [string] $BranchName=$env:BUILD_SOURCEBRANCH, # Optional: name of branch or version of gdn settings; defaults to master [string] $SourceDirectory=$env:BUILD_SOURCESDIRECTORY, # Required: the directory where source files are located [string] $ArtifactsDirectory = (Join-Path $env:BUILD_ARTIFACTSTAGINGDIRECTORY ('artifacts')), # Required: the directory where build artifacts are located - [string] $AzureDevOpsAccessToken, # Required: access token for dnceng; should be provided via KeyVault # Optional: list of SDL tools to run on source code. See 'configure-sdl-tool.ps1' for tools list # format. @@ -75,7 +74,7 @@ try { } Exec-BlockVerbosely { - & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -AzureDevOpsAccessToken $AzureDevOpsAccessToken -GuardianLoggerLevel $GuardianLoggerLevel + & $(Join-Path $PSScriptRoot 'init-sdl.ps1') -GuardianCliLocation $guardianCliLocation -Repository $RepoName -BranchName $BranchName -WorkingDirectory $workingDirectory -GuardianLoggerLevel $GuardianLoggerLevel } $gdnFolder = Join-Path $workingDirectory '.gdn' @@ -104,7 +103,6 @@ try { -TargetDirectory $targetDirectory ` -GdnFolder $gdnFolder ` -ToolsList $tools ` - -AzureDevOpsAccessToken $AzureDevOpsAccessToken ` -GuardianLoggerLevel $GuardianLoggerLevel ` -CrScanAdditionalRunConfigParams $CrScanAdditionalRunConfigParams ` -PoliCheckAdditionalRunConfigParams $PoliCheckAdditionalRunConfigParams ` diff --git a/eng/common/sdl/init-sdl.ps1 b/eng/common/sdl/init-sdl.ps1 index 3ac1d92b370..588ff8e22fb 100644 --- a/eng/common/sdl/init-sdl.ps1 +++ b/eng/common/sdl/init-sdl.ps1 @@ -3,7 +3,6 @@ Param( [string] $Repository, [string] $BranchName='master', [string] $WorkingDirectory, - [string] $AzureDevOpsAccessToken, [string] $GuardianLoggerLevel='Standard' ) @@ -21,14 +20,7 @@ $ci = $true # Don't display the console progress UI - it's a huge perf hit $ProgressPreference = 'SilentlyContinue' -# Construct basic auth from AzDO access token; construct URI to the repository's gdn folder stored in that repository; construct location of zip file -$encodedPat = [Convert]::ToBase64String([System.Text.Encoding]::ASCII.GetBytes(":$AzureDevOpsAccessToken")) -$escapedRepository = [Uri]::EscapeDataString("/$Repository/$BranchName/.gdn") -$uri = "https://dev.azure.com/dnceng/internal/_apis/git/repositories/sdl-tool-cfg/Items?path=$escapedRepository&versionDescriptor[versionOptions]=0&`$format=zip&api-version=5.0" -$zipFile = "$WorkingDirectory/gdn.zip" - Add-Type -AssemblyName System.IO.Compression.FileSystem -$gdnFolder = (Join-Path $WorkingDirectory '.gdn') try { # if the folder does not exist, we'll do a guardian init and push it to the remote repository diff --git a/eng/common/sdl/sdl.ps1 b/eng/common/sdl/sdl.ps1 index 648c5068d7d..7fe603fe995 100644 --- a/eng/common/sdl/sdl.ps1 +++ b/eng/common/sdl/sdl.ps1 @@ -4,6 +4,8 @@ function Install-Gdn { [Parameter(Mandatory=$true)] [string]$Path, + [string]$Source = "https://pkgs.dev.azure.com/dnceng/_packaging/Guardian1ESPTUpstreamOrgFeed/nuget/v3/index.json", + # If omitted, install the latest version of Guardian, otherwise install that specific version. [string]$Version ) @@ -19,7 +21,7 @@ function Install-Gdn { $ci = $true . $PSScriptRoot\..\tools.ps1 - $argumentList = @("install", "Microsoft.Guardian.Cli", "-Source https://securitytools.pkgs.visualstudio.com/_packaging/Guardian/nuget/v3/index.json", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") + $argumentList = @("install", "Microsoft.Guardian.Cli.win-x64", "-Source $Source", "-OutputDirectory $Path", "-NonInteractive", "-NoCache") if ($Version) { $argumentList += "-Version $Version" diff --git a/eng/common/templates-official/job/publish-build-assets.yml b/eng/common/templates-official/job/publish-build-assets.yml index 589ac80a18b..0117328800c 100644 --- a/eng/common/templates-official/job/publish-build-assets.yml +++ b/eng/common/templates-official/job/publish-build-assets.yml @@ -76,13 +76,16 @@ jobs: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Build Assets inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: > + -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro-prod.westus2.cloudapp.azure.com /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) @@ -137,14 +140,16 @@ jobs: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates-official/post-build/post-build.yml b/eng/common/templates-official/post-build/post-build.yml index da1f40958b4..b81b8770b34 100644 --- a/eng/common/templates-official/post-build/post-build.yml +++ b/eng/common/templates-official/post-build/post-build.yml @@ -272,14 +272,16 @@ stages: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates-official/steps/execute-sdl.yml b/eng/common/templates-official/steps/execute-sdl.yml index 07426fde05d..301d5c591eb 100644 --- a/eng/common/templates-official/steps/execute-sdl.yml +++ b/eng/common/templates-official/steps/execute-sdl.yml @@ -9,8 +9,6 @@ parameters: steps: - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' diff --git a/eng/common/templates-official/steps/get-federated-access-token.yml b/eng/common/templates-official/steps/get-federated-access-token.yml index e3786cef6df..55e33bd38f7 100644 --- a/eng/common/templates-official/steps/get-federated-access-token.yml +++ b/eng/common/templates-official/steps/get-federated-access-token.yml @@ -3,6 +3,12 @@ parameters: type: string - name: outputVariableName type: string +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +16,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +37,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/templates/job/publish-build-assets.yml b/eng/common/templates/job/publish-build-assets.yml index 8ec0151def2..cc2b346ba8b 100644 --- a/eng/common/templates/job/publish-build-assets.yml +++ b/eng/common/templates/job/publish-build-assets.yml @@ -74,13 +74,16 @@ jobs: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Build Assets inputs: - filePath: eng\common\sdk-task.ps1 - arguments: -task PublishBuildAssets -restore -msbuildEngine dotnet + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/sdk-task.ps1 + arguments: > + -task PublishBuildAssets -restore -msbuildEngine dotnet /p:ManifestsPath='$(Build.StagingDirectory)/Download/AssetManifests' - /p:BuildAssetRegistryToken=$(MaestroAccessToken) /p:MaestroApiEndpoint=https://maestro.dot.net /p:PublishUsingPipelines=${{ parameters.publishUsingPipelines }} /p:OfficialBuildId=$(Build.BuildNumber) @@ -133,14 +136,16 @@ jobs: BARBuildId: ${{ parameters.BARBuildId }} PromoteToChannelIds: ${{ parameters.PromoteToChannelIds }} - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 - arguments: -BuildId $(BARBuildId) + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + arguments: -BuildId $(BARBuildId) -PublishingInfraVersion 3 - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/post-build/post-build.yml b/eng/common/templates/post-build/post-build.yml index aba44a25a33..c3b6a3012fe 100644 --- a/eng/common/templates/post-build/post-build.yml +++ b/eng/common/templates/post-build/post-build.yml @@ -268,14 +268,16 @@ stages: - task: NuGetAuthenticate@1 - - task: PowerShell@2 + - task: AzureCLI@2 displayName: Publish Using Darc inputs: - filePath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 + azureSubscription: "Darc: Maestro Production" + scriptType: ps + scriptLocation: scriptPath + scriptPath: $(Build.SourcesDirectory)/eng/common/post-build/publish-using-darc.ps1 arguments: -BuildId $(BARBuildId) -PublishingInfraVersion ${{ parameters.publishingInfraVersion }} - -AzdoToken '$(publishing-dnceng-devdiv-code-r-build-re)' - -MaestroToken '$(MaestroApiAccessToken)' + -AzdoToken '$(System.AccessToken)' -WaitPublishingFinish true -ArtifactsPublishingAdditionalParameters '${{ parameters.artifactsPublishingAdditionalParameters }}' -SymbolPublishingAdditionalParameters '${{ parameters.symbolPublishingAdditionalParameters }}' diff --git a/eng/common/templates/post-build/setup-maestro-vars.yml b/eng/common/templates/post-build/setup-maestro-vars.yml index 0c87f149a4a..64b9abc6850 100644 --- a/eng/common/templates/post-build/setup-maestro-vars.yml +++ b/eng/common/templates/post-build/setup-maestro-vars.yml @@ -11,13 +11,14 @@ steps: artifactName: ReleaseConfigs checkDownloadedFiles: true - - task: PowerShell@2 + - task: AzureCLI@2 name: setReleaseVars displayName: Set Release Configs Vars inputs: - targetType: inline - pwsh: true - script: | + azureSubscription: "Darc: Maestro Production" + scriptType: pscore + scriptLocation: inlineScript + inlineScript: | try { if (!$Env:PromoteToMaestroChannels -or $Env:PromoteToMaestroChannels.Trim() -eq '') { $Content = Get-Content $(Build.StagingDirectory)/ReleaseConfigs/ReleaseConfigs.txt @@ -31,15 +32,16 @@ steps: $AzureDevOpsBuildId = $Env:Build_BuildId } else { - $buildApiEndpoint = "${Env:MaestroApiEndPoint}/api/builds/${Env:BARBuildId}?api-version=${Env:MaestroApiVersion}" + . $(Build.SourcesDirectory)\eng\common\tools.ps1 + $darc = Get-Darc + $buildInfo = & $darc get-build ` + --id ${{ parameters.BARBuildId }} ` + --extended ` + --output-format json ` + --ci ` + | convertFrom-Json - $apiHeaders = New-Object 'System.Collections.Generic.Dictionary[[String],[String]]' - $apiHeaders.Add('Accept', 'application/json') - $apiHeaders.Add('Authorization',"Bearer ${Env:MAESTRO_API_TOKEN}") - - $buildInfo = try { Invoke-WebRequest -Method Get -Uri $buildApiEndpoint -Headers $apiHeaders | ConvertFrom-Json } catch { Write-Host "Error: $_" } - - $BarId = $Env:BARBuildId + $BarId = ${{ parameters.BARBuildId }} $Channels = $Env:PromoteToMaestroChannels -split "," $Channels = $Channels -join "][" $Channels = "[$Channels]" @@ -65,6 +67,4 @@ steps: exit 1 } env: - MAESTRO_API_TOKEN: $(MaestroApiAccessToken) - BARBuildId: ${{ parameters.BARBuildId }} PromoteToMaestroChannels: ${{ parameters.PromoteToChannelIds }} diff --git a/eng/common/templates/steps/execute-sdl.yml b/eng/common/templates/steps/execute-sdl.yml index 07426fde05d..fe0ebf8c904 100644 --- a/eng/common/templates/steps/execute-sdl.yml +++ b/eng/common/templates/steps/execute-sdl.yml @@ -9,8 +9,6 @@ parameters: steps: - task: NuGetAuthenticate@1 - inputs: - nuGetServiceConnections: GuardianConnect - task: NuGetToolInstaller@1 displayName: 'Install NuGet.exe' @@ -36,16 +34,19 @@ steps: displayName: Execute SDL (Overridden) continueOnError: ${{ parameters.sdlContinueOnError }} condition: ${{ parameters.condition }} + env: + GUARDIAN_DEFAULT_PACKAGE_SOURCE_SECRET: $(System.AccessToken) - ${{ if eq(parameters.overrideParameters, '') }}: - powershell: ${{ parameters.executeAllSdlToolsScript }} -GuardianCliLocation $(GuardianCliLocation) -NugetPackageDirectory $(Build.SourcesDirectory)\.packages - -AzureDevOpsAccessToken $(dn-bot-dotnet-build-rw-code-rw) ${{ parameters.additionalParameters }} displayName: Execute SDL continueOnError: ${{ parameters.sdlContinueOnError }} condition: ${{ parameters.condition }} + env: + GUARDIAN_DEFAULT_PACKAGE_SOURCE_SECRET: $(System.AccessToken) - ${{ if ne(parameters.publishGuardianDirectoryToPipeline, 'false') }}: # We want to publish the Guardian results and configuration for easy diagnosis. However, the diff --git a/eng/common/templates/steps/get-federated-access-token.yml b/eng/common/templates/steps/get-federated-access-token.yml index c8c49cc0e8f..55e33bd38f7 100644 --- a/eng/common/templates/steps/get-federated-access-token.yml +++ b/eng/common/templates/steps/get-federated-access-token.yml @@ -3,6 +3,12 @@ parameters: type: string - name: outputVariableName type: string +- name: stepName + type: string + default: 'getFederatedAccessToken' +- name: condition + type: string + default: '' # Resource to get a token for. Common values include: # - '499b84ac-1321-427f-aa17-267ca6975798' for Azure DevOps # - 'https://storage.azure.com/' for storage @@ -10,10 +16,16 @@ parameters: - name: resource type: string default: '499b84ac-1321-427f-aa17-267ca6975798' +- name: isStepOutputVariable + type: boolean + default: false steps: - task: AzureCLI@2 displayName: 'Getting federated access token for feeds' + name: ${{ parameters.stepName }} + ${{ if ne(parameters.condition, '') }}: + condition: ${{ parameters.condition }} inputs: azureSubscription: ${{ parameters.federatedServiceConnection }} scriptType: 'pscore' @@ -25,4 +37,4 @@ steps: exit 1 } Write-Host "Setting '${{ parameters.outputVariableName }}' with the access token value" - Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true]$accessToken" \ No newline at end of file + Write-Host "##vso[task.setvariable variable=${{ parameters.outputVariableName }};issecret=true;isOutput=${{ parameters.isStepOutputVariable }}]$accessToken" \ No newline at end of file diff --git a/eng/common/templates/steps/telemetry-start.yml b/eng/common/templates/steps/telemetry-start.yml index 32c01ef0b55..6abbcb33a67 100644 --- a/eng/common/templates/steps/telemetry-start.yml +++ b/eng/common/templates/steps/telemetry-start.yml @@ -8,7 +8,7 @@ parameters: steps: - ${{ if and(eq(parameters.runAsPublic, 'false'), not(eq(variables['System.TeamProject'], 'public'))) }}: - - task: AzureKeyVault@1 + - task: AzureKeyVault@2 inputs: azureSubscription: 'HelixProd_KeyVault' KeyVaultName: HelixProdKV diff --git a/global.json b/global.json index 659d5486c4e..9e2155c9f28 100644 --- a/global.json +++ b/global.json @@ -1,6 +1,6 @@ { "tools": { - "dotnet": "8.0.101", + "dotnet": "8.0.108", "runtimes": { "dotnet": [ "2.1.30", @@ -16,12 +16,12 @@ } }, "sdk": { - "version": "8.0.101", + "version": "8.0.108", "allowPrerelease": false, "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24321.3", + "Microsoft.DotNet.Arcade.Sdk": "8.0.0-beta.24426.2", "Microsoft.Build.NoTargets": "2.0.1" } } From de7eddc0e99bbae2c131e3eb6a861a6a194337d9 Mon Sep 17 00:00:00 2001 From: "dotnet-maestro[bot]" <42748379+dotnet-maestro[bot]@users.noreply.github.com> Date: Wed, 4 Sep 2024 12:33:30 -0700 Subject: [PATCH 229/271] Update dependencies from https://github.com/dotnet/arcade build 20240903.1 (#10835) Microsoft.SourceBuild.Intermediate.arcade , Microsoft.DotNet.Arcade.Sdk From Version 9.0.0-beta.24429.5 -> To Version 9.0.0-beta.24453.1 Co-authored-by: dotnet-maestro[bot] --- eng/Version.Details.xml | 8 ++++---- eng/Versions.props | 2 +- global.json | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index 25e8a53eb8f..271bb3308f5 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -96,14 +96,14 @@ https://dev.azure.com/dnceng/internal/_git/dotnet-runtime 3a25a7f1cc446b60678ed25c9d829420d6321eba - + https://github.com/dotnet/arcade - d21db44e84b9038ea7b2add139adee2303d46800 + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 - + https://github.com/dotnet/arcade - d21db44e84b9038ea7b2add139adee2303d46800 + dd332f2d4e21daa8b79f84251ab156af9a0b11b2 diff --git a/eng/Versions.props b/eng/Versions.props index af72d6b3939..de22d65613b 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -50,7 +50,7 @@ 6.0.2-servicing.22064.6 6.0.1 9.0.0-alpha.1.24304.1 - 9.0.0-beta.24429.5 + 9.0.0-beta.24453.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 4.12.0-2.24419.3 diff --git a/global.json b/global.json index 88f4f0ce315..7f50b048965 100644 --- a/global.json +++ b/global.json @@ -22,7 +22,7 @@ "rollForward": "latestPatch" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24429.5", + "Microsoft.DotNet.Arcade.Sdk": "9.0.0-beta.24453.1", "Microsoft.Build.NoTargets": "3.7.0" } } From 148d71a9a319ea929c938ae3ba691a460cf63b5c Mon Sep 17 00:00:00 2001 From: Jordi Ramos Date: Wed, 4 Sep 2024 14:43:47 -0700 Subject: [PATCH 230/271] Fix LF line-ending auto format bug (#10802) * Implemented a line normalization function that prevents the language server from sending /r to LF line ending docs * check if indentation location has been processed * added LF line ending document to all previous razor formatting test cases * skipping some LF line ending formatting tests. Created an issue to track the progress --- .../Extensions/SourceTextExtensions.cs | 29 +++++++++++++ .../Passes/CSharpFormattingPassBase.cs | 5 ++- .../Formatting/RazorFormattingService.cs | 21 +++++++++- .../CodeDirectiveFormattingTest.cs | 6 ++- .../Formatting_NetFx/FormattingTestBase.cs | 42 +++++++++++++++++-- .../Formatting_NetFx/HtmlFormattingTest.cs | 18 +++++--- 6 files changed, 107 insertions(+), 14 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs index 77b8b9b1b8e..954acc93ae1 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/SourceTextExtensions.cs @@ -296,4 +296,33 @@ public static TextEdit[] MinimizeTextEdits(this SourceText text, TextEdit[] edit var cleanEdits = cleanChanges.Select(text.GetTextEdit).ToArray(); return cleanEdits; } + + /// + /// Determines if the given has more LF line endings ('\n') than CRLF line endings ('\r\n'). + /// + /// The to examine. + /// + /// true if the is deemed to use LF line endings; otherwise, false. + /// + public static bool HasLFLineEndings(this SourceText text) + { + var crlfCount = 0; + var lfCount = 0; + + foreach (var line in text.Lines) + { + var lineBreakSpan = TextSpan.FromBounds(line.End, line.EndIncludingLineBreak); + var lineBreak = line.Text?.ToString(lineBreakSpan) ?? string.Empty; + if (lineBreak == "\r\n") + { + crlfCount++; + } + else if (lineBreak == "\n") + { + lfCount++; + } + } + + return lfCount > crlfCount; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs index 4387ce3d7e6..e785aa49500 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/Passes/CSharpFormattingPassBase.cs @@ -133,7 +133,10 @@ protected async Task> AdjustIndentationAsync(FormattingContext } var scopeOwner = syntaxTreeRoot.FindInnermostNode(originalLocation); - sourceMappingIndentations[originalLocation] = new IndentationData(indentation); + if (!sourceMappingIndentations.ContainsKey(originalLocation)) + { + sourceMappingIndentations[originalLocation] = new IndentationData(indentation); + } // For @section blocks we have special handling to add a fake source mapping/significant location at the end of the // section, to return the indentation back to before the start of the section block. diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index d9f012ff881..176d050550b 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -108,7 +108,8 @@ public async Task GetDocumentFormattingEditsAsync( ? result : result.Where(e => range.LineOverlapsWith(e.Range)).ToArray(); - return originalText.MinimizeTextEdits(filteredEdits); + var normalizedEdits = NormalizeLineEndings(originalText, filteredEdits); + return originalText.MinimizeTextEdits(normalizedEdits); } public Task GetCSharpOnTypeFormattingEditsAsync(DocumentContext documentContext, RazorFormattingOptions options, int hostDocumentIndex, char triggerCharacter, CancellationToken cancellationToken) @@ -279,4 +280,22 @@ private static void UnwrapCSharpSnippets(TextEdit[] razorEdits) edit.NewText = edit.NewText.Replace("/*$0*/", "$0"); } } + + /// + /// This method counts the occurrences of CRLF and LF line endings in the original text. + /// If LF line endings are more prevalent, it removes any CR characters from the text edits + /// to ensure consistency with the LF style. + /// + private TextEdit[] NormalizeLineEndings(SourceText originalText, TextEdit[] edits) + { + if (originalText.HasLFLineEndings()) + { + foreach (var edit in edits) + { + edit.NewText = edit.NewText.Replace("\r", ""); + } + } + + return edits; + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs index 80589eb18ff..24ca9cf007a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/CodeDirectiveFormattingTest.cs @@ -1699,7 +1699,8 @@ await RunFormattingTestAsync( private IEnumerable _items = new[] { 1, 2, 3, 4, 5 }; } """, - tagHelpers: GetComponentWithCascadingTypeParameter()); + tagHelpers: GetComponentWithCascadingTypeParameter(), + skipFlipLineEndingTest: true); } [Fact] @@ -1789,7 +1790,8 @@ await RunFormattingTestAsync( private IEnumerable _items2 = new long[] { 1, 2, 3, 4, 5 }; } """, - tagHelpers: GetComponentWithTwoCascadingTypeParameter()); + tagHelpers: GetComponentWithTwoCascadingTypeParameter(), + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs index 8835b479edc..a43adfed09a 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingTestBase.cs @@ -49,14 +49,26 @@ private protected async Task RunFormattingTestAsync( ImmutableArray tagHelpers = default, bool allowDiagnostics = false, RazorLSPOptions? razorLSPOptions = null, - bool inGlobalNamespace = false) + bool inGlobalNamespace = false, + bool skipFlipLineEndingTest = false) { // Run with and without forceRuntimeCodeGeneration - await RunFormattingTestAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); - await RunFormattingTestAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + + // some tests are failing, skip for now, tracked by https://github.com/dotnet/razor/issues/10836 + if (!skipFlipLineEndingTest) + { + // flip the line endings of the stings (LF to CRLF and vice versa) and run again + input = FlipLineEndings(input); + expected = FlipLineEndings(expected); + + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: true); + await RunFormattingTestInternalAsync(input, expected, tabSize, insertSpaces, fileKind, tagHelpers, allowDiagnostics, razorLSPOptions, inGlobalNamespace, forceRuntimeCodeGeneration: false); + } } - private async Task RunFormattingTestAsync(string input, string expected, int tabSize, bool insertSpaces, string? fileKind, ImmutableArray tagHelpers, bool allowDiagnostics, RazorLSPOptions? razorLSPOptions, bool inGlobalNamespace, bool forceRuntimeCodeGeneration) + private async Task RunFormattingTestInternalAsync(string input, string expected, int tabSize, bool insertSpaces, string? fileKind, ImmutableArray tagHelpers, bool allowDiagnostics, RazorLSPOptions? razorLSPOptions, bool inGlobalNamespace, bool forceRuntimeCodeGeneration) { // Arrange fileKind ??= FileKinds.Component; @@ -351,4 +363,26 @@ internal static IDocumentSnapshot CreateDocumentSnapshot(string path, ImmutableA }); return documentSnapshot.Object; } + + private static string FlipLineEndings(string input) + { + if (string.IsNullOrEmpty(input)) + { + return input; + } + + var hasCRLF = input.Contains("\r\n"); + var hasLF = !hasCRLF && input.Contains("\n"); + + if (hasCRLF) + { + return input.Replace("\r\n", "\n"); + } + else if (hasLF) + { + return input.Replace("\n", "\r\n"); + } + + return input; + } } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs index 6ef32d08326..300f2fc42c1 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/HtmlFormattingTest.cs @@ -487,7 +487,8 @@ await RunFormattingTestAsync( } """, - tagHelpers: tagHelpers); + tagHelpers: tagHelpers, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -595,7 +596,8 @@ await RunFormattingTestAsync( @{

} - """); + """, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1316,7 +1318,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1428,7 +1431,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1486,7 +1490,8 @@ await RunFormattingTestAsync( public bool VarBool { get; set; } } """, - fileKind: FileKinds.Component); + fileKind: FileKinds.Component, + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 } [Fact] @@ -1794,7 +1799,8 @@ await RunFormattingTestAsync( } """, - tagHelpers: CreateTagHelpers()); + tagHelpers: CreateTagHelpers(), + skipFlipLineEndingTest: true); // tracked by https://github.com/dotnet/razor/issues/10836 ImmutableArray CreateTagHelpers() { From 42cc39e4a95bc135b06f83b9fd3e08367247ec96 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 5 Sep 2024 08:34:32 +1000 Subject: [PATCH 231/271] PR Feedback --- .../ProjectSystem/IProjectSnapshotExtensions.cs | 11 +++++++++++ .../ProjectSystem/ProjectChangeEventArgs.cs | 10 +++++----- .../ProjectSystem/ProjectSnapshotManager.Entry.cs | 4 ++-- .../ProjectSystem/ProjectSnapshotManager.cs | 6 +++--- .../VisualStudioDocumentTrackerTest.cs | 11 ++++------- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshotExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshotExtensions.cs index 3d48ba9d848..4735509191e 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshotExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/IProjectSnapshotExtensions.cs @@ -1,6 +1,7 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. +using System; using System.Collections.Immutable; using System.Diagnostics; using System.Threading; @@ -50,4 +51,14 @@ public static ImmutableArray GetTagHelpersSynchronously(thi return tagHelperTask.Result; #pragma warning restore VSTHRD002 // Avoid problematic synchronous waits } + + public static ImmutableArray GetRelatedDocuments(this IProjectSnapshot projectSnapshot, IDocumentSnapshot document) + { + if (projectSnapshot is not ProjectSnapshot project) + { + throw new InvalidOperationException("This method can only be called with a ProjectSnapshot."); + } + + return project.GetRelatedDocuments(document); + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs index be4ce51e13b..9d2843994e0 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectChangeEventArgs.cs @@ -8,12 +8,12 @@ namespace Microsoft.CodeAnalysis.Razor.ProjectSystem; internal class ProjectChangeEventArgs : EventArgs { - public ProjectChangeEventArgs(ProjectSnapshot older, ProjectSnapshot newer, ProjectChangeKind kind) + public ProjectChangeEventArgs(IProjectSnapshot older, IProjectSnapshot newer, ProjectChangeKind kind) : this(older, newer, null, kind, false) { } - public ProjectChangeEventArgs(ProjectSnapshot? older, ProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind, bool solutionIsClosing) + public ProjectChangeEventArgs(IProjectSnapshot? older, IProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind, bool solutionIsClosing) { if (older is null && newer is null) { @@ -29,9 +29,9 @@ public ProjectChangeEventArgs(ProjectSnapshot? older, ProjectSnapshot? newer, st ProjectKey = (older ?? newer)!.Key; } - public ProjectSnapshot? Older { get; } + public IProjectSnapshot? Older { get; } - public ProjectSnapshot? Newer { get; } + public IProjectSnapshot? Newer { get; } public ProjectKey ProjectKey { get; } @@ -43,6 +43,6 @@ public ProjectChangeEventArgs(ProjectSnapshot? older, ProjectSnapshot? newer, st public bool SolutionIsClosing { get; } - public static ProjectChangeEventArgs CreateTestInstance(ProjectSnapshot older, ProjectSnapshot newer, string documentFilePath, ProjectChangeKind kind, bool solutionIsClosing = false) => + public static ProjectChangeEventArgs CreateTestInstance(IProjectSnapshot older, IProjectSnapshot newer, string documentFilePath, ProjectChangeKind kind, bool solutionIsClosing = false) => new(older, newer, documentFilePath, kind, solutionIsClosing); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs index c02de7a1bad..48341f3dd5d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.Entry.cs @@ -7,9 +7,9 @@ internal partial class ProjectSnapshotManager { private sealed record Entry(ProjectState State) { - private ProjectSnapshot? _snapshotUnsafe; + private IProjectSnapshot? _snapshotUnsafe; - public ProjectSnapshot GetSnapshot() + public IProjectSnapshot GetSnapshot() { return _snapshotUnsafe ??= new ProjectSnapshot(State); } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs index 96c5e4b8d65..40f7d967401 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectSnapshotManager.cs @@ -383,7 +383,7 @@ private void SolutionClosed() } } - private void NotifyListeners(ProjectSnapshot? older, ProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind) + private void NotifyListeners(IProjectSnapshot? older, IProjectSnapshot? newer, string? documentFilePath, ProjectChangeKind kind) { if (!_initialized) { @@ -421,8 +421,8 @@ private bool TryUpdate( ProjectKey projectKey, string? documentFilePath, IUpdateProjectAction action, - [NotNullWhen(true)] out ProjectSnapshot? oldSnapshot, - [NotNullWhen(true)] out ProjectSnapshot? newSnapshot) + [NotNullWhen(true)] out IProjectSnapshot? oldSnapshot, + [NotNullWhen(true)] out IProjectSnapshot? newSnapshot) { using var upgradeableLock = _readerWriterLock.DisposableUpgradeableRead(); diff --git a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs index 1ce0405fbdb..ea936cb99b2 100644 --- a/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs +++ b/src/Razor/test/Microsoft.VisualStudio.LegacyEditor.Razor.Test/VisualStudioDocumentTrackerTest.cs @@ -161,8 +161,7 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); - var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectAdded); + var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_hostProject.Key), ProjectChangeKind.ProjectAdded); var called = false; _documentTracker.ContextChanged += (sender, args) => @@ -188,8 +187,7 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); - var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectChanged); + var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_hostProject.Key), ProjectChangeKind.ProjectChanged); var called = false; _documentTracker.ContextChanged += (sender, args) => @@ -215,7 +213,7 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_hostProject); }); - var project = (ProjectSnapshot)_projectManager.GetLoadedProject(_hostProject.Key); + var project = _projectManager.GetLoadedProject(_hostProject.Key); await _projectManager.UpdateAsync(updater => { @@ -249,8 +247,7 @@ await _projectManager.UpdateAsync(updater => updater.ProjectAdded(_otherHostProject); }); - var projectSnapshot = (ProjectSnapshot)_projectManager.GetLoadedProject(_otherHostProject.Key); - var e = new ProjectChangeEventArgs(null!, projectSnapshot, ProjectChangeKind.ProjectChanged); + var e = new ProjectChangeEventArgs(null!, _projectManager.GetLoadedProject(_otherHostProject.Key), ProjectChangeKind.ProjectChanged); var called = false; _documentTracker.ContextChanged += (sender, args) => called = true; From 7d8be8e16767e182beb31388d70c73eab1006abf Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 5 Sep 2024 12:12:55 +1000 Subject: [PATCH 232/271] Most PR feedback --- .../RazorCSharpFormattingBenchmark.cs | 2 +- .../CSharp/DefaultCSharpCodeActionResolver.cs | 2 +- .../Formatting/RazorFormattingOptions.cs | 2 -- .../Formatting/RazorFormattingService.cs | 15 ++++---- .../Remote/IRemoteFormattingService.cs | 34 +++++++++++++++--- .../Formatting/RemoteFormattingService.cs | 35 ++++++++++--------- .../RemoteRazorFormattingService.cs | 2 +- .../CohostDocumentFormattingEndpoint.cs | 12 +++---- .../Cohost/CohostOnTypeFormattingEndpoint.cs | 8 ++--- .../Cohost/CohostRangeFormattingEndpoint.cs | 8 ++--- .../FormattingLanguageServerTestBase.cs | 2 +- 11 files changed, 73 insertions(+), 49 deletions(-) diff --git a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs index 12056563e09..88d6e3b633f 100644 --- a/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs +++ b/src/Razor/benchmarks/Microsoft.AspNetCore.Razor.Microbenchmarks/LanguageServer/RazorCSharpFormattingBenchmark.cs @@ -112,7 +112,7 @@ public async Task RazorCSharpFormattingAsync() { var documentContext = new DocumentContext(DocumentUri, DocumentSnapshot, projectContext: null); - var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits: [], range: null, RazorFormattingOptions.Default, CancellationToken.None); + var edits = await RazorFormattingService.GetDocumentFormattingEditsAsync(documentContext, htmlEdits: [], range: null, new RazorFormattingOptions(), CancellationToken.None); #if DEBUG // For debugging purposes only. diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs index 5e0636c6818..7457c02597f 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/CodeActions/CSharp/DefaultCSharpCodeActionResolver.cs @@ -68,7 +68,7 @@ public async override Task ResolveAsync( var formattedEdit = await _razorFormattingService.GetCSharpCodeActionEditAsync( documentContext, csharpTextEdits, - RazorFormattingOptions.Default, + new RazorFormattingOptions(), cancellationToken).ConfigureAwait(false); cancellationToken.ThrowIfCancellationRequested(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs index a1ab2f6a3e3..fdacc443ec3 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingOptions.cs @@ -10,8 +10,6 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; [DataContract] internal readonly record struct RazorFormattingOptions { - public static readonly RazorFormattingOptions Default = new(); - [DataMember(Order = 0)] public bool InsertSpaces { get; init; } = true; [DataMember(Order = 1)] diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index c5f28c682c7..87bf5d68bfd 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -199,16 +199,13 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) { triggerCharacterKind = _documentMappingService.GetLanguageKind(codeDocument, hostDocumentIndex, rightAssociative: false); - if (triggerCharacterKind is RazorLanguageKind.CSharp) - { - return s_csharpTriggerCharacterSet.Contains(triggerCharacter); - } - else if (triggerCharacterKind is RazorLanguageKind.Html) - { - return s_htmlTriggerCharacterSet.Contains(triggerCharacter); - } - return false; + return triggerCharacterKind switch + { + RazorLanguageKind.CSharp => s_csharpTriggerCharacterSet.Contains(triggerCharacter), + RazorLanguageKind.Html => s_htmlTriggerCharacterSet.Contains(triggerCharacter), + _ => false, + }; } private async Task ApplyFormattedEditsAsync( diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs index 8a1b7aa3798..3ec3ae4cb9c 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Remote/IRemoteFormattingService.cs @@ -12,10 +12,36 @@ namespace Microsoft.CodeAnalysis.Razor.Remote; internal interface IRemoteFormattingService { - ValueTask> GetDocumentFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, RazorFormattingOptions options, CancellationToken cancellationToken); - ValueTask> GetRangeFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, LinePositionSpan linePositionSpan, RazorFormattingOptions options, CancellationToken cancellationToken); - ValueTask> GetOnTypeFormattingEditsAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, ImmutableArray htmlChanges, LinePosition linePosition, string triggerCharacter, RazorFormattingOptions options, CancellationToken cancellationToken); - ValueTask GetOnTypeFormattingTriggerKindAsync(RazorPinnedSolutionInfoWrapper solutionInfo, DocumentId documentId, LinePosition linePosition, string triggerCharacter, CancellationToken cancellationToken); + ValueTask> GetDocumentFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + ValueTask> GetRangeFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + LinePositionSpan linePositionSpan, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + ValueTask> GetOnTypeFormattingEditsAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + LinePosition linePosition, + string triggerCharacter, + RazorFormattingOptions options, + CancellationToken cancellationToken); + + ValueTask GetOnTypeFormattingTriggerKindAsync( + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + LinePosition linePosition, + string triggerCharacter, + CancellationToken cancellationToken); internal enum TriggerKind { diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs index e0dc5d35acb..e3e334604cf 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteFormattingService.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Collections.Immutable; +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -53,24 +54,24 @@ private async ValueTask> GetDocumentFormattingEditsAs if (edits is null) { - return ImmutableArray.Empty; + return []; } return edits.SelectAsArray(sourceText.GetTextChange); } public ValueTask> GetRangeFormattingEditsAsync( - RazorPinnedSolutionInfoWrapper solutionInfo, - DocumentId documentId, - ImmutableArray htmlChanges, - LinePositionSpan linePositionSpan, - RazorFormattingOptions options, - CancellationToken cancellationToken) - => RunServiceAsync( - solutionInfo, - documentId, - context => GetRangeFormattingEditsAsync(context, htmlChanges, linePositionSpan, options, cancellationToken), - cancellationToken); + RazorPinnedSolutionInfoWrapper solutionInfo, + DocumentId documentId, + ImmutableArray htmlChanges, + LinePositionSpan linePositionSpan, + RazorFormattingOptions options, + CancellationToken cancellationToken) + => RunServiceAsync( + solutionInfo, + documentId, + context => GetRangeFormattingEditsAsync(context, htmlChanges, linePositionSpan, options, cancellationToken), + cancellationToken); private async ValueTask> GetRangeFormattingEditsAsync( RemoteDocumentContext context, @@ -86,7 +87,7 @@ private async ValueTask> GetRangeFormattingEditsAsync if (edits is null) { - return ImmutableArray.Empty; + return []; } return edits.SelectAsArray(sourceText.GetTextChange); @@ -132,8 +133,7 @@ private async ValueTask> GetOnTypeFormattingEditsAsyn } else { - Assumed.Unreachable(); - return []; + return Assumed.Unreachable>(); } return result.SelectAsArray(sourceText.GetTextChange); @@ -154,7 +154,7 @@ public ValueTask GetOnTypeFormattingTriggerKindAsync( private async ValueTask IsValidOnTypeFormattingTriggerAsync(RemoteDocumentContext context, LinePosition linePosition, string triggerCharacter, CancellationToken cancellationToken) { var codeDocument = await context.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - var sourceText = await context.GetSourceTextAsync(cancellationToken).ConfigureAwait(false); + var sourceText = codeDocument.Source.Text; if (!sourceText.TryGetAbsoluteIndex(linePosition, out var hostDocumentIndex)) { return Response.Invalid; @@ -170,6 +170,9 @@ private async ValueTask IsValidOnTypeFormattingTriggerAsync(RemoteDocu return Response.ValidHtml; } + // TryGetOnTypeFormattingTriggerKind only returns true for C# or Html + Debug.Assert(triggerCharacterKind is RazorLanguageKind.CSharp); + return Response.ValidCSharp; } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs index 7d9344fe3d0..6974dabd019 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Remote.Razor/Formatting/RemoteRazorFormattingService.cs @@ -11,7 +11,7 @@ namespace Microsoft.CodeAnalysis.Remote.Razor.Formatting; [Export(typeof(IRazorFormattingService)), Shared] [method: ImportingConstructor] -internal class RemoteRazorFormattingService(IFormattingCodeDocumentProvider codeDocumentProvider, IDocumentMappingService documentMappingService, IAdhocWorkspaceFactory adhocWorkspaceFactory, ILoggerFactory loggerFactory) +internal sealed class RemoteRazorFormattingService(IFormattingCodeDocumentProvider codeDocumentProvider, IDocumentMappingService documentMappingService, IAdhocWorkspaceFactory adhocWorkspaceFactory, ILoggerFactory loggerFactory) : RazorFormattingService(codeDocumentProvider, documentMappingService, adhocWorkspaceFactory, loggerFactory) { } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs index 8589644a08a..9fa42babe9a 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentFormattingEndpoint.cs @@ -27,7 +27,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [ExportCohostStatelessLspService(typeof(CohostDocumentFormattingEndpoint))] [method: ImportingConstructor] #pragma warning restore RS0030 // Do not use banned APIs -internal class CohostDocumentFormattingEndpoint( +internal sealed class CohostDocumentFormattingEndpoint( IRemoteServiceInvoker remoteServiceInvoker, IHtmlDocumentSynchronizer htmlDocumentSynchronizer, LSPRequestInvoker requestInvoker, @@ -71,7 +71,7 @@ internal class CohostDocumentFormattingEndpoint( private async Task HandleRequestAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) { _logger.LogDebug($"Getting Html formatting changes for {razorDocument.FilePath}"); - var htmlResult = await GetHtmlFormattingEditsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); + var htmlResult = await TryGetHtmlFormattingEditsAsync(request, razorDocument, cancellationToken).ConfigureAwait(false); if (htmlResult is not { } htmlEdits) { @@ -91,17 +91,17 @@ internal class CohostDocumentFormattingEndpoint( (service, solutionInfo, cancellationToken) => service.GetDocumentFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, options, cancellationToken), cancellationToken).ConfigureAwait(false); - if (remoteResult is [_, ..] allChanges) + if (remoteResult.Length > 0) { - _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + _logger.LogDebug($"Got a total of {remoteResult.Length} ranges back from OOP"); - return allChanges.Select(sourceText.GetTextEdit).ToArray(); + return remoteResult.Select(sourceText.GetTextEdit).ToArray(); } return null; } - private async Task GetHtmlFormattingEditsAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) + private async Task TryGetHtmlFormattingEditsAsync(DocumentFormattingParams request, TextDocument razorDocument, CancellationToken cancellationToken) { var htmlDocument = await _htmlDocumentSynchronizer.TryGetSynchronizedHtmlDocumentAsync(razorDocument, cancellationToken).ConfigureAwait(false); if (htmlDocument is null) diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs index e5cd437628f..11a2a6f2071 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs @@ -27,7 +27,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [ExportCohostStatelessLspService(typeof(CohostOnTypeFormattingEndpoint))] [method: ImportingConstructor] #pragma warning restore RS0030 // Do not use banned APIs -internal class CohostOnTypeFormattingEndpoint( +internal sealed class CohostOnTypeFormattingEndpoint( IRemoteServiceInvoker remoteServiceInvoker, IHtmlDocumentSynchronizer htmlDocumentSynchronizer, LSPRequestInvoker requestInvoker, @@ -127,11 +127,11 @@ internal class CohostOnTypeFormattingEndpoint( (service, solutionInfo, cancellationToken) => service.GetOnTypeFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, request.Position.ToLinePosition(), request.Character, options, cancellationToken), cancellationToken).ConfigureAwait(false); - if (remoteResult is [_, ..] allChanges) + if (remoteResult.Length > 0) { - _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + _logger.LogDebug($"Got a total of {remoteResult.Length} ranges back from OOP"); - return allChanges.Select(sourceText.GetTextEdit).ToArray(); + return remoteResult.Select(sourceText.GetTextEdit).ToArray(); } return null; diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs index 9be30b7eabe..cc27035b560 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostRangeFormattingEndpoint.cs @@ -27,7 +27,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [ExportCohostStatelessLspService(typeof(CohostRangeFormattingEndpoint))] [method: ImportingConstructor] #pragma warning restore RS0030 // Do not use banned APIs -internal class CohostRangeFormattingEndpoint( +internal sealed class CohostRangeFormattingEndpoint( IRemoteServiceInvoker remoteServiceInvoker, IHtmlDocumentSynchronizer htmlDocumentSynchronizer, LSPRequestInvoker requestInvoker, @@ -91,11 +91,11 @@ internal class CohostRangeFormattingEndpoint( (service, solutionInfo, cancellationToken) => service.GetRangeFormattingEditsAsync(solutionInfo, razorDocument.Id, htmlChanges, request.Range.ToLinePositionSpan(), options, cancellationToken), cancellationToken).ConfigureAwait(false); - if (remoteResult is [_, ..] allChanges) + if (remoteResult.Length > 0) { - _logger.LogDebug($"Got a total of {allChanges.Length} ranges back from OOP"); + _logger.LogDebug($"Got a total of {remoteResult.Length} ranges back from OOP"); - return allChanges.Select(sourceText.GetTextEdit).ToArray(); + return remoteResult.Select(sourceText.GetTextEdit).ToArray(); } return null; diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs index d14e475aa56..85dfee530aa 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/FormattingLanguageServerTestBase.cs @@ -69,7 +69,7 @@ public Task GetHtmlOnTypeFormattingEditsAsync(DocumentContext docume public bool TryGetOnTypeFormattingTriggerKind(RazorCodeDocument codeDocument, int hostDocumentIndex, string triggerCharacter, out RazorLanguageKind triggerCharacterKind) { - triggerCharacterKind = languageKind ?? RazorLanguageKind.CSharp; + triggerCharacterKind = languageKind.GetValueOrDefault(); return languageKind is not null; } } From d87ad016dd11c313341b504f50144cb7261c4b8d Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 5 Sep 2024 13:09:33 +1000 Subject: [PATCH 233/271] Move initialization logic --- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 6 +----- .../Hosting/LspInitializationHelpers.cs | 9 +++++++++ .../Formatting/RazorFormattingService.cs | 5 +++-- .../Cohost/CohostOnTypeFormattingEndpoint.cs | 5 ++--- .../Formatting_NetFx/RazorFormattingServiceTest.cs | 13 ++----------- 5 files changed, 17 insertions(+), 21 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 6568e9deb30..af7b91a5c2c 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -41,11 +41,7 @@ internal class DocumentOnTypeFormattingEndpoint( public void ApplyCapabilities(VSInternalServerCapabilities serverCapabilities, VSInternalClientCapabilities clientCapabilities) { - serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions - { - FirstTriggerCharacter = RazorFormattingService.AllTriggerCharacters[0], - MoreTriggerCharacter = RazorFormattingService.AllTriggerCharacters.AsSpan()[1..].ToArray(), - }; + serverCapabilities.DocumentOnTypeFormattingProvider = new DocumentOnTypeFormattingOptions().EnableOnTypeFormattingTriggerCharacters(); } public TextDocumentIdentifier GetTextDocumentIdentifier(DocumentOnTypeFormattingParams request) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs index ac141c81680..f6016f918cf 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Hosting/LspInitializationHelpers.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Linq; +using Microsoft.CodeAnalysis.Razor.Formatting; using Microsoft.CodeAnalysis.Razor.SemanticTokens; using Microsoft.VisualStudio.LanguageServer.Protocol; @@ -84,4 +85,12 @@ public static VSInternalDocumentOnAutoInsertOptions EnableOnAutoInsert( return options; } + + public static DocumentOnTypeFormattingOptions EnableOnTypeFormattingTriggerCharacters(this DocumentOnTypeFormattingOptions options) + { + options.FirstTriggerCharacter = RazorFormattingService.FirstTriggerCharacter; + options.MoreTriggerCharacter = RazorFormattingService.MoreTriggerCharacters.ToArray(); + + return options; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index 6186505c51f..b4c593f67d7 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -23,8 +23,9 @@ namespace Microsoft.CodeAnalysis.Razor.Formatting; internal class RazorFormattingService : IRazorFormattingService { - public static readonly ImmutableArray AllTriggerCharacters = ["}", ";", "\n", "{"]; - public static readonly FrozenSet AllTriggerCharacterSet = AllTriggerCharacters.ToFrozenSet(StringComparer.Ordinal); + public static readonly string FirstTriggerCharacter = "}"; + public static readonly ImmutableArray MoreTriggerCharacters = [";", "\n", "{"]; + public static readonly FrozenSet AllTriggerCharacterSet = FrozenSet.ToFrozenSet([FirstTriggerCharacter, .. MoreTriggerCharacters], StringComparer.Ordinal); private static readonly FrozenSet s_csharpTriggerCharacterSet = FrozenSet.ToFrozenSet(["}", ";"], StringComparer.Ordinal); private static readonly FrozenSet s_htmlTriggerCharacterSet = FrozenSet.ToFrozenSet(["\n", "{", "}", ";"], StringComparer.Ordinal); diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs index 11a2a6f2071..a08a12a2a63 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostOnTypeFormattingEndpoint.cs @@ -8,6 +8,7 @@ using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor; +using Microsoft.AspNetCore.Razor.LanguageServer.Hosting; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.ExternalAccess.Razor.Cohost; using Microsoft.CodeAnalysis.Razor.Formatting; @@ -55,9 +56,7 @@ internal sealed class CohostOnTypeFormattingEndpoint( RegisterOptions = new DocumentOnTypeFormattingRegistrationOptions() { DocumentSelector = filter, - FirstTriggerCharacter = RazorFormattingService.AllTriggerCharacters[0], - MoreTriggerCharacter = RazorFormattingService.AllTriggerCharacters.AsSpan()[1..].ToArray(), - } + }.EnableOnTypeFormattingTriggerCharacters() }; } diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs index b3d38ddd5bd..6c56614d771 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/RazorFormattingServiceTest.cs @@ -46,7 +46,7 @@ public void AllTriggerCharacters_IncludesCSharpTriggerCharacters() { foreach (var character in RazorFormattingService.TestAccessor.GetCSharpTriggerCharacterSet()) { - Assert.Contains(character, RazorFormattingService.AllTriggerCharacters); + Assert.Contains(character, RazorFormattingService.AllTriggerCharacterSet); } } @@ -55,16 +55,7 @@ public void AllTriggerCharacters_IncludesHtmlTriggerCharacters() { foreach (var character in RazorFormattingService.TestAccessor.GetHtmlTriggerCharacterSet()) { - Assert.Contains(character, RazorFormattingService.AllTriggerCharacters); + Assert.Contains(character, RazorFormattingService.AllTriggerCharacterSet); } } - - [Fact] - public void AllTriggerCharacters_ContainsUniqueCharacters() - { - var allChars = RazorFormattingService.AllTriggerCharacters; - var distinctChars = allChars.Distinct().ToArray(); - - Assert.Equal(distinctChars, allChars); - } } From b7cd05e45378f91951ef430b6d4660bd368f847b Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 5 Sep 2024 13:15:10 +1000 Subject: [PATCH 234/271] Remove unused parameter --- .../DocumentOnTypeFormattingEndpoint.cs | 2 -- .../Formatting/RazorFormattingService.cs | 2 +- .../DocumentOnTypeFormattingEndpointTest.cs | 23 +++++-------------- 3 files changed, 7 insertions(+), 20 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index af7b91a5c2c..2c2a853b61b 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -26,13 +26,11 @@ namespace Microsoft.AspNetCore.Razor.LanguageServer.Formatting; internal class DocumentOnTypeFormattingEndpoint( IRazorFormattingService razorFormattingService, IHtmlFormatter htmlFormatter, - IDocumentMappingService documentMappingService, RazorLSPOptionsMonitor optionsMonitor, ILoggerFactory loggerFactory) : IRazorRequestHandler, ICapabilitiesProvider { private readonly IRazorFormattingService _razorFormattingService = razorFormattingService; - private readonly IDocumentMappingService _documentMappingService = documentMappingService; private readonly RazorLSPOptionsMonitor _optionsMonitor = optionsMonitor; private readonly IHtmlFormatter _htmlFormatter = htmlFormatter; private readonly ILogger _logger = loggerFactory.GetOrCreateLogger(); diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs index b4c593f67d7..396f6cf7ee8 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Formatting/RazorFormattingService.cs @@ -310,7 +310,7 @@ private static void UnwrapCSharpSnippets(TextEdit[] razorEdits) /// If LF line endings are more prevalent, it removes any CR characters from the text edits /// to ensure consistency with the LF style. ///
- private TextEdit[] NormalizeLineEndings(SourceText originalText, TextEdit[] edits) + private static TextEdit[] NormalizeLineEndings(SourceText originalText, TextEdit[] edits) { if (originalText.HasLFLineEndings()) { diff --git a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs index 5448d383abf..7d313bfffa3 100644 --- a/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs +++ b/src/Razor/test/Microsoft.AspNetCore.Razor.LanguageServer.Test/Formatting_NetFx/DocumentOnTypeFormattingEndpointTest.cs @@ -4,12 +4,9 @@ using System; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; -using Microsoft.AspNetCore.Razor.Test.Common.LanguageServer; -using Microsoft.CodeAnalysis.Razor.DocumentMapping; using Microsoft.CodeAnalysis.Razor.ProjectSystem; using Microsoft.CodeAnalysis.Razor.Protocol; using Microsoft.VisualStudio.LanguageServer.Protocol; -using Moq; using Xunit; using Xunit.Abstractions; @@ -23,12 +20,11 @@ public async Task Handle_OnTypeFormatting_FormattingDisabled_ReturnsNull() // Arrange var uri = new Uri("file://path/test.razor"); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: false); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams { TextDocument = new TextDocumentIdentifier { Uri = uri, } }; var requestContext = CreateRazorRequestContext(documentContext: null); @@ -52,12 +48,11 @@ public async Task Handle_OnTypeFormatting_DocumentNotFound_ReturnsNull() var documentContext = CreateDocumentContext(new Uri("file://path/testDifferentFile.razor"), codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -87,12 +82,11 @@ public async Task Handle_OnTypeFormatting_RemapFailed_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, new TestDocumentContextFactory(), LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -123,12 +117,10 @@ public async Task Handle_OnTypeFormatting_HtmlLanguageKind_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Html); - var documentMappingService = new Mock(MockBehavior.Strict); - documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Html); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -159,12 +151,10 @@ public async Task Handle_OnTypeFormatting_RazorLanguageKind_ReturnsNull() var documentContext = CreateDocumentContext(uri, codeDocument); var formattingService = new DummyRazorFormattingService(RazorLanguageKind.Razor); - var documentMappingService = new Mock(MockBehavior.Strict); - documentMappingService.Setup(s => s.GetLanguageKind(codeDocument, 17, false)).Returns(RazorLanguageKind.Razor); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService.Object, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, @@ -194,12 +184,11 @@ public async Task Handle_OnTypeFormatting_UnexpectedTriggerCharacter_ReturnsNull var documentContextFactory = CreateDocumentContextFactory(uri, codeDocument); var formattingService = new DummyRazorFormattingService(); - var documentMappingService = new LspDocumentMappingService(FilePathService, documentContextFactory, LoggerFactory); var optionsMonitor = GetOptionsMonitor(enableFormatting: true); var htmlFormatter = new TestHtmlFormatter(); var endpoint = new DocumentOnTypeFormattingEndpoint( - formattingService, htmlFormatter, documentMappingService, optionsMonitor, LoggerFactory); + formattingService, htmlFormatter, optionsMonitor, LoggerFactory); var @params = new DocumentOnTypeFormattingParams() { TextDocument = new TextDocumentIdentifier { Uri = uri, }, From e0b2935d30349080403d22379a13df2a512df713 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Thu, 5 Sep 2024 14:01:52 +1000 Subject: [PATCH 235/271] PR Feedback --- .../SpellCheck/DocumentSpellCheckEndpoint.cs | 2 +- .../Extensions/RazorSyntaxNodeExtensions.cs | 12 ++++++ .../SpellCheck/SpellCheckService.cs | 40 +++++++------------ .../RemoteCSharpSpellCheckRangeProvider.cs | 4 +- .../CohostDocumentSpellCheckEndpoint.cs | 2 +- .../CohostWorkspaceSpellCheckEndpoint.cs | 2 +- 6 files changed, 31 insertions(+), 31 deletions(-) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs index aa2173d784d..3cd304c989a 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/SpellCheck/DocumentSpellCheckEndpoint.cs @@ -40,7 +40,7 @@ public TextDocumentIdentifier GetTextDocumentIdentifier(VSInternalDocumentSpellC [ new VSInternalSpellCheckableRangeReport { - Ranges =data, + Ranges = data, ResultId = Guid.NewGuid().ToString() } ]; diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs index e3232c19d44..a0d33a9155d 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/RazorSyntaxNodeExtensions.cs @@ -308,4 +308,16 @@ static bool IsCSharpCodeBlockSyntax(SyntaxNode node) return node is CSharpCodeBlockSyntax; } } + + public static bool IsAnyAttributeSyntax(this SyntaxNode node) + { + return node is + MarkupAttributeBlockSyntax or + MarkupMinimizedAttributeBlockSyntax or + MarkupTagHelperAttributeSyntax or + MarkupMinimizedTagHelperAttributeSyntax or + MarkupTagHelperDirectiveAttributeSyntax or + MarkupMinimizedTagHelperDirectiveAttributeSyntax or + MarkupMiscAttributeContentSyntax; + } } diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs index 5690e39cff0..0ab6c5ac690 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/SpellCheck/SpellCheckService.cs @@ -1,7 +1,6 @@ // Copyright (c) .NET Foundation. All rights reserved. // Licensed under the MIT license. See License.txt in the project root for license information. -using System.Collections.Generic; using System.Collections.Immutable; using System.Threading; using System.Threading.Tasks; @@ -23,21 +22,24 @@ internal class SpellCheckService( public async Task GetSpellCheckRangeTriplesAsync(DocumentContext documentContext, CancellationToken cancellationToken) { - using var ranges = new PooledArrayBuilder(); + using var builder = new PooledArrayBuilder(); var syntaxTree = await documentContext.GetSyntaxTreeAsync(cancellationToken).ConfigureAwait(false); - AddRazorSpellCheckRanges(ref ranges.AsRef(), syntaxTree); + AddRazorSpellCheckRanges(ref builder.AsRef(), syntaxTree); var csharpRanges = await _csharpSpellCheckService.GetCSharpSpellCheckRangesAsync(documentContext, cancellationToken).ConfigureAwait(false); if (csharpRanges.Length > 0) { var codeDocument = await documentContext.GetCodeDocumentAsync(cancellationToken).ConfigureAwait(false); - AddCSharpSpellCheckRanges(ref ranges.AsRef(), csharpRanges, codeDocument); + AddCSharpSpellCheckRanges(ref builder.AsRef(), csharpRanges, codeDocument); } - return ConvertSpellCheckRangesToIntTriples(ranges.ToImmutable()); + // Important to sort first as we're calculating relative indexes + var ranges = builder.ToImmutableOrderedBy(static r => r.AbsoluteStartIndex); + + return ConvertSpellCheckRangesToIntTriples(ranges); } private static void AddRazorSpellCheckRanges(ref PooledArrayBuilder ranges, RazorSyntaxTree syntaxTree) @@ -59,13 +61,7 @@ private static void AddRazorSpellCheckRanges(ref PooledArrayBuilder r { var csharpDocument = codeDocument.GetCSharpDocument(); - foreach (var report in csharpRanges) + foreach (var range in csharpRanges) { - var absoluteCSharpStartIndex = report.AbsoluteStartIndex; - var length = report.Length; + var absoluteCSharpStartIndex = range.AbsoluteStartIndex; + var length = range.Length; // We need to map the start index to produce results, and we validate that we can map the end index so we don't have // squiggles that go from C# into Razor/Html. - if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out var _1, out var hostDocumentIndex) && - _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out var _2, out var _3)) + if (_documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex, out _, out var hostDocumentIndex) && + _documentMappingService.TryMapToHostDocumentPosition(csharpDocument, absoluteCSharpStartIndex + length, out _, out _)) { - ranges.Add(new(report.Kind, hostDocumentIndex, length)); + ranges.Add(range with { AbsoluteStartIndex = hostDocumentIndex }); } } } private static int[] ConvertSpellCheckRangesToIntTriples(ImmutableArray ranges) { - // Important to sort first as we're calculating relative indexes - ranges = ranges.OrderAsArray(CompareSpellCheckRanges); - using var data = new PooledArrayBuilder(ranges.Length * 3); var lastAbsoluteEndIndex = 0; @@ -129,9 +122,4 @@ private static int[] ConvertSpellCheckRangesToIntTriples(ImmutableArray> GetCSharpSpellCheckRangesAsync(DocumentContext documentContext, CancellationToken cancellationToken) { @@ -25,6 +25,6 @@ public async Task> GetCSharpSpellCheckRangesAsyn var csharpRanges = await ExternalAccess.Razor.Cohost.Handlers.SpellCheck.GetSpellCheckSpansAsync(generatedDocument, cancellationToken).ConfigureAwait(false); - return csharpRanges.SelectAsArray(r => new SpellCheckRange((int)r.Kind, r.StartIndex, r.Length)); + return csharpRanges.SelectAsArray(static r => new SpellCheckRange((int)r.Kind, r.StartIndex, r.Length)); } } diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs index 9aa87a0cd69..e12e969f886 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostDocumentSpellCheckEndpoint.cs @@ -20,7 +20,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [ExportCohostStatelessLspService(typeof(CohostDocumentSpellCheckEndpoint))] [method: ImportingConstructor] #pragma warning restore RS0030 // Do not use banned APIs -internal class CohostDocumentSpellCheckEndpoint( +internal sealed class CohostDocumentSpellCheckEndpoint( IRemoteServiceInvoker remoteServiceInvoker) : AbstractRazorCohostDocumentRequestHandler, IDynamicRegistrationProvider { diff --git a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs index cad02498732..79876202a35 100644 --- a/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs +++ b/src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/LanguageClient/Cohost/CohostWorkspaceSpellCheckEndpoint.cs @@ -17,7 +17,7 @@ namespace Microsoft.VisualStudio.Razor.LanguageClient.Cohost; [ExportCohostStatelessLspService(typeof(CohostWorkspaceSpellCheckEndpoint))] [method: ImportingConstructor] #pragma warning restore RS0030 // Do not use banned APIs -internal class CohostWorkspaceSpellCheckEndpoint( +internal sealed class CohostWorkspaceSpellCheckEndpoint( IRemoteServiceInvoker remoteServiceInvoker) : AbstractRazorCohostRequestHandler { From dde7fe8c2f3c2be154c631d281256cd153a0089e Mon Sep 17 00:00:00 2001 From: Jan Jones Date: Thu, 5 Sep 2024 09:28:48 +0200 Subject: [PATCH 236/271] Ensure type arguments are `global::` qualified (#10834) * Add a test * Use fully globally qualified type name * Update baselines * Fix delegates and child content * Update baselines * Fix other child content scenarios * Update baselines * Encapsulate shared code --- .../ComponentCodeGenerationTestBase.cs | 55 +++++++++---- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 8 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 6 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 10 +-- .../GenericTypeCheck/TestComponent.codegen.cs | 77 +++++++++++++++++++ .../GenericTypeCheck/TestComponent.ir.txt | 23 ++++++ .../TestComponent.mappings.txt | 35 +++++++++ .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 4 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 4 +- .../TestComponent.mappings.txt | 8 +- .../GenericTypeCheck/TestComponent.codegen.cs | 60 +++++++++++++++ .../GenericTypeCheck/TestComponent.ir.txt | 14 ++++ .../TestComponent.mappings.txt | 35 +++++++++ .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../TestComponent.codegen.cs | 2 +- .../TestComponent.mappings.txt | 2 +- .../ComponentDesignTimeNodeWriter.cs | 14 +--- .../Components/ComponentNodeWriter.cs | 30 ++++++++ .../Components/ComponentRuntimeNodeWriter.cs | 14 +--- 150 files changed, 546 insertions(+), 263 deletions(-) create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt create mode 100644 src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs index 57040aebbad..02461edf28f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/IntegrationTests/ComponentCodeGenerationTestBase.cs @@ -2336,9 +2336,9 @@ public class MyComponent : ComponentBase : [// x:\dir\subdir\Test\TestComponent.cshtml(1,27): error CS1503: Argument 1: cannot convert from 'string' to 'int' // ParentValue Diagnostic(ErrorCode.ERR_BadArgType, "ParentValue").WithArguments("1", "string", "int").WithLocation(1, 27), - // (38,158): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(2, "ValueChanged", (global::System.Action)(__value => ParentValue = __value)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 158)]); + // (38,166): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "__value").WithArguments("int", "string").WithLocation(38, 166)]); } [IntegrationTestFact] @@ -2616,18 +2616,18 @@ public class MyComponent : ComponentBase CompileToAssembly(generated, DesignTime - ? [// (31,179): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 179), - // (31,179): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 179)] - : [// (39,258): error CS0029: Cannot implicitly convert type 'int' to 'string' - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 258), - // (39,258): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type - // __builder.AddComponentParameter(3, "ValueExpression", global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); - Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 258) + ? [// (38,195): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(38, 195), + // (38,195): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type + // __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(38, 195)] + : [// (39,274): error CS0029: Cannot implicitly convert type 'int' to 'string' + // __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + Diagnostic(ErrorCode.ERR_NoImplicitConv, "ParentValue").WithArguments("int", "string").WithLocation(39, 274), + // (39,274): error CS1662: Cannot convert lambda expression to intended delegate type because some of the return types in the block are not implicitly convertible to the delegate return type + // __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + Diagnostic(ErrorCode.ERR_CantConvAnonMethReturns, "ParentValue").WithArguments("lambda expression").WithLocation(39, 274) ]); } @@ -8743,6 +8743,31 @@ public class MyComponent : ComponentBase CompileToAssembly(generated); } + [IntegrationTestFact, WorkItem("https://github.com/dotnet/razor/issues/10827")] + public void GenericTypeCheck() + { + var generated = CompileToCSharp(""" + + + @code { + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } + } + """); + + // Assert + AssertDocumentNodeMatchesBaseline(generated.CodeDocument); + AssertCSharpDocumentMatchesBaseline(generated.CodeDocument); + CompileToAssembly(generated); + } + #endregion #region Key diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs index 754429913ac..053890cdcba 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue))); - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt index a19135f3259..cffece03fbb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2197:45,19 [5] ) +Generated Location: (2213:45,19 [5] ) |Value| Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2610:63,7 [50] ) +Generated Location: (2626:63,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs index 934efc188bf..b2cdc3c52ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt index ca1dfc22c64..87644665784 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt @@ -5,19 +5,19 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1668:44,19 [5] ) +Generated Location: (1676:44,19 [5] ) |Value| Source Location: (45:0,45 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1915:53,45 [5] ) +Generated Location: (1923:53,45 [5] ) |Value| Source Location: (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2328:71,7 [50] ) +Generated Location: (2336:71,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs index a41ddb4b1f7..9f671206f3c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -33,9 +33,9 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt index 4ebc3834dd7..e53ee23626f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1860:45,19 [5] ) +Generated Location: (1884:45,19 [5] ) |Value| Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2273:63,7 [50] ) +Generated Location: (2297:63,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs index 973606f9d7c..cd9931c87d8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt index cb7d4a25221..54450e18f96 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1668:44,19 [5] ) +Generated Location: (1676:44,19 [5] ) |Value| Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2081:62,7 [50] ) +Generated Location: (2089:62,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs index da7e74a7844..f69fcc14f54 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt index bebd4144eb5..d05b1672b9a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1131:29,22 [11] ) Source Location: (15:0,15 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1656:44,15 [5] ) +Generated Location: (1664:44,15 [5] ) |Value| Source Location: (46:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2065:62,7 [50] ) +Generated Location: (2073:62,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs index 02317b1f280..be16367fc2a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt index c0b3b29ac6b..ce4b96c4231 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1127:29,18 [11] ) Source Location: (11:0,11 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1645:44,11 [5] ) +Generated Location: (1653:44,11 [5] ) |Value| Source Location: (42:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2051:62,7 [50] ) +Generated Location: (2059:62,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs index e57b3f7c0f9..d91f706f6ce 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt index d69e5ca5733..6bf8284da13 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1663:44,19 [5] ) +Generated Location: (1671:44,19 [5] ) |Value| Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2071:62,7 [50] ) +Generated Location: (2079:62,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs index 2d38b170952..a9c7f9e1c06 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt index 39e1027589c..0682636b194 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1668:44,19 [5] ) +Generated Location: (1676:44,19 [5] ) |Value| Source Location: (50:1,7 [105] x:\dir\subdir\Test\TestComponent.cshtml) @@ -14,7 +14,7 @@ Source Location: (50:1,7 [105] x:\dir\subdir\Test\TestComponent.cshtml) public string nameof(string s) => string.Empty; | -Generated Location: (2081:62,7 [105] ) +Generated Location: (2089:62,7 [105] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs index a108553352f..703599cdda4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => ParentValue = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt index a5d7ebef12a..41162759968 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1135:29,26 [11] ) Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1668:44,19 [5] ) +Generated Location: (1676:44,19 [5] ) |Value| Source Location: (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "42"; | -Generated Location: (2081:62,7 [55] ) +Generated Location: (2089:62,7 [55] ) | public string ParentValue { get; set; } = "42"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs index 325781c2132..9aa28166c36 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt index e1437b4eef4..8b70c24ba05 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] ) Source Location: (62:0,62 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Update| -Generated Location: (1559:39,62 [6] ) +Generated Location: (1567:39,62 [6] ) |Update| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1983:52,19 [5] ) +Generated Location: (1991:52,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2234:61,49 [5] ) +Generated Location: (2242:61,49 [5] ) |Value| Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) @@ -24,7 +24,7 @@ Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) public void Update() { } | -Generated Location: (2647:79,7 [82] ) +Generated Location: (2655:79,7 [82] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs index 23292cba39f..e4c3b60d71f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt index 000cad67f5f..117445020ac 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (1139:29,30 [11] ) Source Location: (62:0,62 [9] x:\dir\subdir\Test\TestComponent.cshtml) |() => { }| -Generated Location: (1559:39,62 [9] ) +Generated Location: (1567:39,62 [9] ) |() => { }| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1986:52,19 [5] ) +Generated Location: (1994:52,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2237:61,49 [5] ) +Generated Location: (2245:61,49 [5] ) |Value| Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2650:79,7 [50] ) +Generated Location: (2658:79,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs index 2ce18051e07..f3ebee2d522 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" (value => { ParentValue = value; return Task.CompletedTask; }) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt index 93db8db95c1..7f370b64088 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [62] x:\dir\subdir\Test\TestComponent.cshtml) |(value => { ParentValue = value; return Task.CompletedTask; })| -Generated Location: (1408:38,60 [62] ) +Generated Location: (1416:38,60 [62] ) |(value => { ParentValue = value; return Task.CompletedTask; })| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1884:51,19 [5] ) +Generated Location: (1892:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2135:60,49 [5] ) +Generated Location: (2143:60,49 [5] ) |Value| Source Location: (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2548:78,7 [50] ) +Generated Location: (2556:78,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs index 745ce872aa2..8c3c5acf9d3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Func( + __o = new global::System.Func( async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt index 73ef41823cd..70e32af6fed 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] ) Source Location: (62:0,62 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Update| -Generated Location: (1599:39,62 [6] ) +Generated Location: (1615:39,62 [6] ) |Update| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2023:52,19 [5] ) +Generated Location: (2039:52,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2274:61,49 [5] ) +Generated Location: (2290:61,49 [5] ) |Value| Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) @@ -24,7 +24,7 @@ Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) public Task Update() => Task.CompletedTask; | -Generated Location: (2687:79,7 [101] ) +Generated Location: (2703:79,7 [101] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs index eec3fa00333..82155238483 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Func( + __o = new global::System.Func( async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt index 269fe92e48a..e841920c43a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (1139:29,30 [11] ) Source Location: (62:0,62 [36] x:\dir\subdir\Test\TestComponent.cshtml) |() => { return Task.CompletedTask; }| -Generated Location: (1599:39,62 [36] ) +Generated Location: (1615:39,62 [36] ) |() => { return Task.CompletedTask; }| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2053:52,19 [5] ) +Generated Location: (2069:52,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2304:61,49 [5] ) +Generated Location: (2320:61,49 [5] ) |Value| Source Location: (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2717:79,7 [50] ) +Generated Location: (2733:79,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs index 41fdf220508..5e2ebb8011d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt index 1aeef332ea2..66925885b32 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1408:38,60 [11] ) +Generated Location: (1416:38,60 [11] ) |UpdateValue| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1833:51,19 [5] ) +Generated Location: (1841:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2084:60,49 [5] ) +Generated Location: (2092:60,49 [5] ) |Value| Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) @@ -24,7 +24,7 @@ Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(int value) => ParentValue = value; | -Generated Location: (2497:78,7 [116] ) +Generated Location: (2505:78,7 [116] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs index a8402349c92..074a23d6e79 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" value => ParentValue = value diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt index cc2db5348e5..d6ab56b5e6c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [28] x:\dir\subdir\Test\TestComponent.cshtml) |value => ParentValue = value| -Generated Location: (1408:38,60 [28] ) +Generated Location: (1416:38,60 [28] ) |value => ParentValue = value| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1850:51,19 [5] ) +Generated Location: (1858:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2101:60,49 [5] ) +Generated Location: (2109:60,49 [5] ) |Value| Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2514:78,7 [50] ) +Generated Location: (2522:78,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs index 41fdf220508..5e2ebb8011d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt index 1aeef332ea2..66925885b32 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1408:38,60 [11] ) +Generated Location: (1416:38,60 [11] ) |UpdateValue| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1833:51,19 [5] ) +Generated Location: (1841:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2084:60,49 [5] ) +Generated Location: (2092:60,49 [5] ) |Value| Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) @@ -24,7 +24,7 @@ Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(int value) => ParentValue = value; | -Generated Location: (2497:78,7 [116] ) +Generated Location: (2505:78,7 [116] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs index cfca3703663..aba901656da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Func( + __o = new global::System.Func( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt index b9472a3c420..df63516ed07 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt @@ -5,17 +5,17 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1435:38,60 [11] ) +Generated Location: (1451:38,60 [11] ) |UpdateValue| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1860:51,19 [5] ) +Generated Location: (1876:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2111:60,49 [5] ) +Generated Location: (2127:60,49 [5] ) |Value| Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) @@ -24,7 +24,7 @@ Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } | -Generated Location: (2524:78,7 [144] ) +Generated Location: (2540:78,7 [144] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs index 14e1416d3ee..332b6c0f6be 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Func( + __o = new global::System.Func( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" value => { ParentValue = value; return Task.CompletedTask; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt index f0d13ffcf59..5d61abde4f2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (1139:29,30 [11] ) Source Location: (60:0,60 [60] x:\dir\subdir\Test\TestComponent.cshtml) |value => { ParentValue = value; return Task.CompletedTask; }| -Generated Location: (1435:38,60 [60] ) +Generated Location: (1451:38,60 [60] ) |value => { ParentValue = value; return Task.CompletedTask; }| Source Location: (19:0,19 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1909:51,19 [5] ) +Generated Location: (1925:51,19 [5] ) |Value| Source Location: (49:0,49 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (2160:60,49 [5] ) +Generated Location: (2176:60,49 [5] ) |Value| Source Location: (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2573:78,7 [50] ) +Generated Location: (2589:78,7 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs index 61804569c7e..18c64f52827 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs @@ -33,7 +33,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ); - __o = new global::System.Action( + __o = new global::System.Action( __value => person.Name = __value); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt index 429713ee70a..0701c79b991 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (1134:29,24 [11] ) Source Location: (17:0,17 [5] x:\dir\subdir\Test\TestComponent.cshtml) |Value| -Generated Location: (1664:44,17 [5] ) +Generated Location: (1672:44,17 [5] ) |Value| Source Location: (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) | Person person = new Person(); | -Generated Location: (2069:62,1 [37] ) +Generated Location: (2077:62,1 [37] ) | Person person = new Person(); | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs index 6ca7cc208ec..c75812baa9c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs @@ -47,7 +47,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __o = new global::Microsoft.AspNetCore.Components.RenderFragment( + __o = new global::Microsoft.AspNetCore.Components.RenderFragment( #nullable restore #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" header diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt index 35479cd8831..9d8376bf370 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt @@ -15,11 +15,11 @@ Generated Location: (1492:44,87 [2] ) Source Location: (113:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) |header| -Generated Location: (1731:52,21 [6] ) +Generated Location: (1739:52,21 [6] ) |header| Source Location: (105:1,13 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Header| -Generated Location: (2145:65,13 [6] ) +Generated Location: (2153:65,13 [6] ) |Header| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs index 2c2ba993c48..32ddc0cb54d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs @@ -47,7 +47,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __o = new global::Microsoft.AspNetCore.Components.RenderFragment( + __o = new global::Microsoft.AspNetCore.Components.RenderFragment( #nullable restore #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" header diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt index 4aefa9dfb14..9b29d3d5c74 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt @@ -15,11 +15,11 @@ Generated Location: (1492:44,87 [2] ) Source Location: (113:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) |header| -Generated Location: (1731:52,21 [6] ) +Generated Location: (1739:52,21 [6] ) |header| Source Location: (105:1,13 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Header| -Generated Location: (2302:68,13 [6] ) +Generated Location: (2310:68,13 [6] ) |Header| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs index 0306bc68f6b..e070a3569c4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs @@ -24,7 +24,7 @@ private void __RazorDirectiveTokenHelpers__() { #pragma warning disable 1998 protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" Increment diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt index 55d40b8adf0..f37d2698599 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt @@ -1,11 +1,11 @@ Source Location: (23:0,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) |Increment| -Generated Location: (1072:29,23 [9] ) +Generated Location: (1080:29,23 [9] ) |Increment| Source Location: (13:0,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (1489:42,13 [7] ) +Generated Location: (1497:42,13 [7] ) |OnClick| Source Location: (46:2,7 [98] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (46:2,7 [98] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1904:60,7 [98] ) +Generated Location: (1912:60,7 [98] ) | private int counter; private void Increment(EventArgs e) { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs index 4d2d180e5dd..84c02a181fb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs @@ -24,7 +24,7 @@ private void __RazorDirectiveTokenHelpers__() { #pragma warning disable 1998 protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" __o = context; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt index 20d19f9d441..c8b71a120d6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt @@ -1,5 +1,5 @@ Source Location: (28:0,28 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (1172:29,28 [7] ) +Generated Location: (1180:29,28 [7] ) |context| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs index 862bf02ba3c..078564652c8 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs @@ -25,7 +25,7 @@ private void __RazorDirectiveTokenHelpers__() { protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __o = ""; - __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" __o = context.ToLowerInvariant(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt index 80c0b6cf09f..a20c4a1227e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt @@ -1,10 +1,10 @@ Source Location: (54:0,54 [26] x:\dir\subdir\Test\TestComponent.cshtml) |context.ToLowerInvariant()| -Generated Location: (1221:30,54 [26] ) +Generated Location: (1229:30,54 [26] ) |context.ToLowerInvariant()| Source Location: (13:0,13 [6] x:\dir\subdir\Test\TestComponent.cshtml) |MyAttr| -Generated Location: (1509:41,13 [6] ) +Generated Location: (1517:41,13 [6] ) |MyAttr| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs index dba90ed5046..4a9f66ac457 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs @@ -25,7 +25,7 @@ private void __RazorDirectiveTokenHelpers__() { protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __o = ""; - __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { #nullable restore #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" __o = item.ToLowerInvariant(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt index 23b94d39bdd..507f9be45a0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt @@ -1,10 +1,10 @@ Source Location: (93:2,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) |item.ToLowerInvariant()| -Generated Location: (1196:30,32 [23] ) +Generated Location: (1204:30,32 [23] ) |item.ToLowerInvariant()| Source Location: (13:0,13 [6] x:\dir\subdir\Test\TestComponent.cshtml) |MyAttr| -Generated Location: (1481:41,13 [6] ) +Generated Location: (1489:41,13 [6] ) |MyAttr| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs index dba90ed5046..4a9f66ac457 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs @@ -25,7 +25,7 @@ private void __RazorDirectiveTokenHelpers__() { protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __o = ""; - __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { #nullable restore #line 3 "x:\dir\subdir\Test\TestComponent.cshtml" __o = item.ToLowerInvariant(); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt index 23b94d39bdd..507f9be45a0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt @@ -1,10 +1,10 @@ Source Location: (93:2,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) |item.ToLowerInvariant()| -Generated Location: (1196:30,32 [23] ) +Generated Location: (1204:30,32 [23] ) |item.ToLowerInvariant()| Source Location: (13:0,13 [6] x:\dir\subdir\Test\TestComponent.cshtml) |MyAttr| -Generated Location: (1481:41,13 [6] ) +Generated Location: (1489:41,13 [6] ) |MyAttr| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs index 77d4de4e322..1aecfc18a60 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs @@ -24,7 +24,7 @@ private void __RazorDirectiveTokenHelpers__() { #pragma warning disable 1998 protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __o = new global::System.Action( + __o = new global::System.Action( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" e => { Increment(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt index 69d76657c42..5897aed0e5e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt @@ -1,11 +1,11 @@ Source Location: (24:0,24 [21] x:\dir\subdir\Test\TestComponent.cshtml) |e => { Increment(); }| -Generated Location: (1073:29,24 [21] ) +Generated Location: (1081:29,24 [21] ) |e => { Increment(); }| Source Location: (13:0,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |OnClick| -Generated Location: (1502:42,13 [7] ) +Generated Location: (1510:42,13 [7] ) |OnClick| Source Location: (60:2,7 [87] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (60:2,7 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1917:60,7 [87] ) +Generated Location: (1925:60,7 [87] ) | private int counter; private void Increment() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs index f4de066d325..c00a412ae32 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs @@ -39,7 +39,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __builder.AddAttribute(-1, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(-1, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { #nullable restore #line 7 "x:\dir\subdir\Test\TestComponent.cshtml" __o = context; @@ -66,7 +66,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __builder.AddAttribute(-1, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(-1, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { #nullable restore #line 13 "x:\dir\subdir\Test\TestComponent.cshtml" __o = context; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt index 5f67098fac7..1e8ef43ff5f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt @@ -5,11 +5,11 @@ Generated Location: (361:12,0 [17] ) Source Location: (119:6,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (1578:44,13 [7] ) +Generated Location: (1586:44,13 [7] ) |context| Source Location: (276:12,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (2403:71,13 [7] ) +Generated Location: (2419:71,13 [7] ) |context| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs index 7b01bafbaaf..a81862f7e64 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs @@ -24,7 +24,7 @@ private void __RazorDirectiveTokenHelpers__() { #pragma warning disable 1998 protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<(System.Int32 Horizontal, System.Int32 Vertical)>( + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<(global::System.Int32 Horizontal, global::System.Int32 Vertical)>( #nullable restore #line 5 "x:\dir\subdir\Test\TestComponent.cshtml" (32, 16) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt index 21f5c103e9a..ee7c896015e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt @@ -1,18 +1,18 @@ Source Location: (113:4,23 [8] x:\dir\subdir\Test\TestComponent.cshtml) |(32, 16)| -Generated Location: (1160:29,23 [8] ) +Generated Location: (1176:29,23 [8] ) |(32, 16)| Source Location: (105:4,15 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Gutter| -Generated Location: (1580:42,15 [6] ) +Generated Location: (1596:42,15 [6] ) |Gutter| Source Location: (7:0,7 [78] x:\dir\subdir\Test\TestComponent.cshtml) | [Parameter] public (int Horizontal, int Vertical) Gutter { get; set; } | -Generated Location: (1996:60,7 [78] ) +Generated Location: (2012:60,7 [78] ) | [Parameter] public (int Horizontal, int Vertical) Gutter { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs index fde39def4b8..dfa9acb1c26 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs @@ -44,7 +44,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message))); - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt index d91e91607f7..043705cd50f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt @@ -10,19 +10,19 @@ Generated Location: (1451:38,48 [7] ) Source Location: (13:0,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Message| -Generated Location: (2496:54,13 [7] ) +Generated Location: (2512:54,13 [7] ) |Message| Source Location: (38:0,38 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Message| -Generated Location: (2738:63,38 [7] ) +Generated Location: (2754:63,38 [7] ) |Message| Source Location: (73:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (3158:81,12 [30] ) +Generated Location: (3174:81,12 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs index b5e8ba75d76..83ce025ea6b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs @@ -44,7 +44,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message))); - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt index 50654ea80a7..3d027651884 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt @@ -10,19 +10,19 @@ Generated Location: (1626:38,59 [7] ) Source Location: (13:0,13 [14] x:\dir\subdir\Test\TestComponent.cshtml) |MessageChanged| -Generated Location: (2671:54,13 [14] ) +Generated Location: (2687:54,13 [14] ) |MessageChanged| Source Location: (49:0,49 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Message| -Generated Location: (2931:63,49 [7] ) +Generated Location: (2947:63,49 [7] ) |Message| Source Location: (84:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (3351:81,12 [30] ) +Generated Location: (3367:81,12 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs index 31b29f813e0..0970d172be9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs @@ -24,7 +24,7 @@ private void __RazorDirectiveTokenHelpers__() { #pragma warning disable 1998 protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>( + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>( #nullable restore #line 1 "x:\dir\subdir\Test\TestComponent.cshtml" (s) => {} @@ -44,7 +44,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. ); __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message))); - __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message); __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { } )); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt index ebf495502cf..14dc7e7f95d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt @@ -1,28 +1,28 @@ Source Location: (59:0,59 [9] x:\dir\subdir\Test\TestComponent.cshtml) |(s) => {}| -Generated Location: (1220:29,59 [9] ) +Generated Location: (1236:29,59 [9] ) |(s) => {}| Source Location: (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml) |message| -Generated Location: (1521:38,29 [7] ) +Generated Location: (1537:38,29 [7] ) |message| Source Location: (38:0,38 [17] x:\dir\subdir\Test\TestComponent.cshtml) |MessageExpression| -Generated Location: (2591:54,38 [17] ) +Generated Location: (2623:54,38 [17] ) |MessageExpression| Source Location: (19:0,19 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Message| -Generated Location: (2824:63,19 [7] ) +Generated Location: (2856:63,19 [7] ) |Message| Source Location: (87:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (3244:81,12 [30] ) +Generated Location: (3276:81,12 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs new file mode 100644 index 00000000000..87cac7cbb5d --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs @@ -0,0 +1,77 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 219 + private void __RazorDirectiveTokenHelpers__() { + } + #pragma warning restore 219 + #pragma warning disable 0414 + private static object __o = null; + #pragma warning restore 0414 + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __o = global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>( +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + null + +#line default +#line hidden +#nullable disable + ); + __builder.AddAttribute(-1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((__builder2) => { + } + )); + #pragma warning disable BL0005 + ((global::Test.TestComponent)default). +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" + Data + +#line default +#line hidden +#nullable disable + = default; + #pragma warning restore BL0005 +#nullable restore +#line 1 "x:\dir\subdir\Test\TestComponent.cshtml" +__o = typeof(global::Test.TestComponent); + +#line default +#line hidden +#nullable disable + } + #pragma warning restore 1998 +#nullable restore +#line 3 "x:\dir\subdir\Test\TestComponent.cshtml" + + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } + +#line default +#line hidden +#nullable disable + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt new file mode 100644 index 00000000000..a2e3283c0d3 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt @@ -0,0 +1,23 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [20] ) - global::System + UsingDirective - (26:2,1 [40] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [25] ) - global::System.Linq + UsingDirective - (97:4,1 [36] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [45] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + DesignTimeDirective - + CSharpCode - + IntermediateToken - - CSharp - #pragma warning disable 0414 + CSharpCode - + IntermediateToken - - CSharp - private static object __o = null; + CSharpCode - + IntermediateToken - - CSharp - #pragma warning restore 0414 + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [29] x:\dir\subdir\Test\TestComponent.cshtml) - TestComponent + ComponentAttribute - (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Data - Data - AttributeStructure.DoubleQuotes + LazyIntermediateToken - (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - null + HtmlContent - (29:0,29 [4] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (29:0,29 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Html - \n\n + CSharpCode - (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private class System\n {\n private class String\n {\n }\n }\n\n [Parameter]\n public List Data { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt new file mode 100644 index 00000000000..43f60bdfe93 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt @@ -0,0 +1,35 @@ +Source Location: (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) +|null| +Generated Location: (1172:29,21 [4] ) +|null| + +Source Location: (15:0,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) +|Data| +Generated Location: (1588:42,15 [4] ) +|Data| + +Source Location: (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) +| + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } +| +Generated Location: (2002:60,7 [172] ) +| + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs index 204c0b85da8..ff5688f4246 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs @@ -54,7 +54,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __o = new global::Microsoft.AspNetCore.Components.RenderFragment( + __o = new global::Microsoft.AspNetCore.Components.RenderFragment( #nullable restore #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" template diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt index 7fc1225c648..394dea96db0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt @@ -20,11 +20,11 @@ Generated Location: (1740:51,107 [2] ) Source Location: (136:1,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) |template| -Generated Location: (1981:59,24 [8] ) +Generated Location: (1989:59,24 [8] ) |template| Source Location: (125:1,13 [8] x:\dir\subdir\Test\TestComponent.cshtml) |Template| -Generated Location: (2397:72,13 [8] ) +Generated Location: (2405:72,13 [8] ) |Template| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs index 3cc96f544ba..c1b4786f9bb 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs @@ -47,7 +47,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - __o = new global::Microsoft.AspNetCore.Components.RenderFragment( + __o = new global::Microsoft.AspNetCore.Components.RenderFragment( #nullable restore #line 2 "x:\dir\subdir\Test\TestComponent.cshtml" template diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt index 8b670765ac0..ddf3533e923 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentDesignTimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt @@ -15,11 +15,11 @@ Generated Location: (1465:44,73 [2] ) Source Location: (108:1,30 [8] x:\dir\subdir\Test\TestComponent.cshtml) |template| -Generated Location: (1711:52,30 [8] ) +Generated Location: (1719:52,30 [8] ) |template| Source Location: (91:1,13 [14] x:\dir\subdir\Test\TestComponent.cshtml) |PersonTemplate| -Generated Location: (2127:65,13 [14] ) +Generated Location: (2135:65,13 [14] ) |PersonTemplate| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs index abd3ceb0635..b46ee79b0fe 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -36,7 +36,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable )); __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => ParentValue = __value, ParentValue)))); - __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt index 6a68a34f37a..f02bfe1b54a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_EventCallback_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (2174:44,0 [50] ) +Generated Location: (2190:44,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs index 6c85c6edbb8..d901af09592 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.OnChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.OnChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt index 7f3dc1ced28..43bc0751867 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndChangeEvent_WithMatchingProperties/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (80:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1560:43,0 [50] ) +Generated Location: (1568:43,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs index 3167bd4ea2d..2e70a69ed5b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.codegen.cs @@ -35,8 +35,8 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); - __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.ValueExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => ParentValue)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt index 01f8dac4026..e8d4440ec8e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValueAndExpression/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1835:44,0 [50] ) +Generated Location: (1859:44,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs index e36578b746f..3f10ecd4ea1 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt index d192ffede1f..3a94fce9997 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1563:43,0 [50] ) +Generated Location: (1571:43,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs index df3153b6eaf..bdf2d365142 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.dynamic.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.dynamic.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt index dbef272501e..0d5fcc2cce4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_DynamicComponentName/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (46:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1551:43,0 [50] ) +Generated Location: (1559:43,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs index 983865f9dd9..94bebec1e54 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.@int.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.@int.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt index 776acdd1ae4..ff86df204f7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_EscapedComponentName/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (42:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1542:43,0 [50] ) +Generated Location: (1550:43,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs index d8baebfd6df..aa9e2409461 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt index 1e7397b4f77..b2dabfd1ac9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_GlobalNamespaceComponent/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (50:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1548:43,0 [50] ) +Generated Location: (1556:43,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs index 2748c8c3cfe..de4d84d6495 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt index 022089c5023..7daa1a95a55 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_SpecifiesValue_WithMatchingProperties_WithNameof/TestComponent.mappings.txt @@ -14,7 +14,7 @@ Source Location: (50:1,7 [105] x:\dir\subdir\Test\TestComponent.cshtml) public string nameof(string s) => string.Empty; | -Generated Location: (1563:43,0 [105] ) +Generated Location: (1571:43,0 [105] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs index cade82dcb2c..ceb8519409b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)(__value => ParentValue = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt index 01a2b30ddea..6391db2862a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_TypeChecked_WithMatchingProperties/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (50:1,7 [55] x:\dir\subdir\Test\TestComponent.cshtml) | public string ParentValue { get; set; } = "42"; | -Generated Location: (1563:43,0 [55] ) +Generated Location: (1571:43,0 [55] ) | public string ParentValue { get; set; } = "42"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs index e7f7c74e2fe..1f8135dd3dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( #nullable restore #line (1,63)-(1,69) "x:\dir\subdir\Test\TestComponent.cshtml" Update diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt index 52094507c13..810b5101f39 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_Action/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Generated Location: (1144:31,0 [11] ) Source Location: (62:0,62 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Update| -Generated Location: (1575:40,0 [6] ) +Generated Location: (1583:40,0 [6] ) |Update| Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) @@ -19,7 +19,7 @@ Source Location: (81:1,7 [82] x:\dir\subdir\Test\TestComponent.cshtml) public void Update() { } | -Generated Location: (1824:51,0 [82] ) +Generated Location: (1832:51,0 [82] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs index 5f96b9aa07a..f386b9d2740 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( __value => { ParentValue = __value; global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeSynchronousDelegate( #nullable restore #line (1,63)-(1,72) "x:\dir\subdir\Test\TestComponent.cshtml" () => { } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt index 7f2679c6167..8240e570289 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_ActionLambda/TestComponent.mappings.txt @@ -10,14 +10,14 @@ Generated Location: (1144:31,0 [11] ) Source Location: (62:0,62 [9] x:\dir\subdir\Test\TestComponent.cshtml) |() => { }| -Generated Location: (1575:40,0 [9] ) +Generated Location: (1583:40,0 [9] ) |() => { }| Source Location: (84:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1827:51,0 [50] ) +Generated Location: (1835:51,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs index a673f7ff341..1bf6800bda0 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( #nullable restore #line (1,61)-(1,123) "x:\dir\subdir\Test\TestComponent.cshtml" (value => { ParentValue = value; return Task.CompletedTask; }) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt index f8a444575ca..586a029c535 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_AsyncLambdaProducesError/TestComponent.mappings.txt @@ -10,14 +10,14 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [62] x:\dir\subdir\Test\TestComponent.cshtml) |(value => { ParentValue = value; return Task.CompletedTask; })| -Generated Location: (1441:40,0 [62] ) +Generated Location: (1449:40,0 [62] ) |(value => { ParentValue = value; return Task.CompletedTask; })| Source Location: (135:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1742:51,0 [50] ) +Generated Location: (1750:51,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs index f3e042efa30..bb422b76863 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( #nullable restore #line (1,63)-(1,69) "x:\dir\subdir\Test\TestComponent.cshtml" Update diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt index 196efd4fa84..4b6ab91b9d3 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningDelegate/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Generated Location: (1144:31,0 [11] ) Source Location: (62:0,62 [6] x:\dir\subdir\Test\TestComponent.cshtml) |Update| -Generated Location: (1615:40,0 [6] ) +Generated Location: (1631:40,0 [6] ) |Update| Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) @@ -19,7 +19,7 @@ Source Location: (81:1,7 [101] x:\dir\subdir\Test\TestComponent.cshtml) public Task Update() => Task.CompletedTask; | -Generated Location: (1864:51,0 [101] ) +Generated Location: (1880:51,0 [101] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs index 49e65646f4e..c925f792b53 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)(async __value => { ParentValue = __value; await global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.InvokeAsynchronousDelegate( #nullable restore #line (1,63)-(1,99) "x:\dir\subdir\Test\TestComponent.cshtml" () => { return Task.CompletedTask; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt index 7a0348f8e2d..24f207033e2 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithAfter_TaskReturningLambda/TestComponent.mappings.txt @@ -10,14 +10,14 @@ Generated Location: (1144:31,0 [11] ) Source Location: (62:0,62 [36] x:\dir\subdir\Test\TestComponent.cshtml) |() => { return Task.CompletedTask; }| -Generated Location: (1615:40,0 [36] ) +Generated Location: (1631:40,0 [36] ) |() => { return Task.CompletedTask; }| Source Location: (111:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1894:51,0 [50] ) +Generated Location: (1910:51,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs index bfb36b475d7..6e26b464c7b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( #nullable restore #line (1,61)-(1,72) "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt index 94d87a1d84d..a04298cae65 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_Action/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1440:40,0 [11] ) +Generated Location: (1448:40,0 [11] ) |UpdateValue| Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) @@ -19,7 +19,7 @@ Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(int value) => ParentValue = value; | -Generated Location: (1690:51,0 [116] ) +Generated Location: (1698:51,0 [116] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs index 21f622ba370..96ff2c3df0f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Action)( #nullable restore #line (1,61)-(1,89) "x:\dir\subdir\Test\TestComponent.cshtml" value => ParentValue = value diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt index dfbb63429bc..4240393425d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ActionLambda/TestComponent.mappings.txt @@ -10,14 +10,14 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [28] x:\dir\subdir\Test\TestComponent.cshtml) |value => ParentValue = value| -Generated Location: (1440:40,0 [28] ) +Generated Location: (1448:40,0 [28] ) |value => ParentValue = value| Source Location: (101:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1707:51,0 [50] ) +Generated Location: (1715:51,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs index 361d55a95a8..0edba25ee85 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ))); - __builder.AddAttribute(2, nameof(global::Test.MyComponent.ValueChanged), (object)((global::System.Action)( + __builder.AddAttribute(2, nameof(global::Test.MyComponent.ValueChanged), (object)((global::System.Action)( #nullable restore #line (1,61)-(1,72) "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt index 0e4155e0284..cf93f168453 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_ProducesErrorOnOlderLanguageVersions/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1441:40,0 [11] ) +Generated Location: (1449:40,0 [11] ) |UpdateValue| Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) @@ -19,7 +19,7 @@ Source Location: (84:1,7 [116] x:\dir\subdir\Test\TestComponent.cshtml) public void UpdateValue(int value) => ParentValue = value; | -Generated Location: (1692:51,0 [116] ) +Generated Location: (1700:51,0 [116] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs index a43e5220dc5..3d8becd8513 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( #nullable restore #line (1,61)-(1,72) "x:\dir\subdir\Test\TestComponent.cshtml" UpdateValue diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt index e2045b99fdd..1d2d804a1b9 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningDelegate/TestComponent.mappings.txt @@ -10,7 +10,7 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [11] x:\dir\subdir\Test\TestComponent.cshtml) |UpdateValue| -Generated Location: (1467:40,0 [11] ) +Generated Location: (1483:40,0 [11] ) |UpdateValue| Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) @@ -19,7 +19,7 @@ Source Location: (84:1,7 [144] x:\dir\subdir\Test\TestComponent.cshtml) public Task UpdateValue(int value) { ParentValue = value; return Task.CompletedTask; } | -Generated Location: (1717:51,0 [144] ) +Generated Location: (1733:51,0 [144] ) | public int ParentValue { get; set; } = 42; diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs index 358e53a3b9a..47034cd4373 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( + __builder.AddComponentParameter(2, nameof(global::Test.MyComponent.ValueChanged), (global::System.Func)( #nullable restore #line (1,61)-(1,121) "x:\dir\subdir\Test\TestComponent.cshtml" value => { ParentValue = value; return Task.CompletedTask; } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt index 70a99a8556f..15ba3e4b8a4 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithGetSet_TaskReturningLambda/TestComponent.mappings.txt @@ -10,14 +10,14 @@ Generated Location: (1144:31,0 [11] ) Source Location: (60:0,60 [60] x:\dir\subdir\Test\TestComponent.cshtml) |value => { ParentValue = value; return Task.CompletedTask; }| -Generated Location: (1468:40,0 [60] ) +Generated Location: (1484:40,0 [60] ) |value => { ParentValue = value; return Task.CompletedTask; }| Source Location: (133:1,7 [50] x:\dir\subdir\Test\TestComponent.cshtml) | public int ParentValue { get; set; } = 42; | -Generated Location: (1767:51,0 [50] ) +Generated Location: (1783:51,0 [50] ) | public int ParentValue { get; set; } = 42; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs index c72983ec8e4..9d8396d5234 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.codegen.cs @@ -35,7 +35,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable )); - __builder.AddComponentParameter(2, nameof(global::Test.InputText.ValueChanged), (global::System.Action)(__value => person.Name = __value)); + __builder.AddComponentParameter(2, nameof(global::Test.InputText.ValueChanged), (global::System.Action)(__value => person.Name = __value)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt index 3db547b9f8f..24815817773 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BindToComponent_WithStringAttribute_DoesNotUseStringSyntax/TestComponent.mappings.txt @@ -12,7 +12,7 @@ Source Location: (56:3,1 [37] x:\dir\subdir\Test\TestComponent.cshtml) | Person person = new Person(); | -Generated Location: (1559:43,0 [37] ) +Generated Location: (1567:43,0 [37] ) | Person person = new Person(); | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs index d79cfac0416..41c76497504 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.codegen.cs @@ -55,7 +55,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::Microsoft.AspNetCore.Components.RenderFragment)( + ), (global::Microsoft.AspNetCore.Components.RenderFragment)( #nullable restore #line (2,22)-(2,28) "x:\dir\subdir\Test\TestComponent.cshtml" header diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt index 21b82df25e8..6f6fcfe1b87 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndAttributeChildContent/TestComponent.mappings.txt @@ -20,6 +20,6 @@ Generated Location: (1567:52,0 [6] ) Source Location: (113:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) |header| -Generated Location: (1796:60,0 [6] ) +Generated Location: (1804:60,0 [6] ) |header| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs index 2a4aab4d08f..ccb3b82a12e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.codegen.cs @@ -55,7 +55,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::Microsoft.AspNetCore.Components.RenderFragment)( + ), (global::Microsoft.AspNetCore.Components.RenderFragment)( #nullable restore #line (2,22)-(2,28) "x:\dir\subdir\Test\TestComponent.cshtml" header diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt index 21b82df25e8..6f6fcfe1b87 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/BodyAndExplicitChildContent/TestComponent.mappings.txt @@ -20,6 +20,6 @@ Generated Location: (1567:52,0 [6] ) Source Location: (113:1,21 [6] x:\dir\subdir\Test\TestComponent.cshtml) |header| -Generated Location: (1796:60,0 [6] ) +Generated Location: (1804:60,0 [6] ) |header| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs index 7d5ef13cd70..dde5917e7ee 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.codegen.cs @@ -26,7 +26,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::System.Action)( + ), (global::System.Action)( #nullable restore #line (1,24)-(1,33) "x:\dir\subdir\Test\TestComponent.cshtml" Increment diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt index 0cf47482c50..94c96b14b11 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitEventHandler/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Generated Location: (884:23,0 [7] ) Source Location: (23:0,23 [9] x:\dir\subdir\Test\TestComponent.cshtml) |Increment| -Generated Location: (1084:31,0 [9] ) +Generated Location: (1092:31,0 [9] ) |Increment| Source Location: (46:2,7 [98] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (46:2,7 [98] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1332:42,0 [98] ) +Generated Location: (1340:42,0 [98] ) | private int counter; private void Increment(EventArgs e) { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs index b36feb64fc2..eb8ecdc2c31 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.codegen.cs @@ -18,7 +18,7 @@ public partial class TestComponent : global::Microsoft.AspNetCore.Components.Com protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) { __builder.OpenComponent(0); - __builder.AddAttribute(1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(1, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { __builder2.AddContent(2, #nullable restore #line (1,29)-(1,36) "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt index ef18bd95183..4324daa4efc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithExplicitGenericChildContent/TestComponent.mappings.txt @@ -1,5 +1,5 @@ Source Location: (28:0,28 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (1004:24,0 [7] ) +Generated Location: (1012:24,0 [7] ) |context| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs index e5f348b8403..9d7566ec435 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.codegen.cs @@ -27,7 +27,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ), "abc"); - __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { __builder2.AddContent(3, "Some text"); __builder2.OpenElement(4, "some-child"); __builder2.AddAttribute(5, "a", "1"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt index 50912aabae5..37d668a476a 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (884:23,0 [6] ) Source Location: (54:0,54 [26] x:\dir\subdir\Test\TestComponent.cshtml) |context.ToLowerInvariant()| -Generated Location: (1418:36,0 [26] ) +Generated Location: (1426:36,0 [26] ) |context.ToLowerInvariant()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs index 44ea67ef970..32b57b02572 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.codegen.cs @@ -27,7 +27,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ), "abc"); - __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { + __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { __builder2.AddMarkupContent(3, "\r\n Some text"); __builder2.OpenElement(4, "some-child"); __builder2.AddAttribute(5, "a", "1"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt index 776d0225c13..7a4d7657a6d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterName/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (884:23,0 [6] ) Source Location: (93:2,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) |item.ToLowerInvariant()| -Generated Location: (1429:36,0 [23] ) +Generated Location: (1437:36,0 [23] ) |item.ToLowerInvariant()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs index 44ea67ef970..32b57b02572 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.codegen.cs @@ -27,7 +27,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line hidden #nullable disable ), "abc"); - __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { + __builder.AddAttribute(2, "ChildContent", (global::Microsoft.AspNetCore.Components.RenderFragment)((item) => (__builder2) => { __builder2.AddMarkupContent(3, "\r\n Some text"); __builder2.OpenElement(4, "some-child"); __builder2.AddAttribute(5, "a", "1"); diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt index 776d0225c13..7a4d7657a6d 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithGenericChildContent_SetsParameterNameOnComponent/TestComponent.mappings.txt @@ -5,6 +5,6 @@ Generated Location: (884:23,0 [6] ) Source Location: (93:2,32 [23] x:\dir\subdir\Test\TestComponent.cshtml) |item.ToLowerInvariant()| -Generated Location: (1429:36,0 [23] ) +Generated Location: (1437:36,0 [23] ) |item.ToLowerInvariant()| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs index 4877f647ddb..9d3de935495 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.codegen.cs @@ -26,7 +26,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::System.Action)( + ), (global::System.Action)( #nullable restore #line (1,25)-(1,46) "x:\dir\subdir\Test\TestComponent.cshtml" e => { Increment(); } diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt index e26ef4a8636..9e81c5f14dc 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildComponent_WithLambdaEventHandler/TestComponent.mappings.txt @@ -5,7 +5,7 @@ Generated Location: (884:23,0 [7] ) Source Location: (24:0,24 [21] x:\dir\subdir\Test\TestComponent.cshtml) |e => { Increment(); }| -Generated Location: (1084:31,0 [21] ) +Generated Location: (1092:31,0 [21] ) |e => { Increment(); }| Source Location: (60:2,7 [87] x:\dir\subdir\Test\TestComponent.cshtml) @@ -15,7 +15,7 @@ Source Location: (60:2,7 [87] x:\dir\subdir\Test\TestComponent.cshtml) counter++; } | -Generated Location: (1344:42,0 [87] ) +Generated Location: (1352:42,0 [87] ) | private int counter; private void Increment() { diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs index f38948c9970..0fa8152e78e 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.codegen.cs @@ -31,7 +31,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. __builder.CloseComponent(); __builder.AddMarkupContent(3, "\r\n"); __builder.OpenComponent(4); - __builder.AddAttribute(5, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(5, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { __builder2.AddContent(6, #nullable restore #line (7,14)-(7,21) "x:\dir\subdir\Test\TestComponent.cshtml" @@ -53,7 +53,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. __builder.CloseComponent(); __builder.AddMarkupContent(11, "\r\n"); __builder.OpenComponent(12); - __builder.AddAttribute(13, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { + __builder.AddAttribute(13, "Footer", (global::Microsoft.AspNetCore.Components.RenderFragment)((context) => (__builder2) => { __builder2.AddContent(14, #nullable restore #line (13,14)-(13,21) "x:\dir\subdir\Test\TestComponent.cshtml" diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt index 731c3314644..9ce8d189e21 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ChildContent_FromAnotherNamespace/TestComponent.mappings.txt @@ -7,11 +7,11 @@ Generated Location: (371:12,0 [19] ) Source Location: (119:6,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (1500:37,0 [7] ) +Generated Location: (1508:37,0 [7] ) |context| Source Location: (276:12,13 [7] x:\dir\subdir\Test\TestComponent.cshtml) |context| -Generated Location: (2438:59,0 [7] ) +Generated Location: (2454:59,0 [7] ) |context| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs index 49c1f8db49d..6eaef762d1c 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.codegen.cs @@ -26,7 +26,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<(System.Int32 Horizontal, System.Int32 Vertical)>( + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck<(global::System.Int32 Horizontal, global::System.Int32 Vertical)>( #nullable restore #line (5,24)-(5,32) "x:\dir\subdir\Test\TestComponent.cshtml" (32, 16) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt index b75023acb7c..e1507a1b339 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/ComponentWithTupleParameter/TestComponent.mappings.txt @@ -5,14 +5,14 @@ Generated Location: (888:23,0 [6] ) Source Location: (113:4,23 [8] x:\dir\subdir\Test\TestComponent.cshtml) |(32, 16)| -Generated Location: (1177:31,0 [8] ) +Generated Location: (1193:31,0 [8] ) |(32, 16)| Source Location: (7:0,7 [78] x:\dir\subdir\Test\TestComponent.cshtml) | [Parameter] public (int Horizontal, int Vertical) Gutter { get; set; } | -Generated Location: (1424:42,0 [78] ) +Generated Location: (1440:42,0 [78] ) | [Parameter] public (int Horizontal, int Vertical) Gutter { get; set; } | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs index 912e12b4529..d92a7cd12b6 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.codegen.cs @@ -53,7 +53,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable )); __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.MessageChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message)))); - __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); + __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt index 0b6febc8b85..d1ca801dd40 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessage/TestComponent.mappings.txt @@ -22,7 +22,7 @@ Source Location: (73:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (2673:61,0 [30] ) +Generated Location: (2689:61,0 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs index 66d476bcf1b..2b1d46948bf 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.codegen.cs @@ -53,7 +53,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable )); __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.MessageChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message)))); - __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); + __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt index 924aed3be4a..3fb5998d483 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageChanged/TestComponent.mappings.txt @@ -22,7 +22,7 @@ Source Location: (84:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (2836:61,0 [30] ) +Generated Location: (2852:61,0 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs index 2e4a9d50315..de3f01d6ce7 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.codegen.cs @@ -26,7 +26,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>( + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>( #nullable restore #line (1,60)-(1,69) "x:\dir\subdir\Test\TestComponent.cshtml" (s) => {} @@ -53,7 +53,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #nullable disable )); __builder.AddComponentParameter(3, nameof(global::Test.MyComponent.MessageChanged), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>(global::Microsoft.AspNetCore.Components.EventCallback.Factory.Create(this, global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.CreateInferredEventCallback(this, __value => message = __value, message)))); - __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); + __builder.AddComponentParameter(4, nameof(global::Test.MyComponent.MessageExpression), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>>(() => message)); __builder.CloseComponent(); } #pragma warning restore 1998 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt index 16fac7b9e88..5587b5952ad 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/DuplicateComponentParameters_IsAnError_BindMessageExpression/TestComponent.mappings.txt @@ -5,24 +5,24 @@ Generated Location: (884:23,0 [17] ) Source Location: (59:0,59 [9] x:\dir\subdir\Test\TestComponent.cshtml) |(s) => {}| -Generated Location: (1208:31,0 [9] ) +Generated Location: (1224:31,0 [9] ) |(s) => {}| Source Location: (19:0,19 [7] x:\dir\subdir\Test\TestComponent.cshtml) |Message| -Generated Location: (1449:40,0 [7] ) +Generated Location: (1465:40,0 [7] ) |Message| Source Location: (29:0,29 [7] x:\dir\subdir\Test\TestComponent.cshtml) |message| -Generated Location: (1712:48,0 [7] ) +Generated Location: (1728:48,0 [7] ) |message| Source Location: (87:1,12 [30] x:\dir\subdir\Test\TestComponent.cshtml) | string message = "hi"; | -Generated Location: (2736:61,0 [30] ) +Generated Location: (2768:61,0 [30] ) | string message = "hi"; | diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs new file mode 100644 index 00000000000..bb2b60e9920 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.codegen.cs @@ -0,0 +1,60 @@ +// +#pragma warning disable 1591 +namespace Test +{ + #line default + using global::System; + using global::System.Collections.Generic; + using global::System.Linq; + using global::System.Threading.Tasks; + using global::Microsoft.AspNetCore.Components; + #line default + #line hidden + #nullable restore + public partial class TestComponent : global::Microsoft.AspNetCore.Components.ComponentBase + #nullable disable + { + #pragma warning disable 1998 + protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components.Rendering.RenderTreeBuilder __builder) + { + __builder.OpenComponent(0); + __builder.AddComponentParameter(1, nameof(global::Test.TestComponent. +#nullable restore +#line (1,16)-(1,20) "x:\dir\subdir\Test\TestComponent.cshtml" +Data + +#line default +#line hidden +#nullable disable + ), global::Microsoft.AspNetCore.Components.CompilerServices.RuntimeHelpers.TypeCheck>( +#nullable restore +#line (1,22)-(1,26) "x:\dir\subdir\Test\TestComponent.cshtml" +null + +#line default +#line hidden +#nullable disable + )); + __builder.CloseComponent(); + } + #pragma warning restore 1998 +#nullable restore +#line (3,8)-(13,1) "x:\dir\subdir\Test\TestComponent.cshtml" + + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } + +#line default +#line hidden +#nullable disable + + } +} +#pragma warning restore 1591 diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt new file mode 100644 index 00000000000..e3d0d35fdb7 --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.ir.txt @@ -0,0 +1,14 @@ +Document - + NamespaceDeclaration - - Test + UsingDirective - (3:1,1 [22] ) - global::System + UsingDirective - (26:2,1 [42] ) - global::System.Collections.Generic + UsingDirective - (69:3,1 [27] ) - global::System.Linq + UsingDirective - (97:4,1 [38] ) - global::System.Threading.Tasks + UsingDirective - (136:5,1 [47] ) - global::Microsoft.AspNetCore.Components + ClassDeclaration - - public partial - TestComponent - global::Microsoft.AspNetCore.Components.ComponentBase - + MethodDeclaration - - protected override - void - BuildRenderTree + Component - (0:0,0 [29] x:\dir\subdir\Test\TestComponent.cshtml) - TestComponent + ComponentAttribute - (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) - Data - Data - AttributeStructure.DoubleQuotes + LazyIntermediateToken - (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - null + CSharpCode - (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) + LazyIntermediateToken - (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) - CSharp - \n private class System\n {\n private class String\n {\n }\n }\n\n [Parameter]\n public List Data { get; set; }\n diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt new file mode 100644 index 00000000000..419d824f7ea --- /dev/null +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/GenericTypeCheck/TestComponent.mappings.txt @@ -0,0 +1,35 @@ +Source Location: (15:0,15 [4] x:\dir\subdir\Test\TestComponent.cshtml) +|Data| +Generated Location: (888:23,0 [4] ) +|Data| + +Source Location: (21:0,21 [4] x:\dir\subdir\Test\TestComponent.cshtml) +|null| +Generated Location: (1189:31,0 [4] ) +|null| + +Source Location: (40:2,7 [172] x:\dir\subdir\Test\TestComponent.cshtml) +| + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } +| +Generated Location: (1433:42,0 [172] ) +| + private class System + { + private class String + { + } + } + + [Parameter] + public List Data { get; set; } +| + diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs index 379a952c6bf..3cb6fe273dd 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.codegen.cs @@ -66,7 +66,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::Microsoft.AspNetCore.Components.RenderFragment)( + ), (global::Microsoft.AspNetCore.Components.RenderFragment)( #nullable restore #line (2,25)-(2,33) "x:\dir\subdir\Test\TestComponent.cshtml" template diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt index 90e2fb31129..fd9f1d737da 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_AsComponentParameter_MixedContent/TestComponent.mappings.txt @@ -25,6 +25,6 @@ Generated Location: (1881:63,0 [8] ) Source Location: (136:1,24 [8] x:\dir\subdir\Test\TestComponent.cshtml) |template| -Generated Location: (2111:71,0 [8] ) +Generated Location: (2119:71,0 [8] ) |template| diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs index 22754f76221..83487236b4f 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.codegen.cs @@ -55,7 +55,7 @@ protected override void BuildRenderTree(global::Microsoft.AspNetCore.Components. #line default #line hidden #nullable disable - ), (global::Microsoft.AspNetCore.Components.RenderFragment)( + ), (global::Microsoft.AspNetCore.Components.RenderFragment)( #nullable restore #line (2,31)-(2,39) "x:\dir\subdir\Test\TestComponent.cshtml" template diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt index 6c66253d0b8..91318bfbc45 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/TestFiles/IntegrationTests/ComponentRuntimeCodeGenerationTest/RazorTemplate_Generic_AsComponentParameter/TestComponent.mappings.txt @@ -20,6 +20,6 @@ Generated Location: (1553:52,0 [14] ) Source Location: (108:1,30 [8] x:\dir\subdir\Test\TestComponent.cshtml) |template| -Generated Location: (1788:60,0 [8] ) +Generated Location: (1796:60,0 [8] ) |template| diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs index 8702653d9ae..e5a7c050f4e 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentDesignTimeNodeWriter.cs @@ -801,7 +801,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon if (canTypeCheck) { context.CodeWriter.Write("new "); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write("("); } context.CodeWriter.WriteLine(); @@ -883,15 +883,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon { context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck); context.CodeWriter.Write("<"); - var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; - if (explicitType == true) - { - context.CodeWriter.Write(node.TypeName); - } - else - { - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); - } + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(">"); context.CodeWriter.Write("("); } @@ -964,7 +956,7 @@ public override void WriteComponentChildContent(CodeRenderingContext context, Co BeginWriteAttribute(context, node.AttributeName); context.CodeWriter.WriteParameterSeparator(); context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")("); WriteComponentChildContentInnards(context, node); diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs index 9e924a6b382..79b270262fb 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentNodeWriter.cs @@ -483,6 +483,36 @@ protected static void WriteAddComponentRenderMode(CodeRenderingContext context, context.CodeWriter.WriteLine(); } + protected static void WriteGloballyQualifiedTypeName(CodeRenderingContext context, ComponentAttributeIntermediateNode node) + { + var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; + if (explicitType == true) + { + context.CodeWriter.Write(node.TypeName); + } + else if (node.BoundAttribute?.GetGloballyQualifiedTypeName() is string typeName) + { + context.CodeWriter.Write(typeName); + } + else + { + TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + } + } + + protected static void WriteGloballyQualifiedTypeName(CodeRenderingContext context, ComponentChildContentIntermediateNode node) + { + if (node.BoundAttribute?.GetGloballyQualifiedTypeName() is string typeName && + !node.BoundAttribute.IsGenericTypedProperty()) + { + context.CodeWriter.Write(typeName); + } + else + { + TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + } + } + protected class TypeInferenceMethodParameter { public string SeqName { get; private set; } diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs index bd0b77cab0f..8cb57354a54 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/Components/ComponentRuntimeNodeWriter.cs @@ -654,7 +654,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon if (canTypeCheck) { context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")"); context.CodeWriter.Write("("); } @@ -726,15 +726,7 @@ private void WriteComponentAttributeInnards(CodeRenderingContext context, Compon { context.CodeWriter.Write(ComponentsApi.RuntimeHelpers.TypeCheck); context.CodeWriter.Write("<"); - var explicitType = (bool?)node.Annotations[ComponentMetadata.Component.ExplicitTypeNameKey]; - if (explicitType == true) - { - context.CodeWriter.Write(node.TypeName); - } - else - { - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); - } + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(">"); context.CodeWriter.Write("("); } @@ -813,7 +805,7 @@ public override void WriteComponentChildContent(CodeRenderingContext context, Co BeginWriteAttribute(context, node.AttributeName); context.CodeWriter.WriteParameterSeparator(); context.CodeWriter.Write("("); - TypeNameHelper.WriteGloballyQualifiedName(context.CodeWriter, node.TypeName); + WriteGloballyQualifiedTypeName(context, node); context.CodeWriter.Write(")("); WriteComponentChildContentInnards(context, node); From fdda4bbae9261f96d1eb15cca92566c7bf5792c4 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Thu, 5 Sep 2024 15:42:30 -0700 Subject: [PATCH 237/271] CodeQL suppressions (#10845) --- .../src/Language/CodeGeneration/DefaultDocumentWriter.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs index 550e32ca7ea..afc161e7cc3 100644 --- a/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs +++ b/src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/Language/CodeGeneration/DefaultDocumentWriter.cs @@ -71,6 +71,7 @@ public override void VisitDocument(DocumentIntermediateNode node) } else { + // CodeQL [SM02196] This is supported by the underlying Roslyn APIs and as consumers we must also support it. string?[] supportedAlgorithms = [HashAlgorithmName.SHA1.Name, HashAlgorithmName.SHA256.Name]; var message = Resources.FormatUnsupportedChecksumAlgorithm( From d37da8b3de44606d1b1907483aff07640d324755 Mon Sep 17 00:00:00 2001 From: David Wengier Date: Fri, 6 Sep 2024 11:51:26 +1000 Subject: [PATCH 238/271] Bump to real Roslyn version --- eng/Version.Details.xml | 76 ++++++++++++++++++++--------------------- eng/Versions.props | 38 ++++++++++----------- 2 files changed, 57 insertions(+), 57 deletions(-) diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index a879142cf4a..b9aa7509484 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -11,82 +11,82 @@ 6bcf90f99d13da86c5e9753a6f34b6484673d0a0 - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb diff --git a/eng/Versions.props b/eng/Versions.props index 5df1d73efbd..b17446f0174 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -53,25 +53,25 @@ 9.0.0-beta.24453.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 - + https://github.com/dotnet/roslyn - 0ec44d9775c80a6861b811d8af637ee36e3315e1 + 9f86520c46f67d2a8a59af189f8fd87e35c574bb diff --git a/eng/Versions.props b/eng/Versions.props index c4680833301..c5cbdff6fd3 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -53,25 +53,25 @@ 9.0.0-beta.24426.3 1.0.0-beta.23475.1 1.0.0-beta.23475.1 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 - 4.12.0-2.24419.3 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 + 4.12.0-3.24454.5 - + https://github.com/dotnet/source-build-reference-packages - 6bcf90f99d13da86c5e9753a6f34b6484673d0a0 + ad3c9aa85596f42c6a483233c50fab8cee8c412a diff --git a/eng/Versions.props b/eng/Versions.props index b17446f0174..707ebbb49ad 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -49,7 +49,7 @@ 6.0.2-servicing.22064.6 6.0.1 - 10.0.0-alpha.1.24428.1 + 10.0.0-alpha.1.24455.1 9.0.0-beta.24453.1 1.0.0-beta.23475.1 1.0.0-beta.23475.1 From 4f1a297954e18d5ca2f95e82642b7eff3eec88cd Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 10 Sep 2024 13:25:26 +1000 Subject: [PATCH 269/271] PR Feedback --- .../Extensions/LinePositionSpanExtensions.cs | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs index be8281fc4ca..4ae8ede32f2 100644 --- a/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs +++ b/src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/Extensions/LinePositionSpanExtensions.cs @@ -31,23 +31,19 @@ public static bool OverlapsWith(this LinePositionSpan span, LinePositionSpan oth public static bool LineOverlapsWith(this LinePositionSpan span, LinePositionSpan other) { - var overlapStart = span.Start.Line; - if (span.Start.Line.CompareTo(other.Start.Line) < 0) - { - overlapStart = other.Start.Line; - } + var overlapStart = span.Start.Line < other.Start.Line + ? other.Start.Line + : span.Start.Line; - var overlapEnd = span.End.Line; - if (span.End.Line.CompareTo(other.End.Line) > 0) - { - overlapEnd = other.End.Line; - } + var overlapEnd = span.End.Line > other.End.Line + ? other.End.Line + : span.End.Line; - return overlapStart.CompareTo(overlapEnd) <= 0; + return overlapStart <= overlapEnd; } public static bool Contains(this LinePositionSpan span, LinePositionSpan other) { - return span.Start.CompareTo(other.Start) <= 0 && span.End.CompareTo(other.End) >= 0; + return span.Start <= other.Start && span.End >= other.End; } } From 05e317fc9877d9358923eaaf05030333c67b8cdf Mon Sep 17 00:00:00 2001 From: David Wengier Date: Tue, 10 Sep 2024 14:07:22 +1000 Subject: [PATCH 270/271] Fix after merge --- .../Formatting/DocumentOnTypeFormattingEndpoint.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs index 9d6e1422d22..7012b8173d7 100644 --- a/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs +++ b/src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer/Formatting/DocumentOnTypeFormattingEndpoint.cs @@ -5,6 +5,7 @@ using System.Collections.Frozen; using System.Collections.Immutable; using System.Diagnostics; +using System.Linq; using System.Threading; using System.Threading.Tasks; using Microsoft.AspNetCore.Razor.Language; From 0ea44bab5fa06475623102169fffcb212e162cc3 Mon Sep 17 00:00:00 2001 From: Fredric Silberberg Date: Tue, 10 Sep 2024 15:08:03 -0700 Subject: [PATCH 271/271] Reimplement IDispoasable in test clases. --- .../test/Legacy/HtmlMarkupParserTests.cs | 3 ++- .../test/Legacy/TokenizerLookaheadTest.cs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs index 8c3989c0d0a..7279533d77b 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/HtmlMarkupParserTests.cs @@ -203,9 +203,10 @@ public TestHtmlMarkupParser(ParserContext context) EnsureCurrent(); } - public void Dispose() + void IDisposable.Dispose() { Context.Dispose(); + base.Dispose(); } public new SyntaxToken PreviousToken diff --git a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs index 60e5ff14be7..5f54f57ae81 100644 --- a/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs +++ b/src/Compiler/Microsoft.AspNetCore.Razor.Language/test/Legacy/TokenizerLookaheadTest.cs @@ -210,9 +210,10 @@ internal TestTokenizerBackedParser(LanguageCharacteristics langua { } - public void Dispose() + void IDisposable.Dispose() { Context.Dispose(); + base.Dispose(); } internal new bool LookaheadUntil(Func, bool> condition)