Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/EditorFeatures/Test/Options/GlobalOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ static void Recurse(Type type, object options, object defaultOptions, string? la
// Skip validation of ReloadChangedAnalyzerReferences. The test options store returns 'true'
// for 'null' (which the option uses to mean 'try the feature flag'). Which is also equivalent
// to the default for this option.
if (IsStoredInGlobalOptions(property, language) &&
property.Name != nameof(WorkspaceConfigurationOptions.ReloadChangedAnalyzerReferences))
if (IsStoredInGlobalOptions(property, language))
{
Assert.False(Equals(value, defaultValue), $"{type.FullName}.{property.Name} not initialized from global options");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ internal static class WorkspaceConfigurationOptionsStorage
public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(this IGlobalOptionService globalOptions)
=> new(
SourceGeneratorExecution: globalOptions.GetOption(SourceGeneratorExecution),
ReloadChangedAnalyzerReferences:
globalOptions.GetOption(ReloadChangedAnalyzerReferences),
ValidateCompilationTrackerStates: globalOptions.GetOption(ValidateCompilationTrackerStates));

public static readonly Option2<bool> ValidateCompilationTrackerStates = new(
Expand All @@ -25,8 +23,4 @@ public static WorkspaceConfigurationOptions GetWorkspaceConfigurationOptions(thi
serializer: new EditorConfigValueSerializer<SourceGeneratorExecutionPreference>(
s => SourceGeneratorExecutionPreferenceUtilities.Parse(s, SourceGeneratorExecutionPreference.Balanced),
SourceGeneratorExecutionPreferenceUtilities.GetEditorConfigString));

public static readonly Option2<bool> ReloadChangedAnalyzerReferences = new(
"dotnet_reload_changed_analyzer_references",
defaultValue: true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti
{"visual_studio_navigate_to_object_browser", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.NavigateToObjectBrowser")},
{"dotnet_validate_compilation_tracker_states", new FeatureFlagStorage(@"Roslyn.ValidateCompilationTrackerStates")},
{"dotnet_source_generator_execution", new RoamingProfileStorage("TextEditor.Roslyn.Specific.SourceGeneratorExecution")},
{"dotnet_reload_changed_analyzer_references", new LocalUserProfileStorage(@"Roslyn\Internal\OnOff\Features", "DotnetReloadChangedAnalyzerReferences")},
{"xaml_enable_lsp_intellisense", new FeatureFlagStorage(@"Xaml.EnableLspIntelliSense")},
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ internal sealed class DefaultWorkspaceConfigurationService() : IWorkspaceConfigu
[DataContract]
internal sealed record class WorkspaceConfigurationOptions(
[property: DataMember(Order = 0)] SourceGeneratorExecutionPreference SourceGeneratorExecution = SourceGeneratorExecutionPreference.Automatic,
[property: DataMember(Order = 1)] bool ReloadChangedAnalyzerReferences = true,
[property: DataMember(Order = 2)] bool ValidateCompilationTrackerStates =
[property: DataMember(Order = 1)] bool ValidateCompilationTrackerStates =
#if DEBUG // We will default this on in DEBUG builds
true
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,6 @@ public static async partial ValueTask<ImmutableArray<AnalyzerReference>> CreateI
SolutionServices solutionServices,
CancellationToken cancellationToken)
{
// Fallback to stock behavior if the reloading option is disabled.
var optionsService = solutionServices.GetRequiredService<IWorkspaceConfigurationService>();
if (!optionsService.Options.ReloadChangedAnalyzerReferences)
return await DefaultCreateIsolatedAnalyzerReferencesAsync(references).ConfigureAwait(false);

if (references.Length == 0)
return [];

Expand All @@ -226,11 +221,6 @@ public static async partial ValueTask<ImmutableArray<AnalyzerReference>> CreateI
Func<Task<ImmutableArray<AnalyzerReference>>> getReferencesAsync,
CancellationToken cancellationToken)
{
// Fallback to stock behavior if the reloading option is disabled.
var optionsService = solutionServices.GetRequiredService<IWorkspaceConfigurationService>();
if (!optionsService.Options.ReloadChangedAnalyzerReferences)
return await DefaultCreateIsolatedAnalyzerReferencesAsync(getReferencesAsync).ConfigureAwait(false);

if (analyzerChecksums.Children.Length == 0)
return [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
#if !NET

using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Serialization;
using Roslyn.Utilities;

namespace Microsoft.CodeAnalysis;

Expand All @@ -27,17 +27,17 @@ public static partial ValueTask<ImmutableArray<AnalyzerReference>> CreateIsolate
SolutionServices solutionServices,
CancellationToken cancellationToken)
{
return DefaultCreateIsolatedAnalyzerReferencesAsync(references);
return ValueTaskFactory.FromResult(references);
}

public static partial ValueTask<ImmutableArray<AnalyzerReference>> CreateIsolatedAnalyzerReferencesAsync(
public static async partial ValueTask<ImmutableArray<AnalyzerReference>> CreateIsolatedAnalyzerReferencesAsync(
bool useAsync,
ChecksumCollection analyzerChecksums,
SolutionServices solutionServices,
Func<Task<ImmutableArray<AnalyzerReference>>> getReferencesAsync,
CancellationToken cancellationToken)
{
return DefaultCreateIsolatedAnalyzerReferencesAsync(getReferencesAsync);
return await getReferencesAsync().ConfigureAwait(false);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,6 @@ public static partial ValueTask<ImmutableArray<AnalyzerReference>> CreateIsolate
Func<Task<ImmutableArray<AnalyzerReference>>> getReferencesAsync,
CancellationToken cancellationToken);

private static ValueTask<ImmutableArray<AnalyzerReference>> DefaultCreateIsolatedAnalyzerReferencesAsync(
ImmutableArray<AnalyzerReference> references)
{
return ValueTaskFactory.FromResult(references);
}

private static async ValueTask<ImmutableArray<AnalyzerReference>> DefaultCreateIsolatedAnalyzerReferencesAsync(
Func<Task<ImmutableArray<AnalyzerReference>>> getReferencesAsync)
{
return await getReferencesAsync().ConfigureAwait(false);
}

public static Guid TryGetFileReferenceMvid(string filePath)
{
try
Expand Down
Loading