mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-14 12:08:36 -05:00
Fix some unhandled promise lint errors (#16924)
This commit is contained in:
@@ -126,7 +126,7 @@ export class BookModel {
|
||||
}
|
||||
|
||||
if (await fs.pathExists(this._tableOfContentsPath)) {
|
||||
vscode.commands.executeCommand('setContext', 'bookOpened', true);
|
||||
void vscode.commands.executeCommand('setContext', 'bookOpened', true);
|
||||
this.watchTOC();
|
||||
} else {
|
||||
this._errorMessage = loc.missingTocError;
|
||||
@@ -322,7 +322,7 @@ export class BookModel {
|
||||
treeItems.push(markdown);
|
||||
} else {
|
||||
this._errorMessage = loc.missingFileError(sections[i].title, book.title);
|
||||
vscode.window.showErrorMessage(this._errorMessage);
|
||||
void vscode.window.showErrorMessage(this._errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ export class BookPinManager implements IBookPinManager {
|
||||
|
||||
setPinnedSectionContext(): void {
|
||||
if (getPinnedNotebooks().length > 0) {
|
||||
vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, constants.showPinnedBooksContextKey, true);
|
||||
void vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, constants.showPinnedBooksContextKey, true);
|
||||
} else {
|
||||
vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, constants.showPinnedBooksContextKey, false);
|
||||
void vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, constants.showPinnedBooksContextKey, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,7 @@ export class BookTocManager implements IBookTocManager {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
vscode.window.showWarningMessage(loc.msgCreateBookWarningMsg(content));
|
||||
void vscode.window.showWarningMessage(loc.msgCreateBookWarningMsg(content));
|
||||
}
|
||||
}
|
||||
return toc;
|
||||
@@ -132,7 +132,7 @@ export class BookTocManager implements IBookTocManager {
|
||||
}
|
||||
this.movedFiles.set(src, path.join(newFileName.concat(' - ', counter.toString())).concat(path.parse(dest).ext));
|
||||
await fs.move(src, path.join(newFileName.concat(' - ', counter.toString())).concat(path.parse(dest).ext), { overwrite: true });
|
||||
vscode.window.showInformationMessage(loc.duplicateFileError(path.parse(dest).base, src, newFileName.concat(' - ', counter.toString())));
|
||||
void vscode.window.showInformationMessage(loc.duplicateFileError(path.parse(dest).base, src, newFileName.concat(' - ', counter.toString())));
|
||||
return newFileName.concat(' - ', counter.toString());
|
||||
}
|
||||
|
||||
@@ -424,7 +424,7 @@ export class BookTocManager implements IBookTocManager {
|
||||
}
|
||||
} catch (e) {
|
||||
await this.recovery();
|
||||
vscode.window.showErrorMessage(loc.editBookError(element.book.contentPath, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.editBookError(element.book.contentPath, e instanceof Error ? e.message : e));
|
||||
} finally {
|
||||
try {
|
||||
await this._targetBook.reinitializeContents();
|
||||
|
||||
@@ -106,7 +106,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
}
|
||||
|
||||
set _visitedNotebooks(value: string[]) {
|
||||
this._extensionContext.globalState.update(constants.visitedNotebooksMementoKey, value);
|
||||
void this._extensionContext.globalState.update(constants.visitedNotebooksMementoKey, value);
|
||||
}
|
||||
|
||||
trustBook(bookTreeItem?: BookTreeItem): void {
|
||||
@@ -125,9 +125,9 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
});
|
||||
}
|
||||
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.TrustNotebook);
|
||||
vscode.window.showInformationMessage(loc.msgBookTrusted);
|
||||
void vscode.window.showInformationMessage(loc.msgBookTrusted);
|
||||
} else {
|
||||
vscode.window.showInformationMessage(loc.msgBookAlreadyTrusted);
|
||||
void vscode.window.showInformationMessage(loc.msgBookAlreadyTrusted);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
if (index !== -1) {
|
||||
this.books.splice(index, 1);
|
||||
}
|
||||
vscode.window.showErrorMessage(loc.openFileError(bookPath, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.openFileError(bookPath, e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
}
|
||||
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.CloseBook);
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(loc.closeBookError(book.root, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.closeBookError(book.root, e instanceof Error ? e.message : e));
|
||||
} finally {
|
||||
// remove watch on toc file.
|
||||
if (deletedBook && !deletedBook.isNotebook) {
|
||||
@@ -388,7 +388,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
}
|
||||
TelemetryReporter.sendActionEvent(BookTelemetryView, NbTelemetryActions.OpenNotebookFromBook);
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(loc.openNotebookError(resource, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.openNotebookError(resource, e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -490,9 +490,9 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
|
||||
openMarkdown(resource: string): void {
|
||||
try {
|
||||
vscode.commands.executeCommand('markdown.showPreview', vscode.Uri.file(resource));
|
||||
void vscode.commands.executeCommand('markdown.showPreview', vscode.Uri.file(resource));
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(loc.openMarkdownError(resource, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.openMarkdownError(resource, e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -507,7 +507,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
initialDirtyState: false
|
||||
});
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(loc.openUntitledNotebookError(resource, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.openUntitledNotebookError(resource, e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -547,7 +547,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
this.books.splice(untitledBookIndex, 1);
|
||||
this.currentBook = undefined;
|
||||
this._onDidChangeTreeData.fire(undefined);
|
||||
vscode.commands.executeCommand('bookTreeView.openBook', destinationUri.fsPath, false, undefined);
|
||||
void vscode.commands.executeCommand('bookTreeView.openBook', destinationUri.fsPath, false, undefined);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -561,12 +561,12 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
} else if (this.currentBook && !this.currentBook.isNotebook) {
|
||||
folderToSearch = path.join(this.currentBook.contentFolderPath);
|
||||
} else {
|
||||
vscode.window.showErrorMessage(loc.noBooksSelectedError);
|
||||
void vscode.window.showErrorMessage(loc.noBooksSelectedError);
|
||||
}
|
||||
|
||||
if (folderToSearch) {
|
||||
let filesToIncludeFiltered = path.join(folderToSearch, '**', '*.md') + ',' + path.join(folderToSearch, '**', '*.ipynb');
|
||||
vscode.commands.executeCommand('workbench.action.findInFiles', { filesToInclude: filesToIncludeFiltered, query: '' });
|
||||
void vscode.commands.executeCommand('workbench.action.findInFiles', { filesToInclude: filesToIncludeFiltered, query: '' });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -659,7 +659,7 @@ export class BookTreeViewProvider implements vscode.TreeDataProvider<BookTreeIte
|
||||
try {
|
||||
await vscode.env.openExternal(vscode.Uri.parse(resource));
|
||||
} catch (e) {
|
||||
vscode.window.showErrorMessage(loc.openExternalLinkError(resource, e instanceof Error ? e.message : e));
|
||||
void vscode.window.showErrorMessage(loc.openExternalLinkError(resource, e instanceof Error ? e.message : e));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ export class GitHubRemoteBook extends RemoteBook {
|
||||
}
|
||||
await fs.promises.unlink(remoteBookFullPath.fsPath);
|
||||
this.outputChannel.appendLine(loc.msgRemoteBookDownloadComplete);
|
||||
vscode.commands.executeCommand('notebook.command.openNotebookFolder', this.localPath.fsPath, undefined, true);
|
||||
void vscode.commands.executeCommand('notebook.command.openNotebookFolder', this.localPath.fsPath, undefined, true);
|
||||
}
|
||||
catch (err) {
|
||||
this.outputChannel.appendLine(loc.msgRemoteBookUnpackingError);
|
||||
|
||||
@@ -49,7 +49,7 @@ export class NotebookUtils {
|
||||
await azdata.nb.showNotebookDocument(file[0]);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ export class NotebookUtils {
|
||||
throw new Error(noNotebookVisible);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ export class NotebookUtils {
|
||||
throw new Error(noNotebookVisible);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ export class NotebookUtils {
|
||||
throw new Error(noNotebookVisible);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export class NotebookUtils {
|
||||
throw new Error(noNotebookVisible);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -146,9 +146,9 @@ export async function activate(extensionContext: vscode.ExtensionContext): Promi
|
||||
|
||||
azdata.nb.onDidChangeActiveNotebookEditor(e => {
|
||||
if (e.document.uri.scheme === 'untitled') {
|
||||
providedBookTreeViewProvider.revealDocumentInTreeView(e.document.uri, false, false);
|
||||
void providedBookTreeViewProvider.revealDocumentInTreeView(e.document.uri, false, false);
|
||||
} else {
|
||||
bookTreeViewProvider.revealDocumentInTreeView(e.document.uri, false, false);
|
||||
void bookTreeViewProvider.revealDocumentInTreeView(e.document.uri, false, false);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ export class JupyterController {
|
||||
// Verify this is a .ipynb file since this isn't actually filtered on Mac/Linux
|
||||
if (path.extname(fileUri.fsPath) !== '.ipynb') {
|
||||
// in the future might want additional supported types
|
||||
vscode.window.showErrorMessage(localize('unsupportedFileType', "Only .ipynb Notebooks are supported"));
|
||||
void vscode.window.showErrorMessage(localize('unsupportedFileType', "Only .ipynb Notebooks are supported"));
|
||||
} else {
|
||||
await azdata.nb.showNotebookDocument(fileUri, {
|
||||
connectionProfile: profile,
|
||||
@@ -174,7 +174,7 @@ export class JupyterController {
|
||||
await this._jupyterInstallation.startInstallProcess(true);
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,7 +202,7 @@ export class JupyterController {
|
||||
packagesDialog.showDialog();
|
||||
} catch (error) {
|
||||
let message = utils.getErrorMessage(error);
|
||||
vscode.window.showErrorMessage(message);
|
||||
void vscode.window.showErrorMessage(message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -236,10 +236,10 @@ export class JupyterController {
|
||||
public doConfigurePython(jupyterInstaller: JupyterServerInstallation): void {
|
||||
let pythonWizard = new ConfigurePythonWizard(jupyterInstaller);
|
||||
pythonWizard.start().catch((err: any) => {
|
||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
});
|
||||
pythonWizard.setupComplete.catch((err: any) => {
|
||||
vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(utils.getErrorMessage(err));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ export class JupyterNotebookManager implements nb.NotebookManager, vscode.Dispos
|
||||
|
||||
dispose() {
|
||||
if (this._sessionManager) {
|
||||
this._sessionManager.shutdownAll().then(() => this._sessionManager.dispose());
|
||||
void this._sessionManager.shutdownAll().then(() => this._sessionManager.dispose());
|
||||
}
|
||||
if (this._serverManager) {
|
||||
this._serverManager.stopServer().then(success => undefined, error => vscode.window.showErrorMessage(error));
|
||||
|
||||
@@ -139,7 +139,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
this.outputChannel = outputChannel;
|
||||
|
||||
this._runningOnSAW = vscode.env.appName.toLowerCase().indexOf('saw') > 0;
|
||||
vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, 'notebook:runningOnSAW', this._runningOnSAW);
|
||||
void vscode.commands.executeCommand(constants.BuiltInCommands.SetContext, 'notebook:runningOnSAW', this._runningOnSAW);
|
||||
|
||||
if (this._runningOnSAW) {
|
||||
this._pythonInstallationPath = `${vscode.env.appRoot}\\ads-python`;
|
||||
@@ -170,7 +170,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
}
|
||||
|
||||
private async installDependencies(backgroundOperation: azdata.BackgroundOperation, forceInstall: boolean, packages: PythonPkgDetails[]): Promise<void> {
|
||||
vscode.window.showInformationMessage(msgInstallPkgStart);
|
||||
void vscode.window.showInformationMessage(msgInstallPkgStart);
|
||||
|
||||
this.outputChannel.show(true);
|
||||
this.outputChannel.appendLine(msgInstallPkgProgress);
|
||||
@@ -224,7 +224,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
|
||||
this.outputChannel.appendLine(msgInstallPkgFinish);
|
||||
backgroundOperation.updateStatus(azdata.TaskStatus.Succeeded, msgInstallPkgFinish);
|
||||
vscode.window.showInformationMessage(msgInstallPkgFinish);
|
||||
void vscode.window.showInformationMessage(msgInstallPkgFinish);
|
||||
}
|
||||
|
||||
private installPythonPackage(backgroundOperation: azdata.BackgroundOperation, usingExistingPython: boolean, pythonInstallationPath: string, outputChannel: vscode.OutputChannel): Promise<void> {
|
||||
@@ -438,7 +438,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
}
|
||||
|
||||
if (this._installInProgress) {
|
||||
vscode.window.showInformationMessage(msgWaitingForInstall);
|
||||
void vscode.window.showInformationMessage(msgWaitingForInstall);
|
||||
return this._installCompletion.promise;
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (this._installInProgress) {
|
||||
vscode.window.showInformationMessage(msgWaitingForInstall);
|
||||
void vscode.window.showInformationMessage(msgWaitingForInstall);
|
||||
return this._installCompletion.promise;
|
||||
}
|
||||
|
||||
@@ -532,7 +532,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
|
||||
if (response === yes) {
|
||||
this._oldPythonInstallationPath = path.join(this._pythonInstallationPath, '0.0.1');
|
||||
this._oldPythonExecutable = this._pythonExecutable;
|
||||
vscode.commands.executeCommand(constants.jupyterConfigurePython);
|
||||
void vscode.commands.executeCommand(constants.jupyterConfigurePython);
|
||||
} else if (response === dontAskAgain) {
|
||||
await notebookConfig.update(constants.dontPromptPythonUpdate, true, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ export class LocalJupyterServerManager implements nb.ServerManager, vscode.Dispo
|
||||
public dispose(): void {
|
||||
this.stopServer().catch(err => {
|
||||
let msg = utils.getErrorMessage(err);
|
||||
vscode.window.showErrorMessage(localize('shutdownError', "Shutdown of Notebook server failed: {0}", msg));
|
||||
void vscode.window.showErrorMessage(localize('shutdownError', "Shutdown of Notebook server failed: {0}", msg));
|
||||
});
|
||||
}
|
||||
|
||||
@@ -105,7 +105,7 @@ export class LocalJupyterServerManager implements nb.ServerManager, vscode.Dispo
|
||||
private async doStartServer(kernelSpec: nb.IKernelSpec): Promise<IServerInstance> { // We can't find or create servers until the installation is complete
|
||||
let installation = this.options.jupyterInstallation;
|
||||
await installation.promptForPythonInstall(kernelSpec.display_name);
|
||||
vscode.commands.executeCommand(BuiltInCommands.SetContext, CommandContext.NotebookPythonInstalled, true);
|
||||
void vscode.commands.executeCommand(BuiltInCommands.SetContext, CommandContext.NotebookPythonInstalled, true);
|
||||
|
||||
// Calculate the path to use as the notebook-dir for Jupyter based on the path of the uri of the
|
||||
// notebook to open. This will be the workspace folder if the notebook uri is inside a workspace
|
||||
|
||||
@@ -54,7 +54,7 @@ export default class CodeAdapter implements IPrompter {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
vscode.window.showErrorMessage(err.message);
|
||||
void vscode.window.showErrorMessage(err.message);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ export class NotebookUriHandler implements vscode.UriHandler {
|
||||
case '/open':
|
||||
return this.open(uri);
|
||||
default:
|
||||
vscode.window.showErrorMessage(localize('notebook.unsupportedAction', "Action {0} is not supported for this handler", uri.path));
|
||||
void vscode.window.showErrorMessage(localize('notebook.unsupportedAction', "Action {0} is not supported for this handler", uri.path));
|
||||
}
|
||||
}
|
||||
/**
|
||||
@@ -84,7 +84,7 @@ export class NotebookUriHandler implements vscode.UriHandler {
|
||||
case 'https':
|
||||
break;
|
||||
default:
|
||||
vscode.window.showErrorMessage(localize('unsupportedScheme', "Cannot open link {0} as only HTTP, HTTPS, and File links are supported", url));
|
||||
void vscode.window.showErrorMessage(localize('unsupportedScheme', "Cannot open link {0} as only HTTP, HTTPS, and File links are supported", url));
|
||||
return;
|
||||
}
|
||||
let contents: string;
|
||||
@@ -116,7 +116,7 @@ export class NotebookUriHandler implements vscode.UriHandler {
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
void vscode.window.showErrorMessage(getErrorMessage(err));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -441,7 +441,7 @@ class TestComponentBuilder<T extends azdata.Component, TPropertyBag> implements
|
||||
return this._component;
|
||||
}
|
||||
withProperties<U>(properties: U): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
this._component.updateProperties(properties);
|
||||
void this._component.updateProperties(properties);
|
||||
return this;
|
||||
}
|
||||
withValidation(validation: (component: T) => boolean): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
@@ -449,7 +449,7 @@ class TestComponentBuilder<T extends azdata.Component, TPropertyBag> implements
|
||||
}
|
||||
|
||||
withProps(properties: TPropertyBag): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
this._component.updateProperties(properties);
|
||||
void this._component.updateProperties(properties);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user