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

OptionKey clean-up and integration tests #66016

Merged
merged 1 commit into from
Dec 22, 2022
Merged

Conversation

tmat
Copy link
Member

@tmat tmat commented Dec 14, 2022

The first commit simplifies implementation of GlobalOptionService.SetOptions and SetGlobalOptions and clarifies the difference.

Next, we replace OptionKey with OptionKey2 in all Roslyn code that does not deal with OptionSet or other public APIs that expose options. Eventually we'll be able to ban OptionKey internally. We also push all translations between internal and public code style option values into SolutionOptionSet and remove them from GlobalOptionService. The former exposes the values through public API while the latter does not. After this change global options only operate with internal representations. A lot of mechanical changes are needed for this change - the most interesting files to review are: OptionSet.cs, SolutionOptionSet.cs, GlobalOptionService.cs, OptionsHelpers.cs, OptionKeyTest.cs and GlobalOptionServiceTests.cs.

Adds a new integration test that enumerates all global option definitions in Roslyn assemblies and validates that each of these options can be updated in VS. This addresses test hole where we did not validate reading options from VS settings/registry.

Moves code that updates options of the current workspace solution to LegacyWorkspaceOptionService as it only implements legacy behavior and only affects code reading from Solution.Options, which shouldn't be done in Roslyn. There is a slight semantic change: the GlobalOptionsService.OptionChanged event is now triggered before the workspaces registered to LegacyWorkspaceOptionService get their current solutions updated. This is ok since the event is an internal event, not observable by public consumers of Workspace APIs and Roslyn code does not read global options from Solution.Options anymore.

Removes UnitTestingOptionChangedEventArgsWrapper - not used by Unit Testing anymore.

Implements #65394

@tmat tmat force-pushed the OptionKey branch 6 times, most recently from df43ca5 to 34c41a3 Compare December 18, 2022 20:27
@tmat tmat marked this pull request as ready for review December 19, 2022 23:31
@tmat tmat requested review from a team as code owners December 19, 2022 23:31
@jmarolf jmarolf self-assigned this Dec 19, 2022
Copy link
Member

@dibarbet dibarbet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems fine, especially with the test. Note that I think Jon wanted to take a look as well

…obalOptions and clarifies the difference.

Next, we replace OptionKey with OptionKey2 in all Roslyn code that does not deal with OptionSet or other public APIs that expose options. Eventually we'll be able to ban OptionKey internally. We also push all translations between internal and public code style option values into SolutionOptionSet and remove them from GlobalOptionService. The former exposes the values through public API while the latter does not. After this change global options only operate with internal representations. A lot of mechanical changes are needed for this change - the most interesting files to review are: OptionSet.cs, SolutionOptionSet.cs, GlobalOptionService.cs, OptionsHelpers.cs, OptionKeyTest.cs and GlobalOptionServiceTests.cs.

Adds a new integration test that enumerates all global option definitions in Roslyn assemblies and validates that each of these options can be updated in VS. This addresses test hole where we did not validate reading options from VS settings/registry.

Moves code that updates options of the current workspace solution to LegacyWorkspaceOptionService as it only implements legacy behavior and only affects code reading from Solution.Options, which shouldn't be done in Roslyn. There is a slight semantic change: the GlobalOptionsService.OptionChanged event is now triggered before the workspaces registered to LegacyWorkspaceOptionService get their current solutions updated. This is ok since the event is an internal event, not observable by public consumers of Workspace APIs and Roslyn code does not read global options from Solution.Options anymore.

Removes UnitTestingOptionChangedEventArgsWrapper - not used by Unit Testing anymore.
@tmat tmat changed the base branch from main to release/dev17.6 December 22, 2022 00:58
@tmat tmat enabled auto-merge (squash) December 22, 2022 02:57
@tmat tmat merged commit f86f36b into dotnet:release/dev17.6 Dec 22, 2022
333fred added a commit that referenced this pull request Jan 3, 2023
…nd SetGlobalOptions and clarifies the difference. (#66016)"

This reverts commit f86f36b.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants