-
Notifications
You must be signed in to change notification settings - Fork 200
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
Add support for _Imports.razor #354
Conversation
@@ -99,6 +97,8 @@ public VirtualProjectItem(string content) | |||
|
|||
public override bool Exists => true; | |||
|
|||
public override string FileKind => FileKinds.ComponentImport; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not being used yet. I plan to use this to add errors for adding code, markup etc in an import document,
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might make more sense to use a document classifier for this. FileKind is something that has to be represented in MSBuild.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see what you mean. But document classification happens after parsing and IR lowering. I was hoping to add those errors at one of those layers. This means I'll have to do this in a separate IR pass.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK thats fine - add this logic to the SDK as well (with tests). Ultimately we want the project system (and msbuild) to tell us how to interpret the files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After thinking about this more, I think I agree with you that FileKind is the right choice.
@pranavkm, I had to rename a ViewImports file for an SDK test. Do you have any suggestions on more SDK tests to cover this or whatever we currently have is enough? |
src/Razor/src/Microsoft.AspNetCore.Mvc.Razor.Extensions.Version1_X/MvcImportProjectFeature.cs
Outdated
Show resolved
Hide resolved
e6b919e
to
b679fe1
Compare
Should be enough for now. We just need to make sure that features work E2E, it doesn't have to be exhaustive. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Merging this now. Making the SDK and other changes in a separate PR. |
* Added support _Imports.razor * Feedback \n\nCommit migrated from dotnet/razor@1470405
* Added support _Imports.razor * Feedback \n\nCommit migrated from dotnet/razor@1470405 Commit migrated from dotnet/aspnetcore@91a383ad3b96
dotnet/aspnetcore#6374
This adds support for it but doesn't do everything mentioned here. I plan to do that in separate PRs.