mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Add no-floating-promises for mssql extension (#16956)
This commit is contained in:
@@ -173,15 +173,15 @@ export abstract class ProgressCommand extends Command {
|
||||
|
||||
export function registerSearchServerCommand(appContext: AppContext): void {
|
||||
vscode.commands.registerCommand('mssql.searchServers', () => {
|
||||
vscode.window.showInputBox({
|
||||
void vscode.window.showInputBox({
|
||||
placeHolder: localize('mssql.searchServers', "Search Server Names")
|
||||
}).then((stringSearch) => {
|
||||
if (stringSearch) {
|
||||
vscode.commands.executeCommand('registeredServers.searchServer', (stringSearch));
|
||||
void vscode.commands.executeCommand('registeredServers.searchServer', (stringSearch));
|
||||
}
|
||||
});
|
||||
});
|
||||
vscode.commands.registerCommand('mssql.clearSearchServerResult', () => {
|
||||
vscode.commands.executeCommand('registeredServers.clearSearchServerResult');
|
||||
void vscode.commands.executeCommand('registeredServers.clearSearchServerResult');
|
||||
});
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ class HdfsFileSource implements IFileSource {
|
||||
'########################### ' + localize('maxSizeNotice', "NOTICE: This file has been truncated at {0} for preview. ", bytes(maxBytes)) + '############################### \r\n' +
|
||||
'#################################################################################################################### \r\n';
|
||||
data.splice(0, 0, Buffer.from(previewNote, 'utf-8'));
|
||||
vscode.window.showWarningMessage(localize('maxSizeReached', "The file has been truncated at {0} for preview.", bytes(maxBytes)));
|
||||
void vscode.window.showWarningMessage(localize('maxSizeReached', "The file has been truncated at {0} for preview.", bytes(maxBytes)));
|
||||
resolve(Buffer.concat(data));
|
||||
} else {
|
||||
reject(error);
|
||||
|
||||
@@ -94,7 +94,7 @@ export class UploadFilesCommand extends ProgressCommand {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('uploadError', "Error uploading files: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -125,7 +125,7 @@ export class UploadFilesCommand extends ProgressCommand {
|
||||
let children: IFile[] = await Promise.all((await fs.readdir(file.path))
|
||||
.map(childFileName => joinHdfsPath(file.path, childFileName))
|
||||
.map(this.mapPathsToFiles()));
|
||||
this.writeFiles(children, subFolder, cancelToken);
|
||||
await this.writeFiles(children, subFolder, cancelToken);
|
||||
} else {
|
||||
await folderNode.writeFile(file);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ export class MkDirCommand extends ProgressCommand {
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('mkDirError', "Error on making directory: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -215,10 +215,10 @@ export class DeleteFilesCommand extends Command {
|
||||
await oeNodeToRefresh.refresh();
|
||||
}
|
||||
} else {
|
||||
vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
void vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('deleteError', "Error on deleting files: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -276,10 +276,10 @@ export class SaveFileCommand extends ProgressCommand {
|
||||
() => vscode.window.showInformationMessage(localize('saveCanceled', "Save operation was canceled")));
|
||||
}
|
||||
} else {
|
||||
vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
void vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('saveError', "Error on saving file: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -330,10 +330,10 @@ export class PreviewFileCommand extends ProgressCommand {
|
||||
localize('previewing', "Generating preview"),
|
||||
false);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
void vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('previewError', "Error on previewing file: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -385,12 +385,12 @@ export class CopyPathCommand extends Command {
|
||||
let node = await getNode<HdfsFileSourceNode>(context, this.appContext);
|
||||
if (node) {
|
||||
let path = node.hdfsPath;
|
||||
vscode.env.clipboard.writeText(path);
|
||||
void vscode.env.clipboard.writeText(path);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
void vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('copyPathError', "Error on copying path: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
@@ -408,10 +408,10 @@ export class ManageAccessCommand extends Command {
|
||||
if (node) {
|
||||
new ManageAccessDialog(node.hdfsPath, await node.getFileSource()).openDialog();
|
||||
} else {
|
||||
vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
void vscode.window.showErrorMessage(LocalizedConstants.msgMissingNodeContext);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(
|
||||
void vscode.window.showErrorMessage(
|
||||
localize('manageAccessError', "An unexpected error occurred while opening the Manage Access dialog: {0}", utils.getErrorMessage(err, true)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,11 +82,11 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
||||
} else {
|
||||
setTimeout(() => {
|
||||
|
||||
// Running after promise resolution as we need the Ops Studio-side map to have been updated
|
||||
// Running after promise resolution as we need the ADS-side map to have been updated
|
||||
// Intentionally not awaiting or catching errors.
|
||||
// Any failure in startExpansion should be emitted in the expand complete result
|
||||
// We want this to be async and ideally return true before it completes
|
||||
this.startExpansion(session, nodeInfo, isRefresh);
|
||||
this.startExpansion(session, nodeInfo, isRefresh).catch(err => console.log('Error expanding Object Explorer Node ', err));
|
||||
}, 10);
|
||||
}
|
||||
return true;
|
||||
@@ -181,14 +181,14 @@ export class MssqlObjectExplorerNodeProvider extends ProviderBase implements azd
|
||||
}
|
||||
|
||||
notifyNodeChanged(node: TreeNode): void {
|
||||
this.notifyNodeChangesAsync(node);
|
||||
void this.notifyNodeChangesAsync(node);
|
||||
}
|
||||
|
||||
private async notifyNodeChangesAsync(node: TreeNode): Promise<void> {
|
||||
try {
|
||||
let session = this.getSqlClusterSessionForNode(node);
|
||||
if (!session) {
|
||||
vscode.window.showErrorMessage(localize('sessionNotFound', "Session for node {0} does not exist", node.nodePathValue));
|
||||
void vscode.window.showErrorMessage(localize('sessionNotFound', "Session for node {0} does not exist", node.nodePathValue));
|
||||
} else {
|
||||
let nodeInfo = node.getNodeInfo();
|
||||
let expandInfo: azdata.ExpandNodeInfo = {
|
||||
|
||||
Reference in New Issue
Block a user