From 74b89a0a85bc93f50e4d0840622ad8ef86b6e815 Mon Sep 17 00:00:00 2001 From: Anthony Dresser Date: Fri, 14 Feb 2020 21:13:16 -0600 Subject: [PATCH] No console linting (#9156) * add no-console linting and change to just using overrides for sql files * whitespace * fix tests --- .eslintrc.json | 10 ++++++++ .eslintrc.sql.json | 7 ------ build/gulpfile.hygiene.js | 21 +--------------- .../ui/scrollableSplitview/heightMap.ts | 2 ++ .../browser/mainThreadExtensionManagement.ts | 6 +++-- .../api/browser/mainThreadQueryEditor.ts | 2 +- .../workbench/api/common/extHostModelView.ts | 16 ++++++++----- .../api/common/extHostModelViewTree.ts | 17 +++++++------ .../api/common/extHostRequireInterceptor.ts | 6 +++-- .../api/common/sqlExtHost.api.impl.ts | 8 +++---- .../splitviewContainer.component.ts | 6 +++-- .../contrib/backup/browser/backupDialog.ts | 2 +- .../dashboard/browser/dashboardEditor.ts | 2 +- .../browser/connectionViewletPanel.ts | 6 +++-- .../notebook/browser/notebook.component.ts | 2 +- .../notebook/browser/notebookEditor.ts | 2 +- .../browser/modelViewTab/queryModelViewTab.ts | 2 +- .../contrib/query/browser/queryActions.ts | 24 +++++++++++-------- .../query/test/browser/queryActions.test.ts | 10 ++++---- .../query/test/browser/queryEditor.test.ts | 4 ++-- .../queryPlan/browser/queryPlanEditor.ts | 2 +- .../browser/accountManagementService.ts | 6 +++-- .../browser/accountManagementService.test.ts | 2 +- .../bootstrap/browser/bootstrapService.ts | 19 ++++++--------- .../services/dialog/browser/dialogPane.ts | 2 +- .../services/dialog/browser/wizardModal.ts | 2 +- .../test/electron-browser/dialogPane.test.ts | 7 +++--- .../notebook/browser/notebookServiceImpl.ts | 5 ++-- .../api/extHostModelView.test.ts | 4 ++-- .../api/common/extHostRequireInterceptor.ts | 2 +- .../src/sql/queryEditor/queryEditor.test.ts | 6 ++--- 31 files changed, 107 insertions(+), 105 deletions(-) delete mode 100644 .eslintrc.sql.json diff --git a/.eslintrc.json b/.eslintrc.json index 5511bd261c..0f2004d025 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -506,6 +506,16 @@ "jsdoc/no-types": "off" } }, + { + "files": [ + "**/sql/**" + ], + "rules": { + "no-sync": "warn", + "strict": ["warn", "never"], + "no-console": "warn" + } + }, { "files": [ "**/vscode.d.ts", diff --git a/.eslintrc.sql.json b/.eslintrc.sql.json deleted file mode 100644 index 952c2b454c..0000000000 --- a/.eslintrc.sql.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "extends": ".eslintrc.json", - "rules": { - "no-sync": "warn", - "strict": ["warn", "never"] - } -} diff --git a/build/gulpfile.hygiene.js b/build/gulpfile.hygiene.js index f3e1dcf0c6..dc229a973a 100644 --- a/build/gulpfile.hygiene.js +++ b/build/gulpfile.hygiene.js @@ -202,13 +202,6 @@ const tsHygieneFilter = [ '!src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts' // {{SQL CARBON EDIT}} skip this because known issue ]; -const sqlHygieneFilter = [ // for rules we want to only apply to our code - 'src/sql/**/*.ts', - '!**/node_modules/**', - 'extensions/**/*.ts', - '!extensions/{git,search-result,vscode-test-resolver,extension-editing,json-language-features,vscode-colorize-tests}/**/*.ts', -]; - const copyrightHeaderLines = [ '/*---------------------------------------------------------------------------------------------', ' * Copyright (c) Microsoft Corporation. All rights reserved.', @@ -376,20 +369,8 @@ function hygiene(some) { errorCount += results.errorCount; })); - const sqlJavascript = result - .pipe(filter(sqlHygieneFilter)) - .pipe(gulpeslint({ - configFile: '.eslintrc.sql.json', - rulePaths: ['./build/lib/eslint'] - })) - .pipe(gulpeslint.formatEach('compact')) - .pipe(gulpeslint.results(results => { - errorCount += results.warningCount; - errorCount += results.errorCount; - })); - let count = 0; - return es.merge(typescript, javascript, sqlJavascript) + return es.merge(typescript, javascript) .pipe(es.through(function (data) { count++; if (process.env['TRAVIS'] && count % 10 === 0) { diff --git a/src/sql/base/browser/ui/scrollableSplitview/heightMap.ts b/src/sql/base/browser/ui/scrollableSplitview/heightMap.ts index 2b3f4ca741..f404c1b31a 100644 --- a/src/sql/base/browser/ui/scrollableSplitview/heightMap.ts +++ b/src/sql/base/browser/ui/scrollableSplitview/heightMap.ts @@ -45,6 +45,7 @@ export class HeightMap { viewItem = this.heightMap[i - 1]; if (!viewItem) { + // eslint-disable-next-line no-console console.error('view item doesnt exist'); return undefined; } @@ -100,6 +101,7 @@ export class HeightMap { viewItem = this.heightMap[i]; if (!viewItem) { + // eslint-disable-next-line no-console console.error('view item doesnt exist'); return; } diff --git a/src/sql/workbench/api/browser/mainThreadExtensionManagement.ts b/src/sql/workbench/api/browser/mainThreadExtensionManagement.ts index 42dac813d6..28b8cc5584 100644 --- a/src/sql/workbench/api/browser/mainThreadExtensionManagement.ts +++ b/src/sql/workbench/api/browser/mainThreadExtensionManagement.ts @@ -12,6 +12,7 @@ import { URI } from 'vs/base/common/uri'; import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration'; import { INotificationService, Severity } from 'vs/platform/notification/common/notification'; import { localize } from 'vs/nls'; +import { ILogService } from 'vs/platform/log/common/log'; @extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement) export class MainThreadExtensionManagement extends Disposable implements MainThreadExtensionManagementShape { @@ -22,7 +23,8 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr extHostContext: IExtHostContext, @IExtensionManagementService private _extensionService: IExtensionManagementService, @IConfigurationService private _configurationService: IConfigurationService, - @INotificationService private _notificationService: INotificationService + @INotificationService private _notificationService: INotificationService, + @ILogService private readonly logService: ILogService ) { super(); } @@ -32,7 +34,7 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr } public $showObsoleteExtensionApiUsageNotification(message: string): void { - console.warn(message); + this.logService.warn(message); if (this._obsoleteExtensionApiUsageNotificationShown) { return; diff --git a/src/sql/workbench/api/browser/mainThreadQueryEditor.ts b/src/sql/workbench/api/browser/mainThreadQueryEditor.ts index 8dc2ad3c6b..1d847cced8 100644 --- a/src/sql/workbench/api/browser/mainThreadQueryEditor.ts +++ b/src/sql/workbench/api/browser/mainThreadQueryEditor.ts @@ -91,7 +91,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery let profile: IConnectionProfile = MainThreadQueryEditor.connectionProfileToIConnectionProfile(connection); let connectionResult = await this._connectionManagementService.connect(profile, fileUri, options); if (connectionResult && connectionResult.connected) { - console.log(`editor ${fileUri} connected`); + this._logService.info(`editor ${fileUri} connected`); } }); } diff --git a/src/sql/workbench/api/common/extHostModelView.ts b/src/sql/workbench/api/common/extHostModelView.ts index bdb25c9e23..65289bf651 100644 --- a/src/sql/workbench/api/common/extHostModelView.ts +++ b/src/sql/workbench/api/common/extHostModelView.ts @@ -16,6 +16,7 @@ import { SqlMainContext, ExtHostModelViewShape, MainThreadModelViewShape, ExtHos import { IItemConfig, ModelComponentTypes, IComponentShape, IComponentEventArgs, ComponentEventType, ColumnSizingMode } from 'sql/workbench/api/common/sqlExtHostTypes'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { firstIndex } from 'vs/base/common/arrays'; +import { ILogService } from 'vs/platform/log/common/log'; class ModelBuilderImpl implements azdata.ModelBuilder { private nextComponentId: number; @@ -25,7 +26,8 @@ class ModelBuilderImpl implements azdata.ModelBuilder { private readonly _proxy: MainThreadModelViewShape, private readonly _handle: number, private readonly _extHostModelViewTree: ExtHostModelViewTreeViewsShape, - private readonly _extension: IExtensionDescription + private readonly _extension: IExtensionDescription, + private readonly logService: ILogService ) { this.nextComponentId = 0; } @@ -82,7 +84,7 @@ class ModelBuilderImpl implements azdata.ModelBuilder { private cardDeprecationMessagePrinted = false; card(): azdata.ComponentBuilder { if (!this.cardDeprecationMessagePrinted) { - console.warn(`Extension '${this._extension.identifier.value}' is using card component which has been replaced by radioCardGroup. the card component will be removed in a future release.`); + this.logService.warn(`Extension '${this._extension.identifier.value}' is using card component which has been replaced by radioCardGroup. the card component will be removed in a future release.`); this.cardDeprecationMessagePrinted = true; } let id = this.getNextComponentId(); @@ -1699,9 +1701,10 @@ class ModelViewImpl implements azdata.ModelView { private readonly _connection: azdata.connection.Connection, private readonly _serverInfo: azdata.ServerInfo, private readonly _extHostModelViewTree: ExtHostModelViewTreeViewsShape, - _extension: IExtensionDescription + _extension: IExtensionDescription, + logService: ILogService ) { - this._modelBuilder = new ModelBuilderImpl(this._proxy, this._handle, this._extHostModelViewTree, _extension); + this._modelBuilder = new ModelBuilderImpl(this._proxy, this._handle, this._extHostModelViewTree, _extension, logService); } public get onClosed(): vscode.Event { @@ -1755,7 +1758,8 @@ export class ExtHostModelView implements ExtHostModelViewShape { private readonly _handlerToExtension = new Map(); constructor( _mainContext: IMainContext, - private _extHostModelViewTree: ExtHostModelViewTreeViewsShape + private _extHostModelViewTree: ExtHostModelViewTreeViewsShape, + private readonly logService: ILogService ) { this._proxy = _mainContext.getProxy(SqlMainContext.MainThreadModelView); } @@ -1774,7 +1778,7 @@ export class ExtHostModelView implements ExtHostModelViewShape { $registerWidget(handle: number, id: string, connection: azdata.connection.Connection, serverInfo: azdata.ServerInfo): void { let extension = this._handlerToExtension.get(id); - let view = new ModelViewImpl(this._proxy, handle, connection, serverInfo, this._extHostModelViewTree, extension); + let view = new ModelViewImpl(this._proxy, handle, connection, serverInfo, this._extHostModelViewTree, extension, this.logService); this._modelViews.set(handle, view); this._handlers.get(id)(view); } diff --git a/src/sql/workbench/api/common/extHostModelViewTree.ts b/src/sql/workbench/api/common/extHostModelViewTree.ts index 4b52e899a8..464d9319d7 100644 --- a/src/sql/workbench/api/common/extHostModelViewTree.ts +++ b/src/sql/workbench/api/common/extHostModelViewTree.ts @@ -14,6 +14,7 @@ import * as vsTreeExt from 'vs/workbench/api/common/extHostTreeViews'; import { Emitter } from 'vs/base/common/event'; import { IExtensionDescription } from 'vs/platform/extensions/common/extensions'; import { assign } from 'vs/base/common/objects'; +import { ILogService } from 'vs/platform/log/common/log'; export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape { private _proxy: MainThreadModelViewShape; @@ -21,7 +22,8 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape private treeViews: Map> = new Map>(); constructor( - private _mainContext: IMainContext + private _mainContext: IMainContext, + private readonly logService: ILogService ) { this._proxy = this._mainContext.getProxy(SqlMainContext.MainThreadModelView); } @@ -31,7 +33,7 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape throw new Error('Options with treeDataProvider is mandatory'); } - const treeView = this.createExtHostTreeViewer(handle, componentId, options.treeDataProvider, extension); + const treeView = this.createExtHostTreeViewer(handle, componentId, options.treeDataProvider, extension, this.logService); return { dispose: () => { this.treeViews.delete(componentId); @@ -74,8 +76,8 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape $setVisible(treeViewId: string, visible: boolean): void { } - private createExtHostTreeViewer(handle: number, id: string, dataProvider: azdata.TreeComponentDataProvider, extension: IExtensionDescription): ExtHostTreeView { - const treeView = new ExtHostTreeView(handle, id, dataProvider, this._proxy, undefined, extension); + private createExtHostTreeViewer(handle: number, id: string, dataProvider: azdata.TreeComponentDataProvider, extension: IExtensionDescription, logService: ILogService): ExtHostTreeView { + const treeView = new ExtHostTreeView(handle, id, dataProvider, this._proxy, undefined, extension, logService); this.treeViews.set(`${handle}-${id}`, treeView); return treeView; } @@ -89,14 +91,15 @@ export class ExtHostTreeView extends vsTreeExt.ExtHostTreeView { public readonly ChangeSelection: vscode.Event> = this._onChangeSelection.event; constructor( private handle: number, private componentId: string, private componentDataProvider: azdata.TreeComponentDataProvider, - private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter, extension: IExtensionDescription) { - super(componentId, { treeDataProvider: componentDataProvider }, undefined, commands, undefined, extension); + private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter, extension: IExtensionDescription, + private readonly _logService: ILogService) { + super(componentId, { treeDataProvider: componentDataProvider }, undefined, commands, _logService, extension); } onNodeCheckedChanged(parentHandle?: vsTreeExt.TreeItemHandle, checked?: boolean): void { const parentElement = parentHandle ? this.getExtensionElement(parentHandle) : void 0; if (parentHandle && !parentElement) { - console.error(`No tree item with id \'${parentHandle}\' found.`); + this._logService.error(`No tree item with id \'${parentHandle}\' found.`); } this._onNodeCheckedChanged.fire({ element: parentElement, checked: checked }); diff --git a/src/sql/workbench/api/common/extHostRequireInterceptor.ts b/src/sql/workbench/api/common/extHostRequireInterceptor.ts index 14681be5b6..1798ca6394 100644 --- a/src/sql/workbench/api/common/extHostRequireInterceptor.ts +++ b/src/sql/workbench/api/common/extHostRequireInterceptor.ts @@ -10,6 +10,7 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio import * as azdata from 'azdata'; import { IAzdataExtensionApiFactory } from 'sql/workbench/api/common/sqlExtHost.api.impl'; import { INodeModuleFactory } from 'vs/workbench/api/common/extHostRequireInterceptor'; +import { ILogService } from 'vs/platform/log/common/log'; export class AzdataNodeModuleFactory implements INodeModuleFactory { public readonly nodeModuleName = 'azdata'; @@ -19,7 +20,8 @@ export class AzdataNodeModuleFactory implements INodeModuleFactory { constructor( private readonly _apiFactory: IAzdataExtensionApiFactory, - private readonly _extensionPaths: TernarySearchTree + private readonly _extensionPaths: TernarySearchTree, + private readonly _logService: ILogService ) { } @@ -40,7 +42,7 @@ export class AzdataNodeModuleFactory implements INodeModuleFactory { if (!this._defaultApiImpl) { let extensionPathsPretty = ''; this._extensionPaths.forEach((value, index) => extensionPathsPretty += `\t${index} -> ${value.identifier.value}\n`); - console.warn(`Could not identify extension for 'azdata' require call from ${parent.fsPath}. These are the extension path mappings: \n${extensionPathsPretty}`); + this._logService.warn(`Could not identify extension for 'azdata' require call from ${parent.fsPath}. These are the extension path mappings: \n${extensionPathsPretty}`); this._defaultApiImpl = this._apiFactory(nullExtensionDescription); } return this._defaultApiImpl; diff --git a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts index a92ab2ae0b..a08f4243af 100644 --- a/src/sql/workbench/api/common/sqlExtHost.api.impl.ts +++ b/src/sql/workbench/api/common/sqlExtHost.api.impl.ts @@ -70,6 +70,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp const uriTransformer = accessor.get(IURITransformerService); const rpcProtocol = accessor.get(IExtHostRpcService); const extHostLogService = accessor.get(ILogService); + const logService = accessor.get(ILogService); // Addressable instances const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol)); @@ -82,8 +83,8 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp const extHostTasks = rpcProtocol.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(rpcProtocol, extHostLogService)); const extHostBackgroundTaskManagement = rpcProtocol.set(SqlExtHostContext.ExtHostBackgroundTaskManagement, new ExtHostBackgroundTaskManagement(rpcProtocol)); const extHostWebviewWidgets = rpcProtocol.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(rpcProtocol)); - const extHostModelViewTree = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewTreeViews, new ExtHostModelViewTreeViews(rpcProtocol)); - const extHostModelView = rpcProtocol.set(SqlExtHostContext.ExtHostModelView, new ExtHostModelView(rpcProtocol, extHostModelViewTree)); + const extHostModelViewTree = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewTreeViews, new ExtHostModelViewTreeViews(rpcProtocol, logService)); + const extHostModelView = rpcProtocol.set(SqlExtHostContext.ExtHostModelView, new ExtHostModelView(rpcProtocol, extHostModelViewTree, logService)); const extHostDashboard = rpcProtocol.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(rpcProtocol)); const extHostModelViewDialog = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewDialog, new ExtHostModelViewDialog(rpcProtocol, extHostModelView, extHostBackgroundTaskManagement)); const extHostQueryEditor = rpcProtocol.set(SqlExtHostContext.ExtHostQueryEditor, new ExtHostQueryEditor(rpcProtocol)); @@ -91,7 +92,6 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp const extHostNotebookDocumentsAndEditors = rpcProtocol.set(SqlExtHostContext.ExtHostNotebookDocumentsAndEditors, new ExtHostNotebookDocumentsAndEditors(rpcProtocol)); const extHostExtensionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostExtensionManagement, new ExtHostExtensionManagement(rpcProtocol)); - return { azdata: function (extension: IExtensionDescription): typeof azdata { // namespace: connection @@ -113,7 +113,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp }, // "sqlops" back-compat APIs getActiveConnections(): Thenable { - console.warn('the method azdata.connection.getActiveConnections has been deprecated, replace it with azdata.connection.getConnections'); + logService.warn('the method azdata.connection.getActiveConnections has been deprecated, replace it with azdata.connection.getConnections'); return extHostConnectionManagement.$getActiveConnections(); }, getCredentials(connectionId: string): Thenable<{ [name: string]: string }> { diff --git a/src/sql/workbench/browser/modelComponents/splitviewContainer.component.ts b/src/sql/workbench/browser/modelComponents/splitviewContainer.component.ts index da44e88185..fd5e59769a 100644 --- a/src/sql/workbench/browser/modelComponents/splitviewContainer.component.ts +++ b/src/sql/workbench/browser/modelComponents/splitviewContainer.component.ts @@ -12,6 +12,7 @@ import { ContainerBase, ComponentBase } from 'sql/workbench/browser/modelCompone import { Event } from 'vs/base/common/event'; import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview'; import { IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces'; +import { ILogService } from 'vs/platform/log/common/log'; class SplitPane implements IView { orientation: Orientation; @@ -63,7 +64,8 @@ export default class SplitViewContainer extends ContainerBase im constructor( @Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef, - @Inject(forwardRef(() => ElementRef)) el: ElementRef + @Inject(forwardRef(() => ElementRef)) el: ElementRef, + @Inject(ILogService) private readonly logService: ILogService ) { super(changeRef, el); this._flexFlow = ''; // default @@ -117,7 +119,7 @@ export default class SplitViewContainer extends ContainerBase im this._splitView.addView(view, Sizing.Distribute); } else { - console.log('Could not add views inside split view container'); + this.logService.warn('Could not add views inside split view container'); } }); }); diff --git a/src/sql/workbench/contrib/backup/browser/backupDialog.ts b/src/sql/workbench/contrib/backup/browser/backupDialog.ts index 8176398b48..d27e334146 100644 --- a/src/sql/workbench/contrib/backup/browser/backupDialog.ts +++ b/src/sql/workbench/contrib/backup/browser/backupDialog.ts @@ -55,7 +55,7 @@ export class BackupDialog extends Modal { * Get the bootstrap params and perform the bootstrap */ private bootstrapAngular(bodyContainer: HTMLElement) { - bootstrapAngular(this._instantiationService, + this._instantiationService.invokeFunction(bootstrapAngular, BackupModule, bodyContainer, BACKUP_SELECTOR, diff --git a/src/sql/workbench/contrib/dashboard/browser/dashboardEditor.ts b/src/sql/workbench/contrib/dashboard/browser/dashboardEditor.ts index ddefc597f7..22d79718a2 100644 --- a/src/sql/workbench/contrib/dashboard/browser/dashboardEditor.ts +++ b/src/sql/workbench/contrib/dashboard/browser/dashboardEditor.ts @@ -126,7 +126,7 @@ export class DashboardEditor extends BaseEditor { input.hasBootstrapped = true; - const uniqueSelector = bootstrapAngular(this.instantiationService, + const uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular, DashboardModule, this._dashboardContainer, DASHBOARD_SELECTOR, diff --git a/src/sql/workbench/contrib/dataExplorer/browser/connectionViewletPanel.ts b/src/sql/workbench/contrib/dataExplorer/browser/connectionViewletPanel.ts index 78af40bc1c..37987f704e 100644 --- a/src/sql/workbench/contrib/dataExplorer/browser/connectionViewletPanel.ts +++ b/src/sql/workbench/contrib/dataExplorer/browser/connectionViewletPanel.ts @@ -23,6 +23,7 @@ import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/vie import { IViewDescriptorService } from 'vs/workbench/common/views'; import { IOpenerService } from 'vs/platform/opener/common/opener'; import { IThemeService } from 'vs/platform/theme/common/themeService'; +import { ILogService } from 'vs/platform/log/common/log'; export class ConnectionViewletPanel extends ViewPane { @@ -44,7 +45,8 @@ export class ConnectionViewletPanel extends ViewPane { @IContextKeyService contextKeyService: IContextKeyService, @IViewDescriptorService viewDescriptorService: IViewDescriptorService, @IOpenerService protected openerService: IOpenerService, - @IThemeService protected themeService: IThemeService + @IThemeService protected themeService: IThemeService, + @ILogService private readonly logService: ILogService ) { super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, opener, themeService); this._addServerAction = this.instantiationService.createInstance(AddServerAction, @@ -73,7 +75,7 @@ export class ConnectionViewletPanel extends ViewPane { const viewletContainer = DOM.append(container, DOM.$('div.server-explorer-viewlet')); const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view')); this._serverTreeView.renderBody(viewContainer).then(undefined, error => { - console.warn('render registered servers: ' + error); + this.logService.warn('render registered servers: ' + error); }); this._root = container; } diff --git a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts index da04bfbcba..ea7cd03806 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebook.component.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebook.component.ts @@ -445,7 +445,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe () => this.nextPage(), this.navigationResult.next ? true : false); this.detectChanges(); }, err => { - console.log(err); + this.logService.info(err); }); } } diff --git a/src/sql/workbench/contrib/notebook/browser/notebookEditor.ts b/src/sql/workbench/contrib/notebook/browser/notebookEditor.ts index 9cda0b57d9..7088f7eec2 100644 --- a/src/sql/workbench/contrib/notebook/browser/notebookEditor.ts +++ b/src/sql/workbench/contrib/notebook/browser/notebookEditor.ts @@ -227,7 +227,7 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle providerInfo: input.getProviderInfo(), profile: input.connectionProfile }; - bootstrapAngular(this._instantiationService, + this._instantiationService.invokeFunction(bootstrapAngular, NotebookModule, this._notebookContainer, NOTEBOOK_SELECTOR, diff --git a/src/sql/workbench/contrib/query/browser/modelViewTab/queryModelViewTab.ts b/src/sql/workbench/contrib/query/browser/modelViewTab/queryModelViewTab.ts index 2d252100ea..8543a2b89a 100644 --- a/src/sql/workbench/contrib/query/browser/modelViewTab/queryModelViewTab.ts +++ b/src/sql/workbench/contrib/query/browser/modelViewTab/queryModelViewTab.ts @@ -78,7 +78,7 @@ export class QueryModelViewTabView implements IPanelView { * Load the angular components and record for this input that we have done so */ private bootstrapAngular(container: HTMLElement): string { - let uniqueSelector = bootstrapAngular(this._instantiationService, + let uniqueSelector = this._instantiationService.invokeFunction(bootstrapAngular, QueryModelViewTabModule, container, 'querytab-modelview-container', diff --git a/src/sql/workbench/contrib/query/browser/queryActions.ts b/src/sql/workbench/contrib/query/browser/queryActions.ts index 5806ed11fa..05c2c3ec0f 100644 --- a/src/sql/workbench/contrib/query/browser/queryActions.ts +++ b/src/sql/workbench/contrib/query/browser/queryActions.ts @@ -42,6 +42,7 @@ import { TreeViewItemHandleArg } from 'sql/workbench/common/views'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile'; import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement'; +import { ILogService } from 'vs/platform/log/common/log'; /** * Action class that query-based Actions will extend. This base class automatically handles activating and @@ -268,7 +269,8 @@ export class CancelQueryAction extends QueryTaskbarAction { constructor( editor: QueryEditor, @IQueryModelService private readonly queryModelService: IQueryModelService, - @IConnectionManagementService connectionManagementService: IConnectionManagementService + @IConnectionManagementService connectionManagementService: IConnectionManagementService, + @ILogService private readonly logService: ILogService ) { super(connectionManagementService, editor, CancelQueryAction.ID, CancelQueryAction.EnabledClass); this.enabled = false; @@ -278,7 +280,7 @@ export class CancelQueryAction extends QueryTaskbarAction { public async run(): Promise { if (this.isConnected(this.editor)) { if (!this.editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } this.queryModelService.cancelQuery(this.editor.input.uri); @@ -526,7 +528,8 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction { private _isSqlCmdMode: boolean, @IQueryManagementService protected readonly queryManagementService: IQueryManagementService, @IConfigurationService protected readonly configurationService: IConfigurationService, - @IConnectionManagementService connectionManagementService: IConnectionManagementService + @IConnectionManagementService connectionManagementService: IConnectionManagementService, + @ILogService private readonly logService: ILogService ) { super(connectionManagementService, editor, ToggleSqlCmdModeAction.ID, undefined); } @@ -554,7 +557,7 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction { let queryoptions: QueryExecutionOptions = { options: {} }; queryoptions.options['isSqlCmdMode'] = toSqlCmdState; if (!this.editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } this.queryManagementService.setQueryExecutionOptions(this.editor.input.uri, queryoptions); @@ -586,7 +589,8 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt @IContextViewService contextViewProvider: IContextViewService, @IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService, @INotificationService private readonly notificationService: INotificationService, - @IConfigurationService private readonly configurationService: IConfigurationService + @IConfigurationService private readonly configurationService: IConfigurationService, + @ILogService private readonly logService: ILogService ) { super(); this._databaseListDropdown = $('.databaseListDropdown'); @@ -680,7 +684,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt // PRIVATE HELPERS ///////////////////////////////////////////////////// private databaseSelected(dbName: string): void { if (!this._editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } @@ -716,7 +720,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt private getCurrentDatabaseName(): string | undefined { if (!this._editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return undefined; } @@ -744,7 +748,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt } if (!this._editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } @@ -758,7 +762,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt private onDropdownFocus(): void { if (!this._editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } @@ -782,7 +786,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt if (this._isInAccessibilityMode) { this._databaseSelectBox.enable(); if (!this._editor.input) { - console.error('editor input was null'); + this.logService.error('editor input was null'); return; } let uri = this._editor.input.uri; diff --git a/src/sql/workbench/contrib/query/test/browser/queryActions.test.ts b/src/sql/workbench/contrib/query/test/browser/queryActions.test.ts index a6e2ded637..7e082545a1 100644 --- a/src/sql/workbench/contrib/query/test/browser/queryActions.test.ts +++ b/src/sql/workbench/contrib/query/test/browser/queryActions.test.ts @@ -333,7 +333,7 @@ suite('SQL QueryAction Tests', () => { }); // If I call run on CancelQueryAction when I am not connected - let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object); + let queryAction: CancelQueryAction = new CancelQueryAction(editor.object, queryModelService.object, connectionManagementService.object, undefined); isConnected = false; await queryAction.run(); @@ -467,7 +467,7 @@ suite('SQL QueryAction Tests', () => { }); // If I query without having initialized anything, state should be clear - listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object); + listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); assert.equal(listItem.isEnabled(), false, 'do not expect dropdown enabled unless connected'); assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries unless connected'); @@ -498,7 +498,7 @@ suite('SQL QueryAction Tests', () => { connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => { databaseName: databaseName }); // ... Create a database dropdown that has been connected - let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); listItem.onConnected(); // If: I raise a connection changed event @@ -520,7 +520,7 @@ suite('SQL QueryAction Tests', () => { connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => { databaseName: databaseName }); // ... Create a database dropdown that has been connected - let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); listItem.onConnected(); // If: I raise a connection changed event for the 'wrong' URI @@ -545,7 +545,7 @@ suite('SQL QueryAction Tests', () => { connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event); // ... Create a database dropdown - let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object); + let listItem = new ListDatabasesActionItem(editor.object, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); // If: I raise a connection changed event let eventParams = { diff --git a/src/sql/workbench/contrib/query/test/browser/queryEditor.test.ts b/src/sql/workbench/contrib/query/test/browser/queryEditor.test.ts index 1ec51ba3d1..4c7847cf72 100644 --- a/src/sql/workbench/contrib/query/test/browser/queryEditor.test.ts +++ b/src/sql/workbench/contrib/query/test/browser/queryEditor.test.ts @@ -63,7 +63,7 @@ suite('SQL QueryEditor Tests', () => { instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => { if (classDef.ID) { if (classDef.ID === 'listDatabaseQueryActionItem') { - return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object); + return new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); } } // Default @@ -295,7 +295,7 @@ suite('SQL QueryEditor Tests', () => { queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())) .returns((definition, editor, action, selectBox) => { if (definition.ID === 'listDatabaseQueryActionItem') { - let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object); + let item = new ListDatabasesActionItem(editor, undefined, connectionManagementService.object, undefined, configurationService.object, undefined); return item; } // Default diff --git a/src/sql/workbench/contrib/queryPlan/browser/queryPlanEditor.ts b/src/sql/workbench/contrib/queryPlan/browser/queryPlanEditor.ts index 06e046ad60..29dc3724c6 100644 --- a/src/sql/workbench/contrib/queryPlan/browser/queryPlanEditor.ts +++ b/src/sql/workbench/contrib/queryPlan/browser/queryPlanEditor.ts @@ -102,7 +102,7 @@ export class QueryPlanEditor extends BaseEditor { planXml: input.planXml }; - let uniqueSelector = bootstrapAngular(this.instantiationService, + let uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular, QueryPlanModule, this.getContainer(), QUERYPLAN_SELECTOR, diff --git a/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts b/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts index 393e1b77eb..00fdfdc591 100644 --- a/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts +++ b/src/sql/workbench/services/accountManagement/browser/accountManagementService.ts @@ -23,6 +23,7 @@ import { URI } from 'vs/base/common/uri'; import { firstIndex } from 'vs/base/common/arrays'; import { values } from 'vs/base/common/collections'; import { onUnexpectedError } from 'vs/base/common/errors'; +import { ILogService } from 'vs/platform/log/common/log'; export class AccountManagementService implements IAccountManagementService { // CONSTANTS /////////////////////////////////////////////////////////// @@ -52,7 +53,8 @@ export class AccountManagementService implements IAccountManagementService { @IInstantiationService private _instantiationService: IInstantiationService, @IStorageService private _storageService: IStorageService, @IClipboardService private _clipboardService: IClipboardService, - @IOpenerService private _openerService: IOpenerService + @IOpenerService private _openerService: IOpenerService, + @ILogService private readonly logService: ILogService ) { // Create the account store if (!this._mementoObj) { @@ -301,7 +303,7 @@ export class AccountManagementService implements IAccountManagementService { this.doWithProvider(providerId, provider => provider.provider.autoOAuthCancelled()) .then( // Swallow errors null, - err => { console.warn(`Error when cancelling auto OAuth: ${err}`); } + err => { this.logService.warn(`Error when cancelling auto OAuth: ${err}`); } ) .then(() => this.autoOAuthDialogController.closeAutoOAuthDialog()); } diff --git a/src/sql/workbench/services/accountManagement/test/browser/accountManagementService.test.ts b/src/sql/workbench/services/accountManagement/test/browser/accountManagementService.test.ts index e7f546964b..5d715a6146 100644 --- a/src/sql/workbench/services/accountManagement/test/browser/accountManagementService.test.ts +++ b/src/sql/workbench/services/accountManagement/test/browser/accountManagementService.test.ts @@ -506,7 +506,7 @@ function getTestState(): AccountManagementState { let mockMemento = {}; // Create the account management service - let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null, null); + let ams = new AccountManagementService(mockMemento, mockInstantiationService.object, new TestStorageService(), null, null, undefined); // Wire up event handlers let evUpdate = new EventVerifierSingle(); diff --git a/src/sql/workbench/services/bootstrap/browser/bootstrapService.ts b/src/sql/workbench/services/bootstrap/browser/bootstrapService.ts index fb7cd57134..b99e3cd46b 100644 --- a/src/sql/workbench/services/bootstrap/browser/bootstrapService.ts +++ b/src/sql/workbench/services/bootstrap/browser/bootstrapService.ts @@ -5,7 +5,7 @@ import { NgModuleRef, PlatformRef, Provider, enableProdMode } from '@angular/core'; import { platformBrowserDynamic } from '@angular/platform-browser-dynamic'; -import { IInstantiationService, _util } from 'vs/platform/instantiation/common/instantiation'; +import { IInstantiationService, _util, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEditorInput } from 'vs/workbench/common/editor'; import { Trace } from 'vs/platform/instantiation/common/instantiationService'; import { values } from 'vs/base/common/map'; @@ -40,14 +40,15 @@ function createUniqueSelector(selector: string): string { let platform: PlatformRef; -export function bootstrapAngular(service: IInstantiationService, moduleType: IModuleFactory, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef) => void): string { +export function bootstrapAngular(accessor: ServicesAccessor, moduleType: IModuleFactory, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef) => void): string { // Create the uniqueSelectorString let uniqueSelectorString = createUniqueSelector(selectorString); let selector = document.createElement(uniqueSelectorString); container.appendChild(selector); + const instantiationService = accessor.get(IInstantiationService); if (!platform) { - service.invokeFunction((accessor) => { + instantiationService.invokeFunction((accessor) => { const environmentService = accessor.get(IEnvironmentService); if (environmentService.isBuilt) { enableProdMode(); @@ -56,7 +57,7 @@ export function bootstrapAngular(service: IInstantiationService, moduleType: platform = platformBrowserDynamic(); } - platform.bootstrapModule(moduleType(params, uniqueSelectorString, service)).then(moduleRef => { + platform.bootstrapModule(moduleType(params, uniqueSelectorString, instantiationService)).then(moduleRef => { if (input) { input.onDispose(() => { moduleRef.destroy(); @@ -66,14 +67,8 @@ export function bootstrapAngular(service: IInstantiationService, moduleType: callbackSetModule(moduleRef); } }).catch((e) => { - service.invokeFunction((accessor) => { - const logService = accessor.get(ILogService); - if (!logService) { - console.error(e); - return; - } - logService.error(e); - }); + const logService = accessor.get(ILogService); + logService.error(e); }); return uniqueSelectorString; diff --git a/src/sql/workbench/services/dialog/browser/dialogPane.ts b/src/sql/workbench/services/dialog/browser/dialogPane.ts index 4d2093d144..e0ff2f000d 100644 --- a/src/sql/workbench/services/dialog/browser/dialogPane.ts +++ b/src/sql/workbench/services/dialog/browser/dialogPane.ts @@ -109,7 +109,7 @@ export class DialogPane extends Disposable implements IThemable { * Bootstrap angular for the dialog's model view controller with the given model view ID */ private initializeModelViewContainer(bodyContainer: HTMLElement, modelViewId: string, tab?: DialogTab) { - bootstrapAngular(this._instantiationService, + this._instantiationService.invokeFunction(bootstrapAngular, DialogModule, bodyContainer, 'dialog-modelview-container', diff --git a/src/sql/workbench/services/dialog/browser/wizardModal.ts b/src/sql/workbench/services/dialog/browser/wizardModal.ts index ea1524ef4d..93734d3a34 100644 --- a/src/sql/workbench/services/dialog/browser/wizardModal.ts +++ b/src/sql/workbench/services/dialog/browser/wizardModal.ts @@ -232,7 +232,7 @@ export class WizardModal extends Modal { * Bootstrap angular for the wizard's left nav bar */ private initializeNavigation(bodyContainer: HTMLElement) { - bootstrapAngular(this._instantiationService, + this._instantiationService.invokeFunction(bootstrapAngular, DialogModule, bodyContainer, 'wizard-navigation', diff --git a/src/sql/workbench/services/dialog/test/electron-browser/dialogPane.test.ts b/src/sql/workbench/services/dialog/test/electron-browser/dialogPane.test.ts index 65d9926a5c..712b7b2474 100644 --- a/src/sql/workbench/services/dialog/test/electron-browser/dialogPane.test.ts +++ b/src/sql/workbench/services/dialog/test/electron-browser/dialogPane.test.ts @@ -9,6 +9,7 @@ import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane'; import { DialogComponentParams } from 'sql/workbench/services/dialog/browser/dialogContainer.component'; import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService'; import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService'; +import { workbenchInstantiationService } from 'vs/workbench/test/electron-browser/workbenchTestServices'; interface BootstrapAngular { @@ -41,7 +42,7 @@ suite('Dialog Pane Tests', () => { }); dialog.content = modelViewId; const themeService = new TestThemeService(); - let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, undefined, themeService, false); + let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, workbenchInstantiationService(), themeService, undefined); dialogPane.createBody(container); assert.equal(bootstrapCalls, 1); }); @@ -56,7 +57,7 @@ suite('Dialog Pane Tests', () => { }); dialog.content = [new DialogTab('', modelViewId)]; const themeService = new TestThemeService(); - let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, undefined, themeService, false); + let dialogPane = new DialogPane(dialog.title, dialog.content, () => undefined, workbenchInstantiationService(), themeService, false); dialogPane.createBody(container); assert.equal(bootstrapCalls, 1); }); @@ -73,7 +74,7 @@ suite('Dialog Pane Tests', () => { let modelViewId2 = 'test_content_2'; dialog.content = [new DialogTab('tab1', modelViewId1), new DialogTab('tab2', modelViewId2)]; const themeService = new TestThemeService(); - let dialogPane = new DialogPane(dialog.title, dialog.content, valid => dialog.notifyValidityChanged(valid), undefined, themeService, false); + let dialogPane = new DialogPane(dialog.title, dialog.content, valid => dialog.notifyValidityChanged(valid), workbenchInstantiationService(), themeService, false); dialogPane.createBody(container); let validityChanges: boolean[] = []; diff --git a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts index 290b3cc8c8..632a5caaab 100644 --- a/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts +++ b/src/sql/workbench/services/notebook/browser/notebookServiceImpl.ts @@ -40,7 +40,6 @@ import { Schemas } from 'vs/base/common/network'; import { ILogService } from 'vs/platform/log/common/log'; import { toErrorMessage } from 'vs/base/common/errorMessage'; import { NotebookChangeType } from 'sql/workbench/services/notebook/common/contracts'; -import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { find, firstIndex } from 'vs/base/common/arrays'; import { onUnexpectedError } from 'vs/base/common/errors'; @@ -129,7 +128,7 @@ export class NotebookService extends Disposable implements INotebookService { @IFileService private readonly _fileService: IFileService, @ILogService private readonly _logService: ILogService, @IQueryManagementService private readonly _queryManagementService: IQueryManagementService, - @IEnvironmentService environmentService: IEnvironmentService + @ILogService private readonly logService: ILogService ) { super(); this._providersMemento = new Memento('notebookProviders', this._storageService); @@ -455,7 +454,7 @@ export class NotebookService extends Disposable implements INotebookService { try { await this._extensionService.whenInstalledExtensionsRegistered(); } catch (error) { - console.error(error); + this.logService.error(error); } instance = await this.waitOnProviderAvailability(providerDescriptor); } else { diff --git a/src/sql/workbench/test/electron-browser/api/extHostModelView.test.ts b/src/sql/workbench/test/electron-browser/api/extHostModelView.test.ts index 68216b2cfe..06c11df9f3 100644 --- a/src/sql/workbench/test/electron-browser/api/extHostModelView.test.ts +++ b/src/sql/workbench/test/electron-browser/api/extHostModelView.test.ts @@ -52,7 +52,7 @@ suite('ExtHostModelView Validation Tests', () => { mockProxy.setup(x => x.$registerEvent(It.isAny(), It.isAny())).returns(() => Promise.resolve()); mockProxy.setup(x => x.$setProperties(It.isAny(), It.isAny(), It.isAny())).returns(() => Promise.resolve()); - extHostModelView = new ExtHostModelView(mainContext, undefined); + extHostModelView = new ExtHostModelView(mainContext, undefined, undefined); }); // Set of general tests using a couple of common components @@ -371,7 +371,7 @@ suite('ExtHostModelView Validation Tests', () => { mockProxy.setup(x => x.$addToContainer(It.isAny(), It.isAny(), It.isAny(), It.isAny())).returns(() => Promise.resolve()); mockProxy.setup(x => x.$removeFromContainer(It.isAny(), It.isAny(), It.isAny())).returns(() => Promise.resolve()); - extHostModelView = new ExtHostModelView(mainContext, undefined); + extHostModelView = new ExtHostModelView(mainContext, undefined, undefined); extHostModelView.$registerProvider(widgetId, async view => { modelView = view; done(); diff --git a/src/vs/workbench/api/common/extHostRequireInterceptor.ts b/src/vs/workbench/api/common/extHostRequireInterceptor.ts index 8892a492b7..8f51cb8668 100644 --- a/src/vs/workbench/api/common/extHostRequireInterceptor.ts +++ b/src/vs/workbench/api/common/extHostRequireInterceptor.ts @@ -60,7 +60,7 @@ export abstract class RequireInterceptor { const extensionPaths = await this._extHostExtensionService.getExtensionPathIndex(); this.register(new VSCodeNodeModuleFactory(this._apiFactory.vscode, extensionPaths, this._extensionRegistry, configProvider, this._logService)); // {{SQL CARBON EDIT}} // add node module - this.register(new AzdataNodeModuleFactory(this._apiFactory.azdata, extensionPaths)); // {{SQL CARBON EDIT}} // add node module + this.register(new AzdataNodeModuleFactory(this._apiFactory.azdata, extensionPaths, this._logService)); // {{SQL CARBON EDIT}} // add node module this.register(this._instaService.createInstance(KeytarNodeModuleFactory)); if (this._initData.remote.isRemote) { this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme)); diff --git a/test/smoke/src/sql/queryEditor/queryEditor.test.ts b/test/smoke/src/sql/queryEditor/queryEditor.test.ts index 98e0344c74..a269a52936 100644 --- a/test/smoke/src/sql/queryEditor/queryEditor.test.ts +++ b/test/smoke/src/sql/queryEditor/queryEditor.test.ts @@ -4,7 +4,7 @@ *--------------------------------------------------------------------------------------------*/ import { Application } from '../../../../automation'; -import * as fs from 'fs'; +import { promises as fs } from 'fs'; import * as os from 'os'; import * as path from 'path'; @@ -13,7 +13,7 @@ export function setup() { it('Can open and edit existing file', async function () { const testFilePath = path.join(os.tmpdir(), 'QueryEditorSmokeTest.sql'); - fs.writeFileSync(testFilePath, ''); + await fs.writeFile(testFilePath, ''); try { const app = this.app as Application; await app.workbench.queryEditors.openFile(testFilePath); @@ -21,7 +21,7 @@ export function setup() { await app.workbench.editor.waitForTypeInEditor(fileBaseName, 'SELECT * FROM sys.tables'); } finally { - fs.unlinkSync(testFilePath); + await fs.unlink(testFilePath); } }); });