mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -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++) {
|
for (let i = 0; i < 5; i++) {
|
||||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||||
await connectionStore.removeRecentConnection(connectionProfile);
|
connectionStore.removeRecentConnection(connectionProfile);
|
||||||
const current = connectionStore.getRecentlyUsedConnections();
|
const current = connectionStore.getRecentlyUsedConnections();
|
||||||
assert.equal(current.length, 4 - i);
|
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.
|
// 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 more than one file was passed, only show the connection dialog error on one of them.
|
||||||
if (args._ && args._.length > 0) {
|
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 {
|
else {
|
||||||
// Default to showing new query
|
// 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)) {
|
if ((Array.isArray(content) && content.length > 0) || (!Array.isArray(content) && content)) {
|
||||||
// requestExecute expects a string for the code parameter
|
// requestExecute expects a string for the code parameter
|
||||||
content = Array.isArray(content) ? content.join('') : content;
|
content = Array.isArray(content) ? content.join('') : content;
|
||||||
let future = await kernel.requestExecute({
|
const future = kernel.requestExecute({
|
||||||
code: content,
|
code: content,
|
||||||
stop_on_error: true
|
stop_on_error: true
|
||||||
}, false);
|
}, false);
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ export class NotebookContexts {
|
|||||||
* @param kernelChangedArgs kernel changed args (both old and new kernel info)
|
* @param kernelChangedArgs kernel changed args (both old and new kernel info)
|
||||||
* @param profile current connection profile
|
* @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;
|
let connections: IDefaultConnection = this.DefaultContext;
|
||||||
if (!profile) {
|
if (!profile) {
|
||||||
if (!kernelChangedArgs || !kernelChangedArgs.newValue ||
|
if (!kernelChangedArgs || !kernelChangedArgs.newValue ||
|
||||||
@@ -61,7 +61,7 @@ export class NotebookContexts {
|
|||||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name && connProviderIds.length < 1) {
|
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name && connProviderIds.length < 1) {
|
||||||
return connections;
|
return connections;
|
||||||
} else {
|
} else {
|
||||||
connections = await this.getActiveContexts(connectionService, connProviderIds, profile);
|
connections = this.getActiveContexts(connectionService, connProviderIds, profile);
|
||||||
}
|
}
|
||||||
return connections;
|
return connections;
|
||||||
}
|
}
|
||||||
@@ -71,9 +71,9 @@ export class NotebookContexts {
|
|||||||
* @param apiWrapper ApiWrapper
|
* @param apiWrapper ApiWrapper
|
||||||
* @param profile current connection profile
|
* @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 defaultConnection: ConnectionProfile = NotebookContexts.DefaultContext.defaultConnection;
|
||||||
let activeConnections: ConnectionProfile[] = await connectionService.getActiveConnections();
|
let activeConnections: ConnectionProfile[] = connectionService.getActiveConnections();
|
||||||
if (activeConnections && activeConnections.length > 0) {
|
if (activeConnections && activeConnections.length > 0) {
|
||||||
activeConnections = activeConnections.filter(conn => conn.id !== '-1');
|
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> {
|
private async loadActiveContexts(kernelChangedArgs: nb.IKernelChangedArgs): Promise<void> {
|
||||||
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
if (kernelChangedArgs && kernelChangedArgs.newValue && kernelChangedArgs.newValue.name) {
|
||||||
let kernelDisplayName = this.getDisplayNameFromSpecName(kernelChangedArgs.newValue);
|
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();
|
this._contextsChangedEmitter.fire();
|
||||||
if (this.contexts.defaultConnection !== undefined && this.contexts.defaultConnection.serverName !== undefined && this.contexts.defaultConnection.title !== undefined) {
|
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);
|
await this.changeContext(this.contexts.defaultConnection.title, this.contexts.defaultConnection);
|
||||||
|
|||||||
@@ -455,7 +455,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||||||
if (!providerDescriptor.instance) {
|
if (!providerDescriptor.instance) {
|
||||||
// Await extension registration before awaiting provider registration
|
// Await extension registration before awaiting provider registration
|
||||||
try {
|
try {
|
||||||
await this._extensionService.whenInstalledExtensionsRegistered;
|
await this._extensionService.whenInstalledExtensionsRegistered();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,9 +17,10 @@
|
|||||||
"severity": "warn"
|
"severity": "warn"
|
||||||
},
|
},
|
||||||
"await-promise": {
|
"await-promise": {
|
||||||
"severity": "warn",
|
|
||||||
"options": [
|
"options": [
|
||||||
"Thenable"
|
"Thenable",
|
||||||
|
"Deferred",
|
||||||
|
"PromiseLike"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"use-isnan": {
|
"use-isnan": {
|
||||||
|
|||||||
Reference in New Issue
Block a user