-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
53 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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 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
38 changes: 38 additions & 0 deletions
38
src/VisualStudio/IntegrationTest/TestUtilities/WellKnownGlobalOptions.cs
This file contains 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,38 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using Microsoft.CodeAnalysis.Completion; | ||
using Microsoft.CodeAnalysis.Options; | ||
using Roslyn.Utilities; | ||
|
||
namespace Microsoft.VisualStudio.IntegrationTest.Utilities | ||
{ | ||
/// <summary> | ||
/// Options settable by integration tests. | ||
/// | ||
/// TODO: Options are currently explicitly listed since <see cref="OptionKey"/> is not serializable. | ||
/// https://github.com/dotnet/roslyn/issues/59267 | ||
/// </summary> | ||
public enum WellKnownGlobalOption | ||
{ | ||
CompletionOptions_ShowItemsFromUnimportedNamespaces, | ||
CompletionViewOptions_EnableArgumentCompletionSnippets, | ||
CompletionOptions_TriggerInArgumentLists, | ||
} | ||
|
||
public static class WellKnownGlobalOptions | ||
{ | ||
public static IOption GetOption(this WellKnownGlobalOption option) | ||
=> option switch | ||
{ | ||
WellKnownGlobalOption.CompletionOptions_ShowItemsFromUnimportedNamespaces => CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces, | ||
WellKnownGlobalOption.CompletionOptions_TriggerInArgumentLists => CompletionOptionsStorage.TriggerInArgumentLists, | ||
WellKnownGlobalOption.CompletionViewOptions_EnableArgumentCompletionSnippets => CompletionViewOptions.EnableArgumentCompletionSnippets, | ||
_ => throw ExceptionUtilities.Unreachable | ||
}; | ||
|
||
public static OptionKey GetKey(this WellKnownGlobalOption option, string? language) | ||
=> new OptionKey(GetOption(option), language); | ||
} | ||
} |