private ServiceHubRemoteHostClient( HostWorkspaceServices services, IServiceBroker serviceBroker, ServiceBrokerClient serviceBrokerClient, HubClient hubClient, Stream stream, IRemoteServiceCallbackDispatcherProvider callbackDispatcherProvider) { _connectionPools = new ConnectionPools( connectionFactory: (serviceName, pool, cancellationToken) => CreateConnectionImplAsync(serviceName, callbackTarget: null, pool, cancellationToken), capacity: ConnectionPoolCapacity); // use the hub client logger for unexpected exceptions from devenv as well, so we have complete information in the log: services.GetService <IWorkspaceTelemetryService>()?.RegisterUnexpectedExceptionLogger(hubClient.Logger); _services = services; _serviceBroker = serviceBroker; _serviceBrokerClient = serviceBrokerClient; _hubClient = hubClient; _callbackDispatcherProvider = callbackDispatcherProvider; _endPoint = new RemoteEndPoint(stream, hubClient.Logger, incomingCallTarget: this); _endPoint.Disconnected += OnDisconnected; _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown; _endPoint.StartListening(); _assetStorage = services.GetRequiredService <ISolutionAssetStorageProvider>().AssetStorage; _serializer = services.GetRequiredService <ISerializerService>(); _errorReportingService = services.GetService <IErrorReportingService>(); _shutdownCancellationService = services.GetService <IRemoteHostClientShutdownCancellationService>(); _isRemoteHostServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(services); _isRemoteHostCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(services); }
internal static void ConnectProjectCacheServiceToDocumentTracking( HostWorkspaceServices workspaceServices, ProjectCacheService projectCacheService ) { var documentTrackingService = workspaceServices.GetService <IDocumentTrackingService>(); // Subscribe to events so that we can cache items from the active document's project var manager = new ActiveProjectCacheManager( documentTrackingService, projectCacheService ); // Subscribe to requests to clear the cache var workspaceCacheService = workspaceServices.GetService <IWorkspaceCacheService>(); if (workspaceCacheService != null) { workspaceCacheService.CacheFlushRequested += (s, e) => manager.Clear(); } // Also clear the cache when the solution is cleared or removed. workspaceServices.Workspace.WorkspaceChanged += (s, e) => { if ( e.Kind == WorkspaceChangeKind.SolutionCleared || e.Kind == WorkspaceChangeKind.SolutionRemoved ) { manager.Clear(); } }; }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { // we support active document tracking only for visual studio workspace host. if (workspaceServices.Workspace is MonoDevelopWorkspace monoDevelopWorkspace) { // We will finish setting this up in VisualStudioWorkspaceImpl.DeferredInitializationState var projectCacheService = new MonoDevelopProjectCacheService(monoDevelopWorkspace, ImplicitCacheTimeoutInMS); var documentTrackingService = workspaceServices.GetService <IDocumentTrackingService> (); // Subscribe to events so that we can cache items from the active document's project var manager = new ActiveProjectCacheManager(documentTrackingService, projectCacheService); projectCacheService.Manager = manager; // Subscribe to requests to clear the cache var workspaceCacheService = workspaceServices.GetService <IWorkspaceCacheService> (); projectCacheService.SubscribeToFlushRequested(workspaceCacheService); // Also clear the cache when the solution is cleared or removed. monoDevelopWorkspace.WorkspaceChanged += (s, e) => { if (e.Kind == WorkspaceChangeKind.SolutionCleared || e.Kind == WorkspaceChangeKind.SolutionRemoved) { manager.Clear(); } }; return(projectCacheService); } // TODO: Handle miscellaneous files workspace later on. return(new ProjectCacheService(workspaceServices.Workspace)); }
private static IWorkspaceService GetVisualStudioProjectCache(HostWorkspaceServices workspaceServices) { var projectCacheService = new ProjectCacheService(workspaceServices.Workspace, ImplicitCacheTimeoutInMS); var documentTrackingService = workspaceServices.GetService<IDocumentTrackingService>(); // Subscribe to events so that we can cache items from the active document's project var manager = new ActiveProjectCacheManager(documentTrackingService, projectCacheService); // Subscribe to requests to clear the cache var workspaceCacheService = workspaceServices.GetService<IWorkspaceCacheService>(); if (workspaceCacheService != null) { workspaceCacheService.CacheFlushRequested += (s, e) => manager.Clear(); } // Also clear the cache when the solution is cleared or removed. workspaceServices.Workspace.WorkspaceChanged += (s, e) => { if (e.Kind == WorkspaceChangeKind.SolutionCleared || e.Kind == WorkspaceChangeKind.SolutionRemoved) { manager.Clear(); } }; return projectCacheService; }
private static IWorkspaceService GetVisualStudioProjectCache(HostWorkspaceServices workspaceServices) { var projectCacheService = new ProjectCacheService(workspaceServices.Workspace, ImplicitCacheTimeoutInMS); var documentTrackingService = workspaceServices.GetService <IDocumentTrackingService>(); // Subscribe to events so that we can cache items from the active document's project var manager = new ActiveProjectCacheManager(documentTrackingService, projectCacheService); // Subscribe to requests to clear the cache var workspaceCacheService = workspaceServices.GetService <IWorkspaceCacheService>(); if (workspaceCacheService != null) { workspaceCacheService.CacheFlushRequested += (s, e) => manager.Clear(); } // Also clear the cache when the solution is cleared or removed. workspaceServices.Workspace.WorkspaceChanged += (s, e) => { if (e.Kind == WorkspaceChangeKind.SolutionCleared || e.Kind == WorkspaceChangeKind.SolutionRemoved) { manager.Clear(); } }; return(projectCacheService); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var optionService = workspaceServices.GetService<IOptionService>(); var errorReportingService = workspaceServices.GetService<IErrorReportingService>(); var errorLoggerService = workspaceServices.GetService<IErrorLoggerService>(); return new ExtensionManager(optionService, errorReportingService, errorLoggerService, _errorHandlers); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var optionService = workspaceServices.GetService <IOptionService>(); var errorReportingService = workspaceServices.GetService <IErrorReportingService>(); var errorLoggerService = workspaceServices.GetService <IErrorLoggerService>(); return(new ExtensionManager(optionService, errorReportingService, errorLoggerService, _errorHandlers)); }
public SerializerService(HostWorkspaceServices workspaceServices) { _workspaceServices = workspaceServices; _hostSerializationService = _workspaceServices.GetService <IReferenceSerializationService>(); _tempService = _workspaceServices.GetService <ITemporaryStorageService>() as ITemporaryStorageService2; _textService = _workspaceServices.GetService <ITextFactoryService>(); _lazyLanguageSerializationService = new ConcurrentDictionary <string, IOptionsSerializationService>(concurrencyLevel: 2, capacity: _workspaceServices.SupportedLanguages.Count()); }
private void RegisterGlobalOperationNotifications() { var globalOperationService = _services.GetService <IGlobalOperationNotificationService>(); if (globalOperationService != null) { globalOperationService.Started += OnGlobalOperationStarted; globalOperationService.Stopped += OnGlobalOperationStopped; } }
public static async Task <RemoteHostClient> CreateAsync( HostWorkspaceServices services, RemoteProcessConfiguration configuration, AsynchronousOperationListenerProvider listenerProvider, IServiceBroker serviceBroker, RemoteServiceCallbackDispatcherRegistry callbackDispatchers, CancellationToken cancellationToken) { using (Logger.LogBlock(FunctionId.ServiceHubRemoteHostClient_CreateAsync, KeyValueLogMessage.NoProperty, cancellationToken)) { #pragma warning disable ISB001 // Dispose of proxies #pragma warning disable VSTHRD012 // Provide JoinableTaskFactory where allowed var serviceBrokerClient = new ServiceBrokerClient(serviceBroker); #pragma warning restore var hubClient = new HubClient("ManagedLanguage.IDE.RemoteHostClient"); var client = new ServiceHubRemoteHostClient(services, configuration, serviceBrokerClient, hubClient, callbackDispatchers); var syntaxTreeConfigurationService = services.GetService <ISyntaxTreeConfigurationService>(); if (syntaxTreeConfigurationService != null) { await client.TryInvokeAsync <IRemoteProcessTelemetryService>( (service, cancellationToken) => service.SetSyntaxTreeConfigurationOptionsAsync(syntaxTreeConfigurationService.DisableRecoverableTrees, syntaxTreeConfigurationService.DisableProjectCacheService, syntaxTreeConfigurationService.EnableOpeningSourceGeneratedFilesInWorkspace, cancellationToken), cancellationToken).ConfigureAwait(false); } await client.TryInvokeAsync <IRemoteAsynchronousOperationListenerService>( (service, cancellationToken) => service.EnableAsync(AsynchronousOperationListenerProvider.IsEnabled, listenerProvider.DiagnosticTokensEnabled, cancellationToken), cancellationToken).ConfigureAwait(false); client.Started(); return(client); } }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var optionService = workspaceServices.GetRequiredService <IOptionService>(); var database = optionService.GetOption(StorageOptions.Database); switch (database) { case StorageDatabase.SQLite: if (!SQLitePersistentStorageService.TryInitializeLibraries()) { break; } var locationService = workspaceServices.GetService <IPersistentStorageLocationService>(); if (locationService != null) { return(new SQLitePersistentStorageService(optionService, locationService, _solutionSizeTracker)); } break; } return(NoOpPersistentStorageService.Instance); }
public static IChecksummedPersistentStorageService GetPersistentStorageService(this HostWorkspaceServices services, StorageDatabase database) { var configuration = services.GetRequiredService <IPersistentStorageConfiguration>(); return(database switch { #if !DOTNET_BUILD_FROM_SOURCE StorageDatabase.SQLite => services.GetService <SQLitePersistentStorageService>() ?? NoOpPersistentStorageService.GetOrThrow(configuration), #endif StorageDatabase.CloudCache => services.GetService <ICloudCacheStorageService>() ?? NoOpPersistentStorageService.GetOrThrow(configuration), _ => NoOpPersistentStorageService.GetOrThrow(configuration), });
private ServiceHubRemoteHostClient( HostWorkspaceServices services, HubClient hubClient, HostGroup hostGroup, Stream stream) { _connectionPools = new ConnectionPools( connectionFactory: (serviceName, pool, cancellationToken) => CreateConnectionImplAsync(serviceName, callbackTarget: null, pool, cancellationToken), capacity: ConnectionPoolCapacity); // use the hub client logger for unexpected exceptions from devenv as well, so we have complete information in the log: services.GetService <IWorkspaceTelemetryService>()?.RegisterUnexpectedExceptionLogger(hubClient.Logger); _services = services; _hubClient = hubClient; _hostGroup = hostGroup; _endPoint = new RemoteEndPoint(stream, hubClient.Logger, incomingCallTarget: this); _endPoint.Disconnected += OnDisconnected; _endPoint.UnexpectedExceptionThrown += OnUnexpectedExceptionThrown; _endPoint.StartListening(); _assetStorage = services.GetRequiredService <ISolutionAssetStorageProvider>().AssetStorage; _serializer = services.GetRequiredService <ISerializerService>(); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var manager = workspaceServices.GetService<VisualStudioMetadataReferenceManager>(); Debug.Assert(manager != null); return new Service(manager); }
/// <summary> /// Signals that the extension has been loaded. /// The caller expects that <see cref="ActivateAsync(CancellationToken)"/> can be called /// immediately following the completion of this method. /// </summary> public async Task OnLoadedAsync() { // initialize things on UI thread await InitializeOnUIAsync().ConfigureAwait(false); // let platform know that they can start us await StartAsync.InvokeAsync(this, EventArgs.Empty).ConfigureAwait(false); async Task InitializeOnUIAsync() { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); // this doesn't attempt to solve our JTF and some services being not free-thread issue here, but // try to fix this particular deadlock issue only. we already have long discussion on // how we need to deal with JTF, Roslyn service requirements and VS services reality conflicting // each others. architectural fix should come from the result of that discussion. // Ensure the options persisters are loaded since we have to fetch options from the shell _lazyOptions.Select(o => o.Value); // experimentation service unfortunately uses JTF to jump to UI thread in certain cases // which can cause deadlock if 2 parties try to enable OOP from BG and then FG before // experimentation service tries to jump to UI thread. var experimentationService = _services.GetService <IExperimentationService>(); } }
public static async Task <Stream> RequestServiceAsync( HostWorkspaceServices services, HubClient client, RemoteServiceName serviceName, CancellationToken cancellationToken) { var isServerGC = RemoteHostOptions.IsServiceHubProcessServerGC(services); var isCoreClr = RemoteHostOptions.IsServiceHubProcessCoreClr(services); // Make sure we are on the thread pool to avoid UI thread dependencies if external code uses ConfigureAwait(true) await TaskScheduler.Default; var descriptor = new ServiceHub.Client.ServiceDescriptor(serviceName.ToString(isServerGC, isCoreClr)); try { return(await client.RequestServiceAsync(descriptor, cancellationToken).ConfigureAwait(false)); } catch (Exception e) when(ReportNonFatalWatson(e, cancellationToken)) { // TODO: Once https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1040692. // ServiceHub may throw non-cancellation exceptions if it is called after VS started to shut down, // even if our cancellation token is signaled. Cancel the operation and do not report an error in these cases. // // If ServiceHub did not throw non-cancellation exceptions when cancellation token is signaled, // we can assume that these exceptions indicate a failure and should be reported to the user. cancellationToken.ThrowIfCancellationRequested(); services.GetService <IErrorReportingService>()?.ShowRemoteHostCrashedErrorInfo(e); // TODO: Propagate the original exception (see https://github.com/dotnet/roslyn/issues/40476) throw new SoftCrashException("Unexpected exception from HubClient", e, cancellationToken); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { #if !DOTNET_BUILD_FROM_SOURCE var optionService = workspaceServices.GetRequiredService <IOptionService>(); var database = optionService.GetOption(StorageOptions.Database); switch (database) { case StorageDatabase.SQLite: var locationService = workspaceServices.GetService <IPersistentStorageLocationService>(); if (locationService != null) { if (UseInMemoryWriteCache(workspaceServices)) { return(new SQLite.v2.SQLitePersistentStorageService(locationService)); } else { return(new SQLite.v1.SQLitePersistentStorageService(locationService)); } } break; } #endif return(NoOpPersistentStorageService.Instance); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var manager = workspaceServices.GetService <VisualStudioMetadataReferenceManager>(); Debug.Assert(manager != null); return(new Service(manager)); }
/// <summary> /// Signals that the extension has been loaded. /// The caller expects that <see cref="ActivateAsync(CancellationToken)"/> can be called /// immediately following the completion of this method. /// </summary> public async Task OnLoadedAsync() { // initialize things on UI thread await InitializeOnUIAsync().ConfigureAwait(false); // this might get called before solution is fully loaded and before file is opened. // we delay our OOP start until then, but user might do vsstart before that. so we make sure we start OOP if // it is not running yet. multiple start is no-op ((RemoteHostClientServiceFactory.RemoteHostClientService)_services.GetService <IRemoteHostClientService>()).Enable(); // wait until remote host is available before let platform know that they can activate our LSP var client = await RemoteHostClient.TryGetClientAsync(_services, CancellationToken.None).ConfigureAwait(false); if (client == null) { // There is no OOP. either user turned it off, or process got killed. // We should have already gotten a gold bar + nfw already if the OOP is missing. // so just log telemetry here so we can connect the two with session explorer. Logger.Log(FunctionId.LanguageServer_OnLoadedFailed, KeyValueLogMessage.NoProperty); // don't ask platform to start LSP. // we shouldn't throw as the LSP client does not expect exceptions here. return; } // let platform know that they can start us await StartAsync.InvokeAsync(this, EventArgs.Empty).ConfigureAwait(false); async Task InitializeOnUIAsync() { await _threadingContext.JoinableTaskFactory.SwitchToMainThreadAsync(); // this doesn't attempt to solve our JTF and some services being not free-thread issue here, but // try to fix this particular deadlock issue only. we already have long discussion on // how we need to deal with JTF, Roslyn service requirements and VS services reality conflicting // each others. architectural fix should come from the result of that discussion. // Ensure the options persisters are loaded since we have to fetch options from the shell _lazyOptions.Select(o => o.Value); // experimentation service unfortunately uses JTF to jump to UI thread in certain cases // which can cause deadlock if 2 parties try to enable OOP from BG and then FG before // experimentation service tries to jump to UI thread. var experimentationService = _services.GetService <IExperimentationService>(); } }
public override void Dispose() { _services.GetService <IWorkspaceTelemetryService>()?.UnregisterUnexpectedExceptionLogger(_hubClient.Logger); _hubClient.Dispose(); _serviceBrokerClient.Dispose(); base.Dispose(); }
public static IChecksummedPersistentStorageService GetPersistentStorageService(this HostWorkspaceServices services, StorageDatabase database) { var configuration = services.GetRequiredService <IPersistentStorageConfiguration>(); switch (database) { case StorageDatabase.SQLite: return(services.GetService <ISQLiteStorageServiceFactory>()?.Create(configuration) ?? NoOpPersistentStorageService.GetOrThrow(configuration)); case StorageDatabase.CloudCache: return(services.GetService <ICloudCacheStorageServiceFactory>()?.Create(configuration) ?? NoOpPersistentStorageService.GetOrThrow(configuration)); default: return(NoOpPersistentStorageService.GetOrThrow(configuration)); } }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { if (_singleton == null) { var optionService = workspaceServices.GetService<IOptionService>(); System.Threading.Interlocked.CompareExchange(ref _singleton, new PersistentStorageService(optionService), null); } return _singleton; }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { if (_singleton == null) { var temporaryStorage = workspaceServices.GetService<ITemporaryStorageService>(); Interlocked.CompareExchange(ref _singleton, new VisualStudioMetadataReferenceManager(_serviceProvider, temporaryStorage), null); } return _singleton; }
public static bool IsServiceHubProcessServerGC(HostWorkspaceServices services) { if (!IsServiceHubProcess64Bit(services)) { return(false); } return(services.GetRequiredService <IOptionService>().GetOption(OOPServerGC) || services.GetService <IExperimentationService>()?.IsExperimentEnabled(WellKnownExperimentNames.OOPServerGC) == true); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { if (_singleton == null) { var optionService = workspaceServices.GetService <IOptionService>(); System.Threading.Interlocked.CompareExchange(ref _singleton, new PersistentStorageService(optionService), null); } return(_singleton); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { if (_singleton == null) { var temporaryStorage = workspaceServices.GetService <ITemporaryStorageService>(); Interlocked.CompareExchange(ref _singleton, new VisualStudioMetadataReferenceManager(_serviceProvider, temporaryStorage), null); } return(_singleton); }
private async Task PopulateWorkspaceFromDeferredProjectInfoAsync( CancellationToken cancellationToken) { // NOTE: We need to check cancellationToken after each await, in case the user has // already closed the solution. AssertIsForeground(); var componentModel = _serviceProvider.GetService(typeof(SComponentModel)) as IComponentModel; var workspaceProjectContextFactory = componentModel.GetService <IWorkspaceProjectContextFactory>(); var dte = _serviceProvider.GetService(typeof(EnvDTE.DTE)) as EnvDTE.DTE; var solutionConfig = (EnvDTE80.SolutionConfiguration2)dte.Solution.SolutionBuild.ActiveConfiguration; OutputToOutputWindow($"Getting project information - start"); var start = DateTimeOffset.UtcNow; var projectInfos = SpecializedCollections.EmptyReadOnlyDictionary <string, DeferredProjectInformation>(); // Note that `solutionConfig` may be null. For example: if the solution doesn't actually // contain any projects. if (solutionConfig != null) { // Capture the context so that we come back on the UI thread, and do the actual project creation there. var deferredProjectWorkspaceService = _workspaceServices.GetService <IDeferredProjectWorkspaceService>(); projectInfos = await deferredProjectWorkspaceService.GetDeferredProjectInfoForConfigurationAsync( $"{solutionConfig.Name}|{solutionConfig.PlatformName}", cancellationToken).ConfigureAwait(true); } AssertIsForeground(); cancellationToken.ThrowIfCancellationRequested(); OutputToOutputWindow($"Getting project information - done (took {DateTimeOffset.UtcNow - start})"); OutputToOutputWindow($"Creating projects - start"); start = DateTimeOffset.UtcNow; var targetPathsToProjectPaths = BuildTargetPathMap(projectInfos); var analyzerAssemblyLoader = _workspaceServices.GetRequiredService <IAnalyzerService>().GetLoader(); foreach (var projectFilename in projectInfos.Keys) { cancellationToken.ThrowIfCancellationRequested(); GetOrCreateProjectFromArgumentsAndReferences( workspaceProjectContextFactory, analyzerAssemblyLoader, projectFilename, projectInfos, targetPathsToProjectPaths); } OutputToOutputWindow($"Creating projects - done (took {DateTimeOffset.UtcNow - start})"); OutputToOutputWindow($"Pushing to workspace - start"); start = DateTimeOffset.UtcNow; FinishLoad(); OutputToOutputWindow($"Pushing to workspace - done (took {DateTimeOffset.UtcNow - start})"); }
private ServiceHubRemoteHostClient( HostWorkspaceServices services, RemoteProcessConfiguration configuration, ServiceBrokerClient serviceBrokerClient, HubClient hubClient, IRemoteServiceCallbackDispatcherProvider callbackDispatcherProvider) { // use the hub client logger for unexpected exceptions from devenv as well, so we have complete information in the log: services.GetService <IWorkspaceTelemetryService>()?.RegisterUnexpectedExceptionLogger(hubClient.Logger); _services = services; _serviceBrokerClient = serviceBrokerClient; _hubClient = hubClient; _callbackDispatcherProvider = callbackDispatcherProvider; _assetStorage = services.GetRequiredService <ISolutionAssetStorageProvider>().AssetStorage; _errorReportingService = services.GetService <IErrorReportingService>(); _shutdownCancellationService = services.GetService <IRemoteHostClientShutdownCancellationService>(); Configuration = configuration; }
public static Task <RemoteHostClient?> TryGetClientAsync(HostWorkspaceServices services, CancellationToken cancellationToken) { var service = services.GetService <IRemoteHostClientProvider>(); if (service == null) { return(SpecializedTasks.Null <RemoteHostClient>()); } return(service.TryGetRemoteHostClientAsync(cancellationToken)); }
private protected SerializerService(HostWorkspaceServices workspaceServices) { _workspaceServices = workspaceServices; _storageService = workspaceServices.GetRequiredService <ITemporaryStorageService>(); _textService = workspaceServices.GetRequiredService <ITextFactoryService>(); _analyzerLoaderProvider = workspaceServices.GetRequiredService <IAnalyzerAssemblyLoaderProvider>(); _documentationService = workspaceServices.GetService <IDocumentationProviderService>(); _lazyLanguageSerializationService = new ConcurrentDictionary <string, IOptionsSerializationService>(concurrencyLevel: 2, capacity: _workspaceServices.SupportedLanguages.Count()); }
public Serializer(HostWorkspaceServices workspaceServices) { _workspaceServices = workspaceServices; HostSerializationService = _workspaceServices.GetService <IReferenceSerializationService>(); _lazyLanguageSerializationService = new ConcurrentDictionary <string, IOptionsSerializationService>(concurrencyLevel: 2, capacity: _workspaceServices.SupportedLanguages.Count()); // TODO: figure out how to support Serialize like the way Deserialize work. tried once, couldn't figure out since // different kind of data require different number of data to serialize it. that is required so that we don't hold on // to any red node. }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { if (cache == null) { var service = workspaceServices.GetService<IOptionService>(); var newCache = CreateCache(service); Interlocked.CompareExchange(ref cache, newCache, null); } return cache; }
public override TWorkspaceService GetService <TWorkspaceService>() { var service = _workspaceServices.OfType <TWorkspaceService>().FirstOrDefault(); if (service == null) { // Fallback to default host services to resolve roslyn specific features. service = _fallbackServices.GetService <TWorkspaceService>(); } return(service); }
private static StorageDatabase GetDatabase(HostWorkspaceServices workspaceServices) { var experimentationService = workspaceServices.GetService <IExperimentationService>(); if (experimentationService?.IsExperimentEnabled(WellKnownExperimentNames.CloudCache) == true) { return(StorageDatabase.CloudCache); } var optionService = workspaceServices.GetRequiredService <IOptionService>(); return(optionService.GetOption(StorageOptions.Database)); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var options = workspaceServices.Workspace.Options; if (options.GetOption(ServiceComponentOnOffOptions.PackageSearch)) { // Only support package search in vs workspace. if (workspaceServices.Workspace is VisualStudioWorkspace) { return new PackageSearchService(_serviceProvider, workspaceServices.GetService<IPackageInstallerService>()); } } return new NullPackageSearchService(); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var workspace = workspaceServices.Workspace; if (workspace.Kind == WorkspaceKind.Host) { var cacheService = workspaceServices.GetService <IWorkspaceCacheService>(); if (cacheService != null) { cacheService.CacheFlushRequested += OnCacheFlushRequested; } } return(new ImportCompletionCacheService(_peItemsCache, _projectItemsCache)); }
private IPersistentStorageService GetPersistentStorageService(HostWorkspaceServices workspaceServices) { var optionService = workspaceServices.GetService <IOptionService>(); var database = optionService.GetOption(StorageOptions.Database); switch (database) { case StorageDatabase.SQLite: return(new SQLitePersistentStorageService(optionService, _solutionSizeTracker)); case StorageDatabase.None: default: return(NoOpPersistentStorageService.Instance); } }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var hostService = workspaceServices.GetService<IProjectCacheHostService>(); return new Service(hostService); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var generatedCodeService = workspaceServices.GetService<IGeneratedCodeRecognitionService>(); return new VisualStudioGenerateTypeOptionsService(generatedCodeService); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { var textFactory = workspaceServices.GetService<ITextFactoryService>(); return new TemporaryStorageService(textFactory); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { return new Service(workspaceServices.GetService<ITemporaryStorageService>()); }
public IWorkspaceService CreateService(HostWorkspaceServices workspaceServices) { return new Service(workspaceServices.GetService<IDocumentationProviderService>()); }