mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-13 17:22:15 -05:00
Fix all await-promise tslint errors (#7530)
* Fix all await-promise tslint errors * Remove unnecessary await
This commit is contained in:
@@ -477,7 +477,7 @@ suite('ConnectionStore', () => {
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||
await connectionStore.removeRecentConnection(connectionProfile);
|
||||
connectionStore.removeRecentConnection(connectionProfile);
|
||||
const current = connectionStore.getRecentlyUsedConnections();
|
||||
assert.equal(current.length, 4 - i);
|
||||
}
|
||||
|
||||
@@ -134,7 +134,7 @@ export class CommandLineWorkbenchContribution implements IWorkbenchContribution,
|
||||
// we want to connect the given profile to to it.
|
||||
// If more than one file was passed, only show the connection dialog error on one of them.
|
||||
if (args._ && args._.length > 0) {
|
||||
await args._.forEach((f, i) => this.processFile(URI.file(f).toString(), profile, i === 0));
|
||||
await Promise.all(args._.map((f, i) => this.processFile(URI.file(f).toString(), profile, i === 0)));
|
||||
}
|
||||
else {
|
||||
// Default to showing new query
|
||||
|
||||
@@ -329,7 +329,7 @@ export class CellModel implements ICellModel {
|
||||
if ((Array.isArray(content) && content.length > 0) || (!Array.isArray(content) && content)) {
|
||||
// requestExecute expects a string for the code parameter
|
||||
content = Array.isArray(content) ? content.join('') : content;
|
||||
let future = await kernel.requestExecute({
|
||||
const future = kernel.requestExecute({
|
||||
code: content,
|
||||
stop_on_error: true
|
||||
}, false);
|
||||
|
||||
@@ -49,7 +49,7 @@ export class NotebookContexts {
|
||||
* @param kernelChangedArgs kernel changed args (both old and new kernel info)
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getContextsForKernel(connectionService: IConnectionManagementService, connProviderIds: string[], kernelChangedArgs?: nb.IKernelChangedArgs, profile?: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
public static getContextsForKernel(connectionService: IConnectionManagementService, connProviderIds: string[], kernelChangedArgs?: nb.IKernelChangedArgs, profile?: IConnectionProfile): IDefaultConnection {
|
||||
let connections: IDefaultConnection = this.DefaultContext;
|
||||
if (!profile) {
|
||||
if (!kernelChangedArgs || !kernelChangedArgs.newValue ||
|
||||
@@ -61,7 +61,7 @@ export class NotebookContexts {
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name && connProviderIds.length < 1) {
|
||||
return connections;
|
||||
} else {
|
||||
connections = await this.getActiveContexts(connectionService, connProviderIds, profile);
|
||||
connections = this.getActiveContexts(connectionService, connProviderIds, profile);
|
||||
}
|
||||
return connections;
|
||||
}
|
||||
@@ -71,9 +71,9 @@ export class NotebookContexts {
|
||||
* @param apiWrapper ApiWrapper
|
||||
* @param profile current connection profile
|
||||
*/
|
||||
public static async getActiveContexts(connectionService: IConnectionManagementService, connProviderIds: string[], profile: IConnectionProfile): Promise<IDefaultConnection> {
|
||||
public static getActiveContexts(connectionService: IConnectionManagementService, connProviderIds: string[], profile: IConnectionProfile): IDefaultConnection {
|
||||
let defaultConnection: ConnectionProfile = NotebookContexts.DefaultContext.defaultConnection;
|
||||
let activeConnections: ConnectionProfile[] = await connectionService.getActiveConnections();
|
||||
let activeConnections: ConnectionProfile[] = connectionService.getActiveConnections();
|
||||
if (activeConnections && activeConnections.length > 0) {
|
||||
activeConnections = activeConnections.filter(conn => conn.id !== '-1');
|
||||
}
|
||||
|
||||
@@ -840,7 +840,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
private async loadActiveContexts(kernelChangedArgs: nb.IKernelChangedArgs): Promise<void> {
|
||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
||||
let kernelDisplayName = this.getDisplayNameFromSpecName(kernelChangedArgs.newValue);
|
||||
this._activeContexts = await NotebookContexts.getContextsForKernel(this._notebookOptions.connectionService, this.getApplicableConnectionProviderIds(kernelDisplayName), kernelChangedArgs, this.connectionProfile);
|
||||
this._activeContexts = NotebookContexts.getContextsForKernel(this._notebookOptions.connectionService, this.getApplicableConnectionProviderIds(kernelDisplayName), kernelChangedArgs, this.connectionProfile);
|
||||
this._contextsChangedEmitter.fire();
|
||||
if (this.contexts.defaultConnection !== undefined && this.contexts.defaultConnection.serverName !== undefined && this.contexts.defaultConnection.title !== undefined) {
|
||||
await this.changeContext(this.contexts.defaultConnection.title, this.contexts.defaultConnection);
|
||||
|
||||
@@ -455,7 +455,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
||||
if (!providerDescriptor.instance) {
|
||||
// Await extension registration before awaiting provider registration
|
||||
try {
|
||||
await this._extensionService.whenInstalledExtensionsRegistered;
|
||||
await this._extensionService.whenInstalledExtensionsRegistered();
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
|
||||
@@ -17,9 +17,10 @@
|
||||
"severity": "warn"
|
||||
},
|
||||
"await-promise": {
|
||||
"severity": "warn",
|
||||
"options": [
|
||||
"Thenable"
|
||||
"Thenable",
|
||||
"Deferred",
|
||||
"PromiseLike"
|
||||
]
|
||||
},
|
||||
"use-isnan": {
|
||||
|
||||
Reference in New Issue
Block a user