mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
* Throwing error so that connection loading fails. * Fixing stuff * Fixing tests
This commit is contained in:
@@ -1368,16 +1368,22 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
});
|
});
|
||||||
|
|
||||||
await this._extensionService.activateByEvent(`onConnect:${connection.providerName}`);
|
await this._extensionService.activateByEvent(`onConnect:${connection.providerName}`);
|
||||||
|
if (this._providers.get(connection.providerName) === undefined) {
|
||||||
|
await this.handleUnsupportedProvider(connection.providerName);
|
||||||
|
throw new Error(nls.localize('connection.providerNotFound', "Connection provider '{0}' not found", connection.providerName));
|
||||||
|
}
|
||||||
return this._providers.get(connection.providerName).onReady.then((provider) => {
|
return this._providers.get(connection.providerName).onReady.then((provider) => {
|
||||||
provider.connect(uri, connectionInfo);
|
provider.connect(uri, connectionInfo);
|
||||||
this._onConnectRequestSent.fire();
|
this._onConnectRequestSent.fire();
|
||||||
// Connections are made per URI so while there may possibly be multiple editors with
|
// Connections are made per URI so while there may possibly be multiple editors with
|
||||||
// that URI they all share the same state
|
// that URI they all share the same state
|
||||||
const editor = this._editorService.findEditors(URI.parse(uri))[0]?.editor;
|
const editors = this._editorService.findEditors(URI.parse(uri));
|
||||||
// TODO make this generic enough to handle non-SQL languages too
|
if (editors && editors[0]?.editor) {
|
||||||
const language = editor instanceof QueryEditorInput && editor.state.isSqlCmdMode ? 'sqlcmd' : 'sql';
|
const editor = editors[0].editor;
|
||||||
this.doChangeLanguageFlavor(uri, language, connection.providerName);
|
// TODO make this generic enough to handle non-SQL languages too
|
||||||
|
const language = editor instanceof QueryEditorInput && editor.state.isSqlCmdMode ? 'sqlcmd' : 'sql';
|
||||||
|
this.doChangeLanguageFlavor(uri, language, connection.providerName);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -1644,7 +1650,11 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
|||||||
});
|
});
|
||||||
|
|
||||||
// send connection request
|
// send connection request
|
||||||
self.sendConnectRequest(connection, uri).catch((e) => this._logService.error(e));
|
self.sendConnectRequest(connection, uri).catch((e) => {
|
||||||
|
this._logService.error(e);
|
||||||
|
this._connectionStatusManager.removeConnection(uri);
|
||||||
|
reject(e);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,10 @@ export class TreeSelectionHandler {
|
|||||||
}
|
}
|
||||||
const selectedNode = selection[0];
|
const selectedNode = selection[0];
|
||||||
if (selectedNode instanceof ConnectionProfile && !capabilitiesService.getCapabilities(selectedNode.providerName)) {
|
if (selectedNode instanceof ConnectionProfile && !capabilitiesService.getCapabilities(selectedNode.providerName)) {
|
||||||
connectionManagementService.handleUnsupportedProvider(selectedNode.providerName).catch(onUnexpectedError);
|
// Async tree handles unsupported providers through the connection management service
|
||||||
|
if (!(tree instanceof AsyncServerTree)) {
|
||||||
|
connectionManagementService.handleUnsupportedProvider(selectedNode.providerName).catch(onUnexpectedError);
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user