|
10 | 10 | using Microsoft.CodeAnalysis.Host;
|
11 | 11 | using Microsoft.CodeAnalysis.Host.Mef;
|
12 | 12 | using Microsoft.CodeAnalysis.Internal.Log;
|
13 |
| -using Microsoft.CodeAnalysis.Options; |
14 | 13 | using Microsoft.CodeAnalysis.Shared.TestHooks;
|
15 | 14 | using Microsoft.ServiceHub.Framework;
|
16 | 15 | using Microsoft.VisualStudio.OperationProgress;
|
|
23 | 22 | namespace Microsoft.VisualStudio.LanguageServices.Implementation;
|
24 | 23 |
|
25 | 24 | [ExportWorkspaceServiceFactory(typeof(IWorkspaceStatusService), ServiceLayer.Host), Shared]
|
26 |
| -internal sealed class VisualStudioWorkspaceStatusServiceFactory : IWorkspaceServiceFactory |
| 25 | +[method: ImportingConstructor] |
| 26 | +[method: Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] |
| 27 | +internal sealed class VisualStudioWorkspaceStatusServiceFactory( |
| 28 | + SVsServiceProvider serviceProvider, |
| 29 | + IThreadingContext threadingContext, |
| 30 | + IAsynchronousOperationListenerProvider listenerProvider) : IWorkspaceServiceFactory |
27 | 31 | {
|
28 |
| - private static readonly Option2<bool> s_partialLoadModeFeatureFlag = new("visual_studio_workspace_partial_load_mode", defaultValue: false); |
29 |
| - |
30 |
| - private readonly IAsyncServiceProvider2 _serviceProvider; |
31 |
| - private readonly IThreadingContext _threadingContext; |
32 |
| - private readonly IGlobalOptionService _globalOptions; |
33 |
| - private readonly IAsynchronousOperationListener _listener; |
34 |
| - |
35 |
| - [ImportingConstructor] |
36 |
| - [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)] |
37 |
| - public VisualStudioWorkspaceStatusServiceFactory( |
38 |
| - SVsServiceProvider serviceProvider, |
39 |
| - IThreadingContext threadingContext, |
40 |
| - IGlobalOptionService globalOptions, |
41 |
| - IAsynchronousOperationListenerProvider listenerProvider) |
42 |
| - { |
43 |
| - _serviceProvider = (IAsyncServiceProvider2)serviceProvider; |
44 |
| - _threadingContext = threadingContext; |
45 |
| - _globalOptions = globalOptions; |
46 |
| - |
47 |
| - // for now, we use workspace so existing tests can automatically wait for full solution load event |
48 |
| - // subscription done in test |
49 |
| - _listener = listenerProvider.GetListener(FeatureAttribute.Workspace); |
50 |
| - } |
| 32 | + private readonly IAsyncServiceProvider2 _serviceProvider = (IAsyncServiceProvider2)serviceProvider; |
| 33 | + private readonly IAsynchronousOperationListener _listener = listenerProvider.GetListener(FeatureAttribute.Workspace); |
51 | 34 |
|
52 | 35 | [Obsolete(MefConstruction.ImportingConstructorMessage, error: true)]
|
53 | 36 | public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices)
|
54 | 37 | {
|
55 |
| - if (workspaceServices.Workspace is VisualStudioWorkspace) |
56 |
| - { |
57 |
| - if (!_globalOptions.GetOption(s_partialLoadModeFeatureFlag)) |
58 |
| - { |
59 |
| - // don't enable partial load mode for ones that are not in experiment yet |
60 |
| - return new WorkspaceStatusService(); |
61 |
| - } |
62 |
| - |
63 |
| - // only VSWorkspace supports partial load mode |
64 |
| - return new Service(_serviceProvider, _threadingContext, _listener); |
65 |
| - } |
66 |
| - |
67 |
| - return new WorkspaceStatusService(); |
| 38 | + return workspaceServices.Workspace is VisualStudioWorkspace |
| 39 | + ? new Service(_serviceProvider, threadingContext, _listener) |
| 40 | + : new DefaultWorkspaceStatusService(); |
68 | 41 | }
|
69 | 42 |
|
70 | 43 | /// <summary>
|
71 | 44 | /// for prototype, we won't care about what solution is actually fully loaded.
|
72 | 45 | /// we will just see whatever solution VS has at this point of time has actually fully loaded
|
73 | 46 | /// </summary>
|
74 |
| - private class Service : IWorkspaceStatusService |
| 47 | + private sealed class Service : IWorkspaceStatusService |
75 | 48 | {
|
76 | 49 | private readonly IAsyncServiceProvider2 _serviceProvider;
|
77 | 50 | private readonly IThreadingContext _threadingContext;
|
|
0 commit comments