Files
azuredatastudio/src/sql/workbench/api/browser/mainThreadWorkspace.ts
Kim Santiago 9cfba8e8e0 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
2021-03-04 13:40:13 -08:00

41 lines
1.9 KiB
TypeScript

/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { SqlMainContext, MainThreadWorkspaceShape } from 'sql/workbench/api/common/sqlExtHost.protocol';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { Disposable } from 'vs/base/common/lifecycle';
import { URI } from 'vs/base/common/uri';
import { IWorkspaceEditingService } from 'vs/workbench/services/workspaces/common/workspaceEditing';
import { IWorkbenchEnvironmentService } from 'vs/workbench/services/environment/common/environmentService';
@extHostNamedCustomer(SqlMainContext.MainThreadWorkspace)
export class MainThreadWorkspace extends Disposable implements MainThreadWorkspaceShape {
constructor(
extHostContext: IExtHostContext,
@IWorkspaceEditingService private workspaceEditingService: IWorkspaceEditingService,
@IWorkbenchEnvironmentService protected readonly environmentService: IWorkbenchEnvironmentService
) {
super();
}
$createAndEnterWorkspace(folder: URI, workspaceFile?: URI): Promise<void> {
folder = URI.revive(folder);
workspaceFile = URI.revive(workspaceFile);
return this.workspaceEditingService.createAndEnterWorkspace([{ uri: folder }], workspaceFile);
}
$enterWorkspace(workspaceFile: URI): Promise<void> {
workspaceFile = URI.revive(workspaceFile);
return this.workspaceEditingService.enterWorkspace(workspaceFile);
}
$saveAndEnterWorkspace(workspaceFile: URI): Promise<void> {
workspaceFile = URI.revive(workspaceFile);
return this.workspaceEditingService.saveAndEnterWorkspace(workspaceFile);
}
}