mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-14 17:22:20 -05:00
Introduce connection API (#598)
Including getCurrentConnection, getActiveConnections, and getCredentials
This commit is contained in:
@@ -28,6 +28,7 @@ import { ExtHostConfiguration } from 'vs/workbench/api/node/extHostConfiguration
|
||||
import { ExtHostModalDialogs } from 'sql/workbench/api/node/extHostModalDialog';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IExtensionApiFactory } from 'vs/workbench/api/node/extHost.api.impl';
|
||||
import { ExtHostConnectionManagement } from 'sql/workbench/api/node/extHostConnectionManagement';
|
||||
|
||||
export interface ISqlExtensionApiFactory {
|
||||
vsCodeFactory(extension: IExtensionDescription): typeof vscode;
|
||||
@@ -49,6 +50,7 @@ export function createApiFactory(
|
||||
|
||||
// Addressable instances
|
||||
const extHostAccountManagement = threadService.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(threadService));
|
||||
const extHostConnectionManagement = threadService.set(SqlExtHostContext.ExtHostConnectionManagement, new ExtHostConnectionManagement(threadService));
|
||||
const extHostCredentialManagement = threadService.set(SqlExtHostContext.ExtHostCredentialManagement, new ExtHostCredentialManagement(threadService));
|
||||
const extHostDataProvider = threadService.set(SqlExtHostContext.ExtHostDataProtocol, new ExtHostDataProtocol(threadService));
|
||||
const extHostSerializationProvider = threadService.set(SqlExtHostContext.ExtHostSerializationProvider, new ExtHostSerializationProvider(threadService));
|
||||
@@ -74,6 +76,19 @@ export function createApiFactory(
|
||||
}
|
||||
};
|
||||
|
||||
// namespace: connection
|
||||
const connection: typeof data.connection = {
|
||||
getActiveConnections(): Thenable<data.connection.Connection[]> {
|
||||
return extHostConnectionManagement.$getActiveConnections();
|
||||
},
|
||||
getCurrentConnection(): Thenable<data.connection.Connection> {
|
||||
return extHostConnectionManagement.$getCurrentConnection();
|
||||
},
|
||||
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||
return extHostConnectionManagement.$getCredentials(connectionId);
|
||||
}
|
||||
};
|
||||
|
||||
// namespace: credentials
|
||||
const credentials: typeof data.credentials = {
|
||||
registerProvider(provider: data.CredentialProvider): vscode.Disposable {
|
||||
@@ -246,6 +261,7 @@ export function createApiFactory(
|
||||
|
||||
return {
|
||||
accounts,
|
||||
connection,
|
||||
credentials,
|
||||
resources,
|
||||
serialization,
|
||||
|
||||
Reference in New Issue
Block a user