Skip to content

Conversation

@DustinCampbell
Copy link
Member

@DustinCampbell DustinCampbell commented Mar 29, 2025

This change moves types that were recently moved to Microsoft.CodeAnalysis.Razor.Workspaces to the appropriate namespaces. The intent is to get this in before the snap so that future cherry-picks are a bit easier. It's a big change, but it's almost completely mechanical. I recommend reviewing commit-by-commit, though there's a lot of commits too!

Note that this PR doesn't actually require a review from @dotnet/razor-compiler. It seems that tweaks to the tooling-specific JSON serialization files are causing that reviewer to be included.

@DustinCampbell DustinCampbell requested review from a team as code owners March 29, 2025 03:12
Copy link
Member

@davidwengier davidwengier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Funny, I ran across the Unsupported stuff when doing completion resolve, and I made a note to check if it was still necessary and remove it if not. Thanks for doing the hard work :)

(probably would have been better as a separate PR though, just in case some weird legacy thing goes wrong 😛)

}

[Fact]
public async Task Handle_AfterLastLineCharacterZero()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good test, despite the call to SetUnsupported.

@DustinCampbell
Copy link
Member Author

DustinCampbell commented Mar 29, 2025

(probably would have been better as a separate PR though, just in case some weird legacy thing goes wrong 😛)

I thought about that, but decided it wasn't worth a second PR. The code is truly dead and I couldn't imagine how something would ever call it. We started defaulting to MVC-3.0 a long while ago to match the source generator, and there's no such thing as a custom Razor extension anymore. So, anything that would be broken is already broken.

@davidwengier
Copy link
Member

I couldn't imagine how something would ever call it

You're just gonna tempt fate like that?!

@DustinCampbell
Copy link
Member Author

DustinCampbell commented Mar 31, 2025

I couldn't imagine how something would ever call it

You're just gonna tempt fate like that?!

Point taken, though I wish you'd be clearer about making it instead of using passive aggressive 😛 emojis 😀.

I'll pull those commits into a separate PR. Rebase incoming...

Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move DocumentKey to Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
These tests were recently marked with "#nullable disable" unnecessarily.
This nullability annotations in this file are accurate.
These tests were recently marked with "#nullable disable" unnecessarily.
GeneratedDocumentTextLoader is only used by the DynamicFileInfo system in the VS layer, so this change moves it there and puts it in the Microsoft.VisualStudio.Razor.DynamicFiles namespace. This includes test updates to move tests to the correct locations as well.
This change moves two tests from MS.VS.LanguageServices.Razor.Test\LanguageClient\DynamicFiles to MS.VS.LanguageServices.Razor.Test\DynamicFiles and updates their namespaces.
IDocumentContextFactory and IDocumentContextFactoryExtensions are only used by the language server and can safely live there. Both have been moved to the Microsoft.AspNetCore.Razor.LanguageServer.ProjectSystem namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move IDocumentSnapshot to the Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move IProjectSnapshot to the Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectKey to the Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectWorkspaceState to the Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move RazorProjectInfo to the Microsoft.CodeAnalysis.Razor.ProjectSystem namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move DefaultProjectEngineFactory to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move EmptyProjectEngineFactory to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace. In addition, clean up a bit and use ArgHelper.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move IProjectEngineFactory to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move IProjectEngineFactoryExtensions to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move IProjectEngineFactoryProvider to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectEngineFactories to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectEngineFactory to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectEngineFactory_Unsupported to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move ProjectEngineFactoryProvider to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move UnsupportedCSharpLoweringPhase to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move UnsupportedRazorConfiguration to the Microsoft.CodeAnalysis.Razor.ProjectEngineHost namespace.
This change updates all of the namespaces in the Microsoft.CodeAnalysis.Razor.Workspaces\Serialization folder to Microsoft.CodeAnalysis.Razor.Serialization.*.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move UrlDecoder to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move TagHelperCache  to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move StreamExtensions  to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move RazorProjectInfoFactory to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, rename ProjectInfoAction to RazorProjectInfoAction and move it to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move MemoryCache<TKey, TValue> to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move FilePathNormalizer and FilePathNormalizingComparer to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
These should not be in the ProjectEngineHost folder or namespace
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move AsyncBatchingWorkQueue to the Microsoft.CodeAnalysis.Razor.Utilities namespace.
Now that they've been moved to Microsoft.CodeAnalysis.Razor.Workspaces, this change moves all types from the Microsoft.AspNetCore.Razor.Utilities namespace to Microsoft.CodeAnalysis.Razor.Utilities.
Now that it is in Microsoft.CodeAnalysis.Razor.Workspaces, move Extensions from the Microsoft.AspNetCore.Razor.ProjectSystem namespace to Microsoft.CodeAnalysis.Razor.ProjectSystem
Now that they've been moved to Microsoft.CodeAnalysis.Razor.Workspaces, this change moves all types from the Microsoft.AspNetCore.Razor.Telemetry namespace to Microsoft.CodeAnalysis.Razor.Telemetry.
Now that they've been moved to Microsoft.CodeAnalysis.Razor.Workspaces, this change moves all types from the Microsoft.AspNetCore.Razor.TextDifferencing namespace to Microsoft.CodeAnalysis.Razor.TextDifferencing.
@DustinCampbell DustinCampbell force-pushed the pre-snap-code-clean-up branch from b56c092 to 38b3d1b Compare March 31, 2025 17:29
@DustinCampbell
Copy link
Member Author

I'll pull those commits into a separate PR. Rebase incoming...

#11685 now includes those commits.

@DustinCampbell DustinCampbell merged commit 616caa5 into dotnet:main Mar 31, 2025
11 checks passed
@DustinCampbell DustinCampbell deleted the pre-snap-code-clean-up branch March 31, 2025 19:57
@dotnet-policy-service dotnet-policy-service bot added this to the Next milestone Mar 31, 2025
@jjonescz jjonescz modified the milestones: Next, 17.14 P3 Apr 1, 2025
DustinCampbell added a commit that referenced this pull request Apr 1, 2025
This is a follow up to #11675 that cleans up and removes some code in
the "ProjectEngineHost" folder. Notably, it turns out that the system
for marking projects as "unsupported" is no longer used. So, checks for
`RazorCodeDocument.IsUnsupported()` can be removed from the language
server and tests for this scenario can be removed.

~~**NOTE**: This PR is currently based on `pre-snap-code-clean-up` to
aid code reviews. I'll rebase it to `main` once #11675 is merged.~~
Changed the base to `main`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants