From 1debaf87082923465f92d74ddb224939592929ce Mon Sep 17 00:00:00 2001 From: CyrusNajmabadi Date: Mon, 3 Apr 2017 16:35:46 -0700 Subject: [PATCH] Enable OOP server to use sqlite storage provider. --- .../Core/Portable/NavigateTo/NavigateToOptions.cs | 2 +- ...VisualStudioProjectTracker.WorkspaceHostState.cs | 2 +- .../Core/Next/Remote/ServiceHubRemoteHostClient.cs | 13 +++++++++++++ .../Portable/FindSymbols/SymbolFinderOptions.cs | 2 +- .../RemotePersistentStorageLocationService.cs | 3 +-- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/Features/Core/Portable/NavigateTo/NavigateToOptions.cs b/src/Features/Core/Portable/NavigateTo/NavigateToOptions.cs index 82cf6e30612..bd11de7326e 100644 --- a/src/Features/Core/Portable/NavigateTo/NavigateToOptions.cs +++ b/src/Features/Core/Portable/NavigateTo/NavigateToOptions.cs @@ -9,7 +9,7 @@ internal static class NavigateToOptions private const string LocalRegistryPath = @"Roslyn\Features\NavigateTo\"; public static readonly Option OutOfProcessAllowed = new Option( - nameof(NavigateToOptions), nameof(OutOfProcessAllowed), defaultValue: false, + nameof(NavigateToOptions), nameof(OutOfProcessAllowed), defaultValue: true, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(OutOfProcessAllowed))); } } \ No newline at end of file diff --git a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.WorkspaceHostState.cs b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.WorkspaceHostState.cs index a8fee3b6506..eb06df01665 100644 --- a/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.WorkspaceHostState.cs +++ b/src/VisualStudio/Core/Def/Implementation/ProjectSystem/VisualStudioProjectTracker.WorkspaceHostState.cs @@ -139,7 +139,7 @@ internal void SolutionClosed() var solutionInfo = SolutionInfo.Create(id, version.Value, solutionFilePath, projects: projectInfos); - this.Host.OnSolutionAdded(solutionInfo); + _tracker.NotifyWorkspaceHosts(host => host.OnSolutionAdded(solutionInfo)); _solutionAdded = true; } diff --git a/src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs b/src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs index 359915c9bb1..ff1a0ffe7a8 100644 --- a/src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs +++ b/src/VisualStudio/Core/Next/Remote/ServiceHubRemoteHostClient.cs @@ -74,6 +74,10 @@ private static async Task RegisterWorkspaceHostAsync(Workspace workspace, Remote // don't block UI thread while initialize workspace host var host = new WorkspaceHost(vsWorkspace, client); + + // Initialize the remote side with whatever data we have currently for the workspace. + // As workspace changes happen, this host will get notified, and it can remote those + // changes appropriately over to the remote size. await host.InitializeAsync().ConfigureAwait(false); // RegisterWorkspaceHost is required to be called from UI thread so push the code @@ -81,6 +85,15 @@ private static async Task RegisterWorkspaceHostAsync(Workspace workspace, Remote await Task.Factory.SafeStartNew(() => { vsWorkspace.GetProjectTrackerAndInitializeIfNecessary(Shell.ServiceProvider.GlobalProvider).RegisterWorkspaceHost(host); + + // There may have been notifications fired by the workspace between the time we + // were created and now when we let it know about us. Because of that, we need + // to do another initialization pass to make sure all the current workpsace + // state is pushed over to the remote side. + // + // We can do this in a fire and forget manner. We don't want to block the UI + // thread while we're pushing this data over. + Task.Run(() => host.InitializeAsync()); }, CancellationToken.None, ForegroundThreadAffinitizedObject.CurrentForegroundThreadData.TaskScheduler).ConfigureAwait(false); } diff --git a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinderOptions.cs b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinderOptions.cs index 19b22d74be9..aec655814cd 100644 --- a/src/Workspaces/Core/Portable/FindSymbols/SymbolFinderOptions.cs +++ b/src/Workspaces/Core/Portable/FindSymbols/SymbolFinderOptions.cs @@ -9,7 +9,7 @@ internal static class SymbolFinderOptions private const string LocalRegistryPath = @"Roslyn\Features\SymbolFinder\"; public static readonly Option OutOfProcessAllowed = new Option( - nameof(SymbolFinderOptions), nameof(OutOfProcessAllowed), defaultValue: false, + nameof(SymbolFinderOptions), nameof(OutOfProcessAllowed), defaultValue: true, storageLocations: new LocalUserProfileStorageLocation(LocalRegistryPath + nameof(OutOfProcessAllowed))); } } \ No newline at end of file diff --git a/src/Workspaces/Remote/Core/Storage/RemotePersistentStorageLocationService.cs b/src/Workspaces/Remote/Core/Storage/RemotePersistentStorageLocationService.cs index aef37e1a510..17f59f3919f 100644 --- a/src/Workspaces/Remote/Core/Storage/RemotePersistentStorageLocationService.cs +++ b/src/Workspaces/Remote/Core/Storage/RemotePersistentStorageLocationService.cs @@ -44,8 +44,7 @@ public static void UpdateStorageLocation(SolutionId id, string storageLocation) } else { - // Store the esent database in a different location for the out of proc server. - _idToStorageLocation[id] = Path.Combine(storageLocation, "Server"); + _idToStorageLocation[id] = storageLocation; } } } -- GitLab