-
Notifications
You must be signed in to change notification settings - Fork 196
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
Update project configuration from Roslyn info #11092
Update project configuration from Roslyn info #11092
Conversation
A better fix here would be to get the The other option is just to rename |
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.
A better fix here would be to get the
SuppressAddComponentParameter
flag off ofRazorConfiguration
and put it onProjectWorkspaceState
.
Unfortunately, I think that might be a hackier fix. I took a quick look, even though this is in draft, and I'm not comfortable elevating ProjectWorkspaceState
to hold more options. IMO, data needed to configure the compiler should go on RazorConfiguration
.
...azor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectSystem/ProjectWorkspaceState.cs
Outdated
Show resolved
Hide resolved
...azor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectSystem/ProjectWorkspaceState.cs
Outdated
Show resolved
Hide resolved
...azor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/ProjectSystem/ProjectWorkspaceState.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.AspNetCore.Razor.ProjectEngineHost/Utilities/RazorProjectInfoFactory.cs
Outdated
Show resolved
Hide resolved
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs
Show resolved
Hide resolved
@@ -19,6 +19,7 @@ | |||
using Microsoft.CodeAnalysis.Razor; | |||
using Microsoft.CodeAnalysis.Razor.Compiler.CSharp; | |||
using Microsoft.CodeAnalysis.Razor.ProjectSystem; | |||
using Microsoft.NET.Sdk.Razor.SourceGenerators; |
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 feels wrong from a layering perspective. Note that there are (sadly) multiple "features" for configuring the Razor compiler's parse options. This is using the source generator's implementation of IConfigureRazorParserOptionsFeature
rather than the newer one that is actually used in most cases: IRazorParserOptionsFactoryProjectFeature
.
.../Microsoft.AspNetCore.Razor.ProjectEngineHost.Test/Serialization/SerializerValidationTest.cs
Outdated
Show resolved
Hide resolved
Noting that I am being descriptive, not prescriptive, but in VS at least,
No argument from me, and with this PR allowing the
I am unfamiliar with all 3 of these types, so thank you for the pointers. The current code is just me copying code from the compiler because, as I mentioned above, expediency was the goal. |
… overload of the configuration object
Okay, pushed up an update to move I also took the liberty of renaming some classes because "WorkspaceProject" and "ProjectWorkspace" seem to both mean "Roslyn", so I just called them "Roslyn". Also taking this out of draft since I found and fixed the issue with |
Not related to your pull request at all, but |
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 definitely a big improvement! Thanks for your hard work cleaning much of this up.
...oft.AspNetCore.Razor.Microbenchmarks/Resources/Telerik/Kendo.Mvc.Examples.project.razor.json
Show resolved
Hide resolved
....Razor.ProjectEngineHost/Serialization/MessagePack/Formatters/RazorConfigurationFormatter.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.CodeAnalysis.Razor.Workspaces/ProjectSystem/ProjectState.cs
Show resolved
Hide resolved
src/Razor/src/Microsoft.VisualStudio.LanguageServices.Razor/IRoslynProjectChangeProcessor.cs
Show resolved
Hide resolved
@@ -66,7 +65,7 @@ await _projectManager.UpdateAsync(updater => | |||
updater.ProjectAdded(hostProject); | |||
}); | |||
|
|||
var projectWorkspaceState = ProjectWorkspaceState.Create(LanguageVersion.LatestMajor); | |||
var projectWorkspaceState = ProjectWorkspaceState.Default; |
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.
Does this still represent a project change as the test requires?
...ft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RoslynProjectChangeDetectorTest.cs
Show resolved
Hide resolved
...ft.VisualStudio.LanguageServices.Razor.Test/ProjectSystem/RoslynProjectChangeDetectorTest.cs
Outdated
Show resolved
Hide resolved
.../test/Microsoft.VisualStudio.LanguageServices.Razor.Test/RoslynProjectChangeProcessorTest.cs
Outdated
Show resolved
Hide resolved
...isualStudio.LanguageServices.Razor.Test/VsSolutionUpdatesProjectSnapshotChangeTriggerTest.cs
Outdated
Show resolved
Hide resolved
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.
Compiler changes LGTM
Agreed. Now it is just tag helpers, and the name makes little sense. |
var changed = _hostProject1 with | ||
{ | ||
Configuration = _hostProject1.Configuration with | ||
{ | ||
CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | ||
} | ||
}; |
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'm pretty sure you can use dotted names in with
. Doesn't block this PR, but good for a follow up.
var changed = _hostProject1 with | |
{ | |
Configuration = _hostProject1.Configuration with | |
{ | |
CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | |
} | |
}; | |
var changed = _hostProject1 with | |
{ | |
Configuration.CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | |
}; |
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.
Actually, it looks like you can't do this, but I was sure we added it. Sigh...
var changed = _hostProject1 with | ||
{ | ||
Configuration = _hostProject1.Configuration with | ||
{ | ||
CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | ||
} | ||
}; |
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.
Non-blocking!
var changed = _hostProject1 with | |
{ | |
Configuration = _hostProject1.Configuration with | |
{ | |
CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | |
} | |
}; | |
var changed = _hostProject1 with | |
{ | |
Configuration.CSharpLanguageVersion = CodeAnalysis.CSharp.LanguageVersion.CSharp8 | |
}; |
Fixes #10736 and brings in IDE support for the new Roslyn tokenizer, which makes this work: