-
Notifications
You must be signed in to change notification settings - Fork 212
Wire up the UseRoslynTokenizer feature properly #11386
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
Merged
davidwengier
merged 10 commits into
main
from
dev/dawengie/RoslynTokenizerTakeEightySix
Jan 15, 2025
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
06376f0
Update configuration when updating project workspace state
davidwengier 121b42b
Move CSharpLanguageVersion from ProjectWorkstateState to RazorConfigu…
davidwengier 4e8ec12
Add tokenizer and parse options properties to RazorConfiguration
davidwengier 8f25dc1
Get tokenizer and preprocessor symbols from Roslyn
davidwengier 6f58201
Fix build
davidwengier ec1101b
Remove old feature flag
davidwengier 8944a71
Remove stale comment
davidwengier d65919c
Expand serialization round-trip tests to full coverage
davidwengier 179cef3
Fix a bug found by having full coverage in tests 😛
davidwengier 29db9f4
PR Feedback
davidwengier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
src/Compiler/Microsoft.CodeAnalysis.Razor.Compiler/src/CSharp/ParseOptionsExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
|
||
using System; | ||
|
||
namespace Microsoft.CodeAnalysis.Razor.Compiler.CSharp; | ||
|
||
internal static class ParseOptionsExtensions | ||
{ | ||
public static bool UseRoslynTokenizer(this ParseOptions parseOptions) | ||
=> parseOptions.Features.TryGetValue("use-roslyn-tokenizer", out var useRoslynTokenizerValue) && | ||
string.Equals(useRoslynTokenizerValue, "true", StringComparison.OrdinalIgnoreCase); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Thiss constructor ends up with an object where
options.UseRoslynTokenizer != options.Configuration.UseRoslyntokenizer
. Is there a place where we could add validation to catch this dissagreement? Or is it a valid setup and I'm missing it. CouldRazorSourceGenerationOptions
just haveUseRoslynTokenizer
be a passthrough to the property onConfiguration
?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.
RazorConfiguration is currently not ideal IMO. It's why I logged #11182. Tooling passes a RazorConfiguration to the compiler when configuring the project engine, but the compiler doesn't use all of the configuration, so we also have to read properties off that configuration again, and do more config in the
configure
lambda. Ideally we'd just give the compiler some type it needed, and it would go from there.So yeah,
UseRoslynTokenizer
could be passed in here, and in fact thats why I moved it, but then I realised it wasn't necessary and forgot to move it back.