diff --git a/src/sql/workbench/browser/actions.ts b/src/sql/workbench/browser/actions.ts index bc159e8eaf..d2c17b4dc8 100644 --- a/src/sql/workbench/browser/actions.ts +++ b/src/sql/workbench/browser/actions.ts @@ -64,9 +64,8 @@ export class InsightAction extends Action { super(id, label); } - run(actionContext: InsightActionContext): Promise { - this._insightsDialogService.show(actionContext.insight, actionContext.profile); - return Promise.resolve(true); + async run(actionContext: InsightActionContext): Promise { + await this._insightsDialogService.show(actionContext.insight, actionContext.profile); } } diff --git a/src/sql/workbench/browser/modelComponents/fileBrowserTree.component.ts b/src/sql/workbench/browser/modelComponents/fileBrowserTree.component.ts index 71435b808b..9dfd792126 100644 --- a/src/sql/workbench/browser/modelComponents/fileBrowserTree.component.ts +++ b/src/sql/workbench/browser/modelComponents/fileBrowserTree.component.ts @@ -72,12 +72,12 @@ export default class FileBrowserTreeComponent extends ComponentBase implements I } } - private handleOnAddFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]) { - this.updateFileTree(rootNode, selectedNode, expandedNodes); + private async handleOnAddFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): Promise { + await this.updateFileTree(rootNode, selectedNode, expandedNodes); } - private updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): void { - this._treeView.renderBody(this._treeContainer.nativeElement, rootNode, selectedNode, expandedNodes); + private async updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): Promise { + await this._treeView.renderBody(this._treeContainer.nativeElement, rootNode, selectedNode, expandedNodes); this._treeView.setVisible(true); this.layoutTree(); this._changeRef.detectChanges(); diff --git a/src/sql/workbench/browser/taskUtilities.ts b/src/sql/workbench/browser/taskUtilities.ts index 94397e4a42..50599e410a 100644 --- a/src/sql/workbench/browser/taskUtilities.ts +++ b/src/sql/workbench/browser/taskUtilities.ts @@ -10,13 +10,11 @@ import { RunQueryOnConnectionMode, IConnectionResult } from 'sql/platform/connection/common/connectionManagement'; import { EditDataInput } from 'sql/workbench/contrib/editData/browser/editDataInput'; -import { IInsightsDialogService } from 'sql/workbench/services/insights/browser/insightsDialogService'; import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/browser/objectExplorerService'; import { DashboardInput } from 'sql/workbench/contrib/dashboard/browser/dashboardInput'; import { ProfilerInput } from 'sql/workbench/contrib/profiler/browser/profilerInput'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; -import { IInsightsConfig } from 'sql/platform/dashboard/browser/insightRegistry'; import { QueryEditorInput } from 'sql/workbench/contrib/query/common/queryEditorInput'; export function replaceConnection(oldUri: string, newUri: string, connectionService: IConnectionManagementService): Promise { @@ -56,10 +54,6 @@ export function replaceConnection(oldUri: string, newUri: string, connectionServ }); } -export function openInsight(query: IInsightsConfig, profile: IConnectionProfile, insightDialogService: IInsightsDialogService) { - insightDialogService.show(query, profile); -} - /** * Get the current global connection, which is the connection from the active editor, unless OE * is focused or there is no such editor, in which case it comes from the OE selection. Returns diff --git a/src/sql/workbench/services/errorMessage/browser/errorMessageDialog.ts b/src/sql/workbench/services/errorMessage/browser/errorMessageDialog.ts index ee22166cbc..223b46fd7b 100644 --- a/src/sql/workbench/services/errorMessage/browser/errorMessageDialog.ts +++ b/src/sql/workbench/services/errorMessage/browser/errorMessageDialog.ts @@ -23,6 +23,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry'; +import { onUnexpectedError } from 'vs/base/common/errors'; const maxActions = 1; @@ -66,7 +67,7 @@ export class ErrorMessageDialog extends Modal { this.createCopyButton(); this._actionButtons = []; for (let i = 0; i < maxActions; i++) { - this._actionButtons.unshift(this.createStandardButton('Action', () => this.onActionSelected(i))); + this._actionButtons.unshift(this.createStandardButton(localize('errorMessageDialog.action', "Action"), () => this.onActionSelected(i))); } this._okButton = this.addFooterButton(this._okLabel, () => this.ok()); this._register(attachButtonStyler(this._okButton, this._themeService)); @@ -74,7 +75,7 @@ export class ErrorMessageDialog extends Modal { private createCopyButton() { let copyButtonLabel = localize('copyDetails', "Copy details"); - this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails), 'left'); + this._copyButton = this.addFooterButton(copyButtonLabel, () => this._clipboardService.writeText(this._messageDetails).catch(err => onUnexpectedError(err)), 'left'); this._copyButton.icon = 'codicon scriptToClipboard'; this._copyButton.element.title = copyButtonLabel; this._register(attachButtonStyler(this._copyButton, this._themeService, { buttonBackground: SIDE_BAR_BACKGROUND, buttonHoverBackground: SIDE_BAR_BACKGROUND, buttonForeground: SIDE_BAR_FOREGROUND })); @@ -91,7 +92,7 @@ export class ErrorMessageDialog extends Modal { this.ok(); // Run the action if possible if (this._actions && index < this._actions.length) { - this._actions[index].run(); + this._actions[index].run().catch(err => onUnexpectedError(err)); } } diff --git a/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialog.ts b/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialog.ts index d82430339b..c0f7d99bc1 100644 --- a/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialog.ts +++ b/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialog.ts @@ -6,7 +6,7 @@ import 'vs/css!sql/media/icons/common-icons'; import 'vs/css!./media/fileBrowserDialog'; import { Button } from 'sql/base/browser/ui/button/button'; -import { InputBox } from 'sql/base/browser/ui/inputBox/inputBox'; +import { InputBox, OnLoseFocusParams } from 'sql/base/browser/ui/inputBox/inputBox'; import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox'; import * as DialogHelper from 'sql/workbench/browser/modal/dialogHelper'; import { Modal } from 'sql/workbench/browser/modal/modal'; @@ -32,6 +32,7 @@ import { ILogService } from 'vs/platform/log/common/log'; import { IWorkbenchLayoutService } from 'vs/workbench/services/layout/browser/layoutService'; import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry'; +import { onUnexpectedError } from 'vs/base/common/errors'; export class FileBrowserDialog extends Modal { private _viewModel: FileBrowserViewModel; @@ -61,7 +62,7 @@ export class FileBrowserDialog extends Modal { ) { super(title, TelemetryKeys.Backup, telemetryService, layoutService, clipboardService, themeService, logService, textResourcePropertiesService, contextKeyService, { isFlyout: true, hasTitleIcon: false, hasBackButton: true, hasSpinner: true }); this._viewModel = this._instantiationService.createInstance(FileBrowserViewModel); - this._viewModel.onAddFileTree(args => this.handleOnAddFileTree(args.rootNode, args.selectedNode, args.expandedNodes)); + this._viewModel.onAddFileTree(args => this.handleOnAddFileTree(args.rootNode, args.selectedNode, args.expandedNodes).catch(err => onUnexpectedError(err))); this._viewModel.onPathValidate(args => this.handleOnValidate(args.succeeded, args.message)); } @@ -114,7 +115,7 @@ export class FileBrowserDialog extends Modal { expandPath: string, fileFilters: [{ label: string, filters: string[] }], fileValidationServiceType: string, - ) { + ): void { this._viewModel.initialize(ownerUri, expandPath, fileFilters, fileValidationServiceType); this._fileFilterSelectBox.setOptions(this._viewModel.formattedFileFilters); this._fileFilterSelectBox.select(0); @@ -127,7 +128,7 @@ export class FileBrowserDialog extends Modal { this._fileBrowserTreeView = this._instantiationService.createInstance(FileBrowserTreeView); this._fileBrowserTreeView.setOnClickedCallback((arg) => this.onClicked(arg)); this._fileBrowserTreeView.setOnDoubleClickedCallback((arg) => this.onDoubleClicked(arg)); - this._viewModel.openFileBrowser(0, false); + this._viewModel.openFileBrowser(0, false).catch(err => onUnexpectedError(err)); } /* enter key */ @@ -137,8 +138,8 @@ export class FileBrowserDialog extends Modal { } } - private handleOnAddFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]) { - this.updateFileTree(rootNode, selectedNode, expandedNodes); + private async handleOnAddFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): Promise { + await this.updateFileTree(rootNode, selectedNode, expandedNodes); this.spinner = false; } @@ -176,10 +177,11 @@ export class FileBrowserDialog extends Modal { this.enableOkButton(); } - private onFilePathBlur(param) { - if (!strings.isFalsyOrWhitespace(param.value)) { - this._viewModel.validateFilePaths([param.value]); + private async onFilePathBlur(params: OnLoseFocusParams): Promise { + if (!strings.isFalsyOrWhitespace(params.value)) { + return this._viewModel.validateFilePaths([params.value]); } + return true; } private ok() { @@ -196,35 +198,35 @@ export class FileBrowserDialog extends Modal { } } - private close() { + private close(): void { if (this._fileBrowserTreeView) { this._fileBrowserTreeView.dispose(); } this._onOk.dispose(); this.hide(); - this._viewModel.closeFileBrowser(); + this._viewModel.closeFileBrowser().catch(err => onUnexpectedError(err)); } - private updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): void { - this._fileBrowserTreeView.renderBody(this._treeContainer, rootNode, selectedNode, expandedNodes); + private async updateFileTree(rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): Promise { + await this._fileBrowserTreeView.renderBody(this._treeContainer, rootNode, selectedNode, expandedNodes); this._fileBrowserTreeView.setVisible(true); this._fileBrowserTreeView.layout(DOM.getTotalHeight(this._treeContainer)); } - private onFilterSelectChanged(filterIndex) { + private async onFilterSelectChanged(filterIndex): Promise { this.spinner = true; - this._viewModel.openFileBrowser(filterIndex, true); + await this._viewModel.openFileBrowser(filterIndex, true); } private registerListeners(): void { - this._register(this._fileFilterSelectBox.onDidSelect(selection => { - this.onFilterSelectChanged(selection.index); + this._register(this._fileFilterSelectBox.onDidSelect(selectData => { + this.onFilterSelectChanged(selectData.index).catch(err => onUnexpectedError(err)); })); this._register(this._filePathInputBox.onDidChange(e => { this.onFilePathChange(e); })); - this._register(this._filePathInputBox.onLoseFocus(params => { - this.onFilePathBlur(params); + this._register(this._filePathInputBox.onLoseFocus((params: OnLoseFocusParams) => { + this.onFilePathBlur(params).catch(err => onUnexpectedError(err)); })); // Theme styler diff --git a/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialogController.ts b/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialogController.ts index b8a6ff1acb..9b01724b47 100644 --- a/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialogController.ts +++ b/src/sql/workbench/services/fileBrowser/browser/fileBrowserDialogController.ts @@ -26,7 +26,7 @@ export class FileBrowserDialogController implements IFileBrowserDialogController fileValidationServiceType: string, isWide: boolean, handleOnOk: (path: string) => void - ) { + ): void { if (!this._fileBrowserDialog) { this._fileBrowserDialog = this._instantiationService.createInstance(FileBrowserDialog, localize('filebrowser.selectFile', "Select a file")); this._fileBrowserDialog.render(); diff --git a/src/sql/workbench/services/fileBrowser/browser/fileBrowserTreeView.ts b/src/sql/workbench/services/fileBrowser/browser/fileBrowserTreeView.ts index 3d4e5b1822..bdd529ecd8 100644 --- a/src/sql/workbench/services/fileBrowser/browser/fileBrowserTreeView.ts +++ b/src/sql/workbench/services/fileBrowser/browser/fileBrowserTreeView.ts @@ -8,7 +8,6 @@ import { FileBrowserController } from 'sql/workbench/services/fileBrowser/browse import { FileBrowserRenderer } from 'sql/workbench/services/fileBrowser/browser/fileBrowserRenderer'; import { IFileBrowserService } from 'sql/platform/fileBrowser/common/interfaces'; import { FileNode } from 'sql/workbench/services/fileBrowser/common/fileNode'; -import errors = require('vs/base/common/errors'); import { IDisposable, Disposable } from 'vs/base/common/lifecycle'; import * as DOM from 'vs/base/browser/dom'; import nls = require('vs/nls'); @@ -37,7 +36,7 @@ export class FileBrowserTreeView extends Disposable implements IDisposable { /** * Render the view body */ - public renderBody(container: HTMLElement, rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): void { + public async renderBody(container: HTMLElement, rootNode: FileNode, selectedNode: FileNode, expandedNodes: FileNode[]): Promise { if (!this._tree) { DOM.addClass(container, 'show-file-icons'); this._tree = this._register(this.createFileBrowserTree(container, this._instantiationService)); @@ -48,16 +47,15 @@ export class FileBrowserTreeView extends Disposable implements IDisposable { } if (rootNode) { - this._tree.setInput(rootNode).then(() => { - if (expandedNodes) { - this._tree.expandAll(expandedNodes); - } - if (selectedNode) { - this._tree.select(selectedNode); - this._tree.setFocus(selectedNode); - } - this._tree.getFocus(); - }, errors.onUnexpectedError); + await this._tree.setInput(rootNode); + if (expandedNodes) { + await this._tree.expandAll(expandedNodes); + } + if (selectedNode) { + this._tree.select(selectedNode); + this._tree.setFocus(selectedNode); + } + this._tree.getFocus(); } } @@ -85,7 +83,7 @@ export class FileBrowserTreeView extends Disposable implements IDisposable { /** * Refresh the tree */ - public refreshTree(rootNode: FileNode): void { + public async refreshTree(rootNode: FileNode): Promise { let selectedElement: any; let targetsToExpand: any[]; @@ -103,17 +101,16 @@ export class FileBrowserTreeView extends Disposable implements IDisposable { } if (rootNode) { - this._tree.setInput(rootNode).then(() => { - // Make sure to expand all folders that were expanded in the previous session - if (targetsToExpand) { - this._tree.expandAll(targetsToExpand); - } - if (selectedElement) { - this._tree.select(selectedElement); - this._tree.setFocus(selectedElement); - } - this._tree.getFocus(); - }, errors.onUnexpectedError); + await this._tree.setInput(rootNode); + // Make sure to expand all folders that were expanded in the previous session + if (targetsToExpand) { + await this._tree.expandAll(targetsToExpand); + } + if (selectedElement) { + this._tree.select(selectedElement); + this._tree.setFocus(selectedElement); + } + this._tree.getFocus(); } } diff --git a/src/sql/workbench/services/fileBrowser/common/fileBrowserViewModel.ts b/src/sql/workbench/services/fileBrowser/common/fileBrowserViewModel.ts index e2828a3769..6c9a1a6104 100644 --- a/src/sql/workbench/services/fileBrowser/common/fileBrowserViewModel.ts +++ b/src/sql/workbench/services/fileBrowser/common/fileBrowserViewModel.ts @@ -5,6 +5,7 @@ import { IFileBrowserService } from 'sql/platform/fileBrowser/common/interfaces'; import { localize } from 'vs/nls'; +import { onUnexpectedError } from 'vs/base/common/errors'; /** * View model for file browser dialog @@ -48,17 +49,17 @@ export class FileBrowserViewModel { } } - public validateFilePaths(selectedFiles: string[]) { - this._fileBrowserService.validateFilePaths(this._ownerUri, this._fileValidationServiceType, selectedFiles); + public async validateFilePaths(selectedFiles: string[]): Promise { + return this._fileBrowserService.validateFilePaths(this._ownerUri, this._fileValidationServiceType, selectedFiles); } - public openFileBrowser(filterIndex: number, changeFilter: boolean) { + public async openFileBrowser(filterIndex: number, changeFilter: boolean): Promise { if (this._fileFilters[filterIndex]) { - this._fileBrowserService.openFileBrowser(this._ownerUri, this._expandPath, this._fileFilters[filterIndex].filters, changeFilter); + await this._fileBrowserService.openFileBrowser(this._ownerUri, this._expandPath, this._fileFilters[filterIndex].filters, changeFilter); } } - public closeFileBrowser() { - this._fileBrowserService.closeFileBrowser(this._ownerUri); + public async closeFileBrowser(): Promise { + await this._fileBrowserService.closeFileBrowser(this._ownerUri).catch(err => onUnexpectedError(err)); } } diff --git a/src/sql/workbench/services/insights/browser/insightDialogActions.ts b/src/sql/workbench/services/insights/browser/insightDialogActions.ts index 3c5a9b484a..4ccde19b6d 100644 --- a/src/sql/workbench/services/insights/browser/insightDialogActions.ts +++ b/src/sql/workbench/services/insights/browser/insightDialogActions.ts @@ -20,8 +20,7 @@ export class CopyInsightDialogSelectionAction extends Action { super(id, label); } - public run(event?: IInsightDialogActionContext): Promise { - this._clipboardService.writeText(event.cellData); - return Promise.resolve(void 0); + public async run(event?: IInsightDialogActionContext): Promise { + await this._clipboardService.writeText(event.cellData); } } diff --git a/src/sql/workbench/services/insights/browser/insightsDialogService.ts b/src/sql/workbench/services/insights/browser/insightsDialogService.ts index fe8bc7eff5..c71ca7c1b7 100644 --- a/src/sql/workbench/services/insights/browser/insightsDialogService.ts +++ b/src/sql/workbench/services/insights/browser/insightsDialogService.ts @@ -31,8 +31,8 @@ export const IInsightsDialogService = createDecorator('i export interface IInsightsDialogService { _serviceBrand: undefined; - show(input: IInsightsConfig, connectionProfile: IConnectionProfile): void; - close(); + show(input: IInsightsConfig, connectionProfile: IConnectionProfile): Promise; + close(): void; } export interface IInsightDialogActionContext extends BaseActionContext { diff --git a/src/sql/workbench/services/insights/browser/insightsDialogServiceImpl.ts b/src/sql/workbench/services/insights/browser/insightsDialogServiceImpl.ts index c5f2c72390..71ea835a91 100644 --- a/src/sql/workbench/services/insights/browser/insightsDialogServiceImpl.ts +++ b/src/sql/workbench/services/insights/browser/insightsDialogServiceImpl.ts @@ -20,7 +20,7 @@ export class InsightsDialogService implements IInsightsDialogService { constructor(@IInstantiationService private _instantiationService: IInstantiationService) { } // query string - public show(input: IInsightsConfig, connectionProfile: IConnectionProfile): void { + public async show(input: IInsightsConfig, connectionProfile: IConnectionProfile): Promise { if (!this._insightsDialogView) { this._insightsDialogModel = new InsightsDialogModel(); this._insightsDialogController = this._instantiationService.createInstance(InsightsDialogController, this._insightsDialogModel); @@ -32,7 +32,7 @@ export class InsightsDialogService implements IInsightsDialogService { } this._insightsDialogModel.insight = input.details; - this._insightsDialogController.update(input.details, connectionProfile); + await this._insightsDialogController.update(input.details, connectionProfile); this._insightsDialogView.open(input.details, connectionProfile); } diff --git a/src/sql/workbench/services/insights/browser/insightsDialogView.ts b/src/sql/workbench/services/insights/browser/insightsDialogView.ts index 4cb56bd922..97023ce925 100644 --- a/src/sql/workbench/services/insights/browser/insightsDialogView.ts +++ b/src/sql/workbench/services/insights/browser/insightsDialogView.ts @@ -42,6 +42,7 @@ import { IInsightsConfigDetails } from 'sql/platform/dashboard/browser/insightRe import { TaskRegistry } from 'sql/platform/tasks/browser/tasksRegistry'; import { ITextResourcePropertiesService } from 'vs/editor/common/services/resourceConfiguration'; import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry'; +import { onUnexpectedError } from 'vs/base/common/errors'; const labelDisplay = nls.localize("insights.item", "Item"); const valueDisplay = nls.localize("insights.value", "Value"); @@ -353,7 +354,7 @@ export class InsightsDialogView extends Modal { return; } let context = this.topInsightContext(resource); - this._commandService.executeCommand(action, context); + this._commandService.executeCommand(action, context).catch(err => onUnexpectedError(err)); }, 'left'); button.enabled = false; this._taskButtonDisposables.push(button); diff --git a/src/sql/workbench/services/insights/test/browser/insightsDialogController.test.ts b/src/sql/workbench/services/insights/test/browser/insightsDialogController.test.ts index 737a6226fc..164c17e17f 100644 --- a/src/sql/workbench/services/insights/test/browser/insightsDialogController.test.ts +++ b/src/sql/workbench/services/insights/test/browser/insightsDialogController.test.ts @@ -29,7 +29,7 @@ const testColumns: string[] = [ ]; suite('Insights Dialog Controller Tests', () => { - test('updates correctly with good input', done => { + test('updates correctly with good input', async (done) => { let model = new InsightsDialogModel(); @@ -71,20 +71,19 @@ suite('Insights Dialog Controller Tests', () => { options: {} }; - controller.update({ query: 'query' }, profile).then(() => { - // Once we update the controller, listen on when it changes the model and verify the data it - // puts in is correct - model.onDataChange(() => { - for (let i = 0; i < testData.length; i++) { - for (let j = 0; j < testData[i].length; j++) { - equal(testData[i][j], model.rows[i][j]); - } + await controller.update({ query: 'query' }, profile); + // Once we update the controller, listen on when it changes the model and verify the data it + // puts in is correct + model.onDataChange(() => { + for (let i = 0; i < testData.length; i++) { + for (let j = 0; j < testData[i].length; j++) { + equal(testData[i][j], model.rows[i][j]); } - done(); - }); - // Fake the query Runner telling the controller the query is complete - complete(); + } + done(); }); + // Fake the query Runner telling the controller the query is complete + complete(); }); }); diff --git a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts index 1d91b67dac..17706ee80f 100644 --- a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts +++ b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts @@ -43,6 +43,7 @@ import { toErrorMessage } from 'vs/base/common/errorMessage'; import { NotebookChangeType } from 'sql/workbench/contrib/notebook/common/models/contracts'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { find, firstIndex } from 'vs/base/common/arrays'; +import { onUnexpectedError } from 'vs/base/common/errors'; export interface NotebookProviderProperties { provider: string; @@ -161,7 +162,7 @@ export class NotebookService extends Disposable implements INotebookService { this._register(this._queryManagementService.onHandlerAdded((queryType) => { this.updateSQLRegistrationWithConnectionProviders(); })); - }); + }).catch(err => onUnexpectedError(err)); } if (extensionManagementService) { this._register(extensionManagementService.onDidUninstallExtension(({ identifier }) => this.removeContributedProvidersFromCache(identifier, this._extensionService))); @@ -530,7 +531,7 @@ export class NotebookService extends Disposable implements INotebookService { }); } - private removeContributedProvidersFromCache(identifier: IExtensionIdentifier, extensionService: IExtensionService) { + private removeContributedProvidersFromCache(identifier: IExtensionIdentifier, extensionService: IExtensionService): void { const notebookProvider = 'notebookProvider'; extensionService.getExtensions().then(i => { let extension = find(i, c => c.identifier.value.toLowerCase() === identifier.id.toLowerCase()); @@ -540,7 +541,7 @@ export class NotebookService extends Disposable implements INotebookService { let id = extension.contributes[notebookProvider].providerId; delete this.providersMemento.notebookProviderCache[id]; } - }); + }).catch(err => onUnexpectedError(err)); } async isNotebookTrustCached(notebookUri: URI, isDirty: boolean): Promise {