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

Remove visual_studio_workspace_partial_load_mode feature flag option #72689

Merged
merged 1 commit into from
Mar 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,6 @@ public bool TryFetch(LocalUserRegistryOptionPersister persister, OptionKey2 opti
{"visual_basic_style_unused_value_assignment_preference", new RoamingProfileStorage("TextEditor.VisualBasic.Specific.UnusedValueAssignmentPreference")},
{"visual_basic_style_unused_value_expression_statement_preference", new RoamingProfileStorage("TextEditor.VisualBasic.Specific.UnusedValueExpressionStatementPreference")},
{"visual_studio_navigate_to_object_browser", new RoamingProfileStorage("TextEditor.%LANGUAGE%.Specific.NavigateToObjectBrowser")},
{"visual_studio_workspace_partial_load_mode", new FeatureFlagStorage(@"Roslyn.PartialLoadMode")},
{"dotnet_disable_recoverable_text", new FeatureFlagStorage(@"Roslyn.DisableRecoverableText")},
{"dotnet_validate_compilation_tracker_states", new FeatureFlagStorage(@"Roslyn.ValidateCompilationTrackerStates")},
{"dotnet_enable_diagnostics_in_source_generated_files", new RoamingProfileStorage("TextEditor.Roslyn.Specific.EnableDiagnosticsInSourceGeneratedFilesExperiment")},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using Microsoft.CodeAnalysis.Host;
using Microsoft.CodeAnalysis.Host.Mef;
using Microsoft.CodeAnalysis.Internal.Log;
using Microsoft.CodeAnalysis.Options;
using Microsoft.CodeAnalysis.Shared.TestHooks;
using Microsoft.ServiceHub.Framework;
using Microsoft.VisualStudio.OperationProgress;
Expand All @@ -23,55 +22,29 @@
namespace Microsoft.VisualStudio.LanguageServices.Implementation;

[ExportWorkspaceServiceFactory(typeof(IWorkspaceStatusService), ServiceLayer.Host), Shared]
internal sealed class VisualStudioWorkspaceStatusServiceFactory : IWorkspaceServiceFactory
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class VisualStudioWorkspaceStatusServiceFactory(
SVsServiceProvider serviceProvider,
IThreadingContext threadingContext,
IAsynchronousOperationListenerProvider listenerProvider) : IWorkspaceServiceFactory
{
private static readonly Option2<bool> s_partialLoadModeFeatureFlag = new("visual_studio_workspace_partial_load_mode", defaultValue: false);

private readonly IAsyncServiceProvider2 _serviceProvider;
private readonly IThreadingContext _threadingContext;
private readonly IGlobalOptionService _globalOptions;
private readonly IAsynchronousOperationListener _listener;

[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public VisualStudioWorkspaceStatusServiceFactory(
SVsServiceProvider serviceProvider,
IThreadingContext threadingContext,
IGlobalOptionService globalOptions,
IAsynchronousOperationListenerProvider listenerProvider)
{
_serviceProvider = (IAsyncServiceProvider2)serviceProvider;
_threadingContext = threadingContext;
_globalOptions = globalOptions;

// for now, we use workspace so existing tests can automatically wait for full solution load event
// subscription done in test
_listener = listenerProvider.GetListener(FeatureAttribute.Workspace);
}
private readonly IAsyncServiceProvider2 _serviceProvider = (IAsyncServiceProvider2)serviceProvider;
private readonly IAsynchronousOperationListener _listener = listenerProvider.GetListener(FeatureAttribute.Workspace);

[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
{
if (workspaceServices.Workspace is VisualStudioWorkspace)
{
if (!_globalOptions.GetOption(s_partialLoadModeFeatureFlag))
{
// don't enable partial load mode for ones that are not in experiment yet
return new WorkspaceStatusService();
}

// only VSWorkspace supports partial load mode
return new Service(_serviceProvider, _threadingContext, _listener);
}

return new WorkspaceStatusService();
return workspaceServices.Workspace is VisualStudioWorkspace
? new Service(_serviceProvider, threadingContext, _listener)
: new DefaultWorkspaceStatusService();
}

/// <summary>
/// for prototype, we won't care about what solution is actually fully loaded.
/// we will just see whatever solution VS has at this point of time has actually fully loaded
/// </summary>
private class Service : IWorkspaceStatusService
private sealed class Service : IWorkspaceStatusService
{
private readonly IAsyncServiceProvider2 _serviceProvider;
private readonly IThreadingContext _threadingContext;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System;
using System.Composition;
using System.Threading;
Expand All @@ -14,14 +12,10 @@
namespace Microsoft.CodeAnalysis.Host;

[ExportWorkspaceService(typeof(IWorkspaceStatusService), ServiceLayer.Default), Shared]
internal sealed class WorkspaceStatusService : IWorkspaceStatusService
[method: ImportingConstructor]
[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
internal sealed class DefaultWorkspaceStatusService() : IWorkspaceStatusService
{
[ImportingConstructor]
[Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
public WorkspaceStatusService()
{
}

event EventHandler IWorkspaceStatusService.StatusChanged
{
add { }
Expand Down
Loading