-
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.
Add GlobalOptions.SetBackgroundAnalysisScope and PythiaGlobalOptions …
…External Access API (#59794) * Add GlobalOptions.SetBackgroundAnalysisScope External Access API * Add PythiaGlobalOptions * Add IFSharpEditorFormattingServiceWithOptions
- Loading branch information
Showing
10 changed files
with
127 additions
and
3 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
19 changes: 19 additions & 0 deletions
19
src/Tools/ExternalAccess/FSharp/Editor/AutoFormattingOptionsWrapper.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,19 @@ | ||
// 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.Formatting; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor | ||
{ | ||
internal readonly struct AutoFormattingOptionsWrapper | ||
{ | ||
internal readonly AutoFormattingOptions UnderlyingObject; | ||
|
||
public AutoFormattingOptionsWrapper(AutoFormattingOptions underlyingObject) | ||
=> UnderlyingObject = underlyingObject; | ||
|
||
public FormattingOptions.IndentStyle IndentStyle | ||
=> UnderlyingObject.IndentStyle; | ||
} | ||
} |
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
15 changes: 15 additions & 0 deletions
15
src/Tools/ExternalAccess/FSharp/Editor/IFSharpEditorFormattingServiceWithOptions.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,15 @@ | ||
// 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. | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.FSharp.Editor | ||
{ | ||
internal interface IFSharpEditorFormattingServiceWithOptions : IFSharpEditorFormattingService | ||
{ | ||
/// <summary> | ||
/// True if this service would like to format the document based on the user typing the | ||
/// provided character. | ||
/// </summary> | ||
bool SupportsFormattingOnTypedCharacter(Document document, AutoFormattingOptionsWrapper options, char ch); | ||
} | ||
} |
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
46 changes: 46 additions & 0 deletions
46
src/VisualStudio/Core/Def/ExternalAccess/Pythia/PythiaGlobalOptions.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,46 @@ | ||
// 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 System; | ||
using System.Composition; | ||
using Microsoft.CodeAnalysis.Host.Mef; | ||
using Microsoft.CodeAnalysis.Options; | ||
|
||
namespace Microsoft.CodeAnalysis.ExternalAccess.Pythia.Api | ||
{ | ||
[Export(typeof(PythiaGlobalOptions)), Shared] | ||
internal sealed class PythiaGlobalOptions | ||
{ | ||
private readonly IGlobalOptionService _globalOptions; | ||
|
||
[ImportingConstructor] | ||
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] | ||
public PythiaGlobalOptions(IGlobalOptionService globalOptions) | ||
{ | ||
_globalOptions = globalOptions; | ||
} | ||
|
||
public bool ShowDebugInfo | ||
{ | ||
get => _globalOptions.GetOption(s_showDebugInfoOption); | ||
set => _globalOptions.SetGlobalOption(new OptionKey(s_showDebugInfoOption), value); | ||
} | ||
|
||
public bool RemoveRecommendationLimit | ||
{ | ||
get => _globalOptions.GetOption(s_removeRecommendationLimitOption); | ||
set => _globalOptions.SetGlobalOption(new OptionKey(s_removeRecommendationLimitOption), value); | ||
} | ||
|
||
public const string LocalRegistryPath = @"Roslyn\Internal\OnOff\Features\"; | ||
|
||
private static readonly Option2<bool> s_showDebugInfoOption = new( | ||
"InternalFeatureOnOffOptions", "ShowDebugInfo", defaultValue: false, | ||
storageLocation: new LocalUserProfileStorageLocation(LocalRegistryPath + "ShowDebugInfo")); | ||
|
||
private static readonly Option2<bool> s_removeRecommendationLimitOption = new( | ||
"InternalFeatureOnOffOptions", "RemoveRecommendationLimit", defaultValue: false, | ||
storageLocation: new LocalUserProfileStorageLocation(LocalRegistryPath + "RemoveRecommendationLimit")); | ||
} | ||
} |
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