Reload ADS when data-workspace extension opens a workspace (#14540)

* reload ADS when workspace is entered

* move reloading so that reload also happens for file save workspace as commands

* fix build error
This commit is contained in:
Kim Santiago
2021-03-04 13:40:13 -08:00
committed by GitHub
parent 69a35b38b2
commit 9cfba8e8e0
3 changed files with 6 additions and 16 deletions

View File

@@ -15,8 +15,8 @@ export const AllProjectTypes = localize('AllProjectTypes', "All Project Types");
export const ProviderNotFoundForProjectTypeError = (projectType: string): string => { return localize('UnknownProjectTypeError', "No provider was found for project type with id: '{0}'", projectType); };
export const WorkspaceRequiredMessage = localize('dataworkspace.workspaceRequiredMessage', "A workspace is required in order to use the project feature.");
export const OpenWorkspace = localize('dataworkspace.openWorkspace', "Open Workspace…");
export const CreateWorkspaceConfirmation = localize('dataworkspace.createWorkspaceConfirmation', "A workspace will be created and opened in order to open project. The Extension Host will restart and if there is a folder currently open, it will be closed.");
export const EnterWorkspaceConfirmation = localize('dataworkspace.enterWorkspaceConfirmation', "To open this workspace, the Extension Host will restart and if there is a workspace or folder currently open, it will be closed.");
export const CreateWorkspaceConfirmation = localize('dataworkspace.createWorkspaceConfirmation', "A workspace will be created and opened in order to open project. Azure Data Studio will restart and if there is a folder currently open, it will be closed.");
export const EnterWorkspaceConfirmation = localize('dataworkspace.enterWorkspaceConfirmation', "To open this workspace, Azure Data Studio will restart. If there is a workspace or folder currently open, it will be closed.");
export const WorkspaceContainsNotAddedProjects = localize('dataworkspace.workspaceContainsNotAddedProjects', "The current workspace contains one or more projects that have not been added to the workspace. Use the 'Open existing' dialog to add projects to the projects pane.");
export const LaunchOpenExisitingDialog = localize('dataworkspace.launchOpenExistingDialog', "Launch Open existing dialog");
export const DoNotShowAgain = localize('dataworkspace.doNotShowAgain', "Do not show again");

View File

@@ -17,7 +17,7 @@ export class MainThreadWorkspace extends Disposable implements MainThreadWorkspa
constructor(
extHostContext: IExtHostContext,
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
@IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService,
@IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService
) {
super();
}
@@ -37,5 +37,4 @@ export class MainThreadWorkspace extends Disposable implements MainThreadWorkspa
workspaceFile = URI.revive(workspaceFile);
return this.workspaceEditingService.saveAndEnterWorkspace(workspaceFile);
}
}

View File

@@ -11,7 +11,6 @@ import { IJSONEditingService } from 'vs/workbench/services/configuration/common/
import { IWorkspacesService, isUntitledWorkspace, IWorkspaceIdentifier, hasWorkspaceFileExtension } from 'vs/platform/workspaces/common/workspaces';
import { WorkspaceService } from 'vs/workbench/services/configuration/browser/configurationService';
import { IStorageService } from 'vs/platform/storage/common/storage';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IBackupFileService } from 'vs/workbench/services/backup/common/backup';
import { ICommandService } from 'vs/platform/commands/common/commands';
import { basename } from 'vs/base/common/resources';
@@ -42,7 +41,6 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi
@INativeHostService private nativeHostService: INativeHostService,
@IConfigurationService configurationService: IConfigurationService,
@IStorageService private storageService: IStorageService,
@IExtensionService private extensionService: IExtensionService,
@IBackupFileService private backupFileService: IBackupFileService,
@INotificationService notificationService: INotificationService,
@ICommandService commandService: ICommandService,
@@ -176,16 +174,9 @@ export class NativeWorkspaceEditingService extends AbstractWorkspaceEditingServi
}
}
// TODO@aeschli: workaround until restarting works
if (this.environmentService.remoteAuthority) {
this.hostService.reload();
}
// Restart the extension host: entering a workspace means a new location for
// storage and potentially a change in the workspace.rootPath property.
else {
this.extensionService.restartExtensionHost();
}
// {{SQL CARBON EDIT}} - reload instead of restarting extension host because there is state maintained in the core
// that gets lost when the extension host is restarted
this.hostService.reload();
}
private migrateStorage(toWorkspace: IWorkspaceIdentifier): Promise<void> {