-
Notifications
You must be signed in to change notification settings - Fork 199
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
[VS Code] Register compiler features in MVC 3.0 projects #8061
[VS Code] Register compiler features in MVC 3.0 projects #8061
Conversation
public override RazorProjectEngine Create( | ||
RazorConfiguration configuration, | ||
RazorProjectFileSystem fileSystem, | ||
Action<RazorProjectEngineBuilder> configure) => Create(configuration, fileSystem, configure, registerCompilerFeatures: true); |
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 the main part of the change (registerCompilerFeatures: true
).
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.
Good catch, I'll be this was really annoying to track down.
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.
Seems reasonable to me, though I have no context on ProjectEngineFactory
stuff since I don't think it's been touched in years. I'm not sure who would be best for that, maybe the compiler folks or @NTaylorMullen might remember some context.
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer.Common/ProjectEngineFactory.cs
Outdated
Show resolved
Hide resolved
public override RazorProjectEngine Create( | ||
RazorConfiguration configuration, | ||
RazorProjectFileSystem fileSystem, | ||
Action<RazorProjectEngineBuilder> configure) => Create(configuration, fileSystem, configure, registerCompilerFeatures: true); |
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.
Good catch, I'll be this was really annoying to track down.
src/Razor/src/Microsoft.AspNetCore.Razor.LanguageServer.Common/ProjectEngineFactory.cs
Outdated
Show resolved
Hide resolved
After talking briefly with Taylor, it seems that this may not be the ideal long-term fix. However, I think it should suffice for now after manually testing out various MVC scenarios (netcoreapp3.1/6.0/7.0) and having things work as expected. The long-term fix would probably involve DefaultProjectEngineFactory, which somehow isn't utilized at all by VS or VS Code today. I filed #8064 to track future investigation. |
Summary of the changes
ProjectEngineFactory
.ProjectEngineFactory
, which does include registering compiler features. VS Code is using the non-legacy variation.ProjectEngineFactory
. However, I don't have a ton of context in this area, so additional insight is welcome.Before:

After:
