Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reclaim RazorProject type from the compiler #11379

Open
wants to merge 18 commits into
base: main
Choose a base branch
from

Conversation

DustinCampbell
Copy link
Member

Razor tooling will be renaming DocumentSnapshot to RazorDocument and ProjectSnapshot to RazorProject. However, the compiler already declares a RazorProject type in a different namespace. To avoid painful conflicts, this change removes RazorProject from the compiler. On closer inspection, it turns out that the compiler's RazorProject is an unnecessary abstraction. It only serves as the base type for RazorProjectFileSystem and instances are never exposed as RazorProject. So, this change merges RazorProject into RazorProjectFileSystem.

I've done a fair amount of clean up and called that out in the commit history. In addition, I added a new InMemoryFileContent helper class to remove a bunch of duplicated code converting strings into UTF byte arrays.

ComponentImportProjectFeature does the same work to produce a new byte array for its file content every time it produces a RazorProjectItem. This change computes the byte array once and reuses the same project item rather than creating a new one.
RazorProjectFileSystem has two abstract GetItem overloads that all subclasses must provide an implementation for. However, every subclass implements one GetItem the same way by delegating to the overload. This change just pushes that implementation into RazorProjectFileSystem.
All code that instantiates a NotFoundProjectItem always passes an empty string. This change removes that argument.
This updates up all three versions of MvcImportProjectFeature from Extensions, Extensions.Version1_X, and Extensions.Vserion2_X.
@DustinCampbell DustinCampbell requested review from a team as code owners January 11, 2025 00:36
Copy link
Contributor

@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.

✅ Tooling (though I did look at the rest of it too)

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.

2 participants