Skip to content

Commit

Permalink
Allow VS Mac to access a few options and a helper method (#60333)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidwengier committed Mar 23, 2022
1 parent 3fb22f1 commit 6d44c5e
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// 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.Diagnostics;

namespace Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.VSMac;

internal static class AnalyzerHelper
{
public static DiagnosticData CreateAnalyzerLoadFailureDiagnostic(AnalyzerLoadFailureEventArgs e, string fullPath, ProjectId? projectId, string? language)
=> DocumentAnalysisExecutor.CreateAnalyzerLoadFailureDiagnostic(e, fullPath, projectId, language);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// 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;

namespace Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.VSMac;

internal static class CompletionOptionsAccessor
{
public static PerLanguageOption2<bool?> ShowItemsFromUnimportedNamespaces
=> CompletionOptionsStorage.ShowItemsFromUnimportedNamespaces;

public static PerLanguageOption2<bool> TriggerOnTypingLetters
=> CompletionOptionsStorage.TriggerOnTypingLetters;

public static PerLanguageOption2<bool?> TriggerOnDeletion
=> CompletionOptionsStorage.TriggerOnDeletion;
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// 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.Options;
using Microsoft.CodeAnalysis.SolutionCrawler;

namespace Microsoft.CodeAnalysis.LanguageServer.ExternalAccess.VSMac;

internal static class SolutionCrawlerOptionsAccessor
{
public static bool LowMemoryForcedMinimalBackgroundAnalysis
{
get => SolutionCrawlerOptionsStorage.LowMemoryForcedMinimalBackgroundAnalysis;
set => SolutionCrawlerOptionsStorage.LowMemoryForcedMinimalBackgroundAnalysis = value;
}

public static PerLanguageOption2<BackgroundAnalysisScope> BackgroundAnalysisScopeOption
=> SolutionCrawlerOptionsStorage.BackgroundAnalysisScopeOption;

public static BackgroundAnalysisScope GetBackgroundAnalysisScope(IGlobalOptionService globalOptions, string language)
=> SolutionCrawlerOptionsStorage.GetBackgroundAnalysisScope(globalOptions, language);
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.Test.Utilities2" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.EditorFeatures2.UnitTests" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Razor"/>
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.Razor" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.ExternalAccess.FSharp" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures" />
<InternalsVisibleTo Include="Microsoft.CodeAnalysis.CSharp.EditorFeatures.UnitTests" />
Expand All @@ -62,6 +62,8 @@
<InternalsVisibleTo Include="IdeBenchmarks" />
<InternalsVisibleTo Include="AnalyzerRunner" />
<InternalsVisibleTo Include="Microsoft.CSharp.VSCode.Extension" Key="$(VisualStudioKey)" />
<RestrictedInternalsVisibleTo Include="MonoDevelop.Ide" Key="$(MonoDevelopKey)" Partner="VSMac" />
<RestrictedInternalsVisibleTo Include="MonoDevelop.Ide.Tests" Key="$(MonoDevelopKey)" Partner="VSMac" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 6d44c5e

Please sign in to comment.