mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-17 02:51:36 -05:00
No console linting (#9156)
* add no-console linting and change to just using overrides for sql files * whitespace * fix tests
This commit is contained in:
@@ -506,6 +506,16 @@
|
|||||||
"jsdoc/no-types": "off"
|
"jsdoc/no-types": "off"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"files": [
|
||||||
|
"**/sql/**"
|
||||||
|
],
|
||||||
|
"rules": {
|
||||||
|
"no-sync": "warn",
|
||||||
|
"strict": ["warn", "never"],
|
||||||
|
"no-console": "warn"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"files": [
|
"files": [
|
||||||
"**/vscode.d.ts",
|
"**/vscode.d.ts",
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"extends": ".eslintrc.json",
|
|
||||||
"rules": {
|
|
||||||
"no-sync": "warn",
|
|
||||||
"strict": ["warn", "never"]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -202,13 +202,6 @@ const tsHygieneFilter = [
|
|||||||
'!src/vs/workbench/contrib/extensions/browser/extensionTipsService.ts' // {{SQL CARBON EDIT}} skip this because known issue
|
'!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 = [
|
const copyrightHeaderLines = [
|
||||||
'/*---------------------------------------------------------------------------------------------',
|
'/*---------------------------------------------------------------------------------------------',
|
||||||
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
' * Copyright (c) Microsoft Corporation. All rights reserved.',
|
||||||
@@ -376,20 +369,8 @@ function hygiene(some) {
|
|||||||
errorCount += results.errorCount;
|
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;
|
let count = 0;
|
||||||
return es.merge(typescript, javascript, sqlJavascript)
|
return es.merge(typescript, javascript)
|
||||||
.pipe(es.through(function (data) {
|
.pipe(es.through(function (data) {
|
||||||
count++;
|
count++;
|
||||||
if (process.env['TRAVIS'] && count % 10 === 0) {
|
if (process.env['TRAVIS'] && count % 10 === 0) {
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ export class HeightMap {
|
|||||||
viewItem = this.heightMap[i - 1];
|
viewItem = this.heightMap[i - 1];
|
||||||
|
|
||||||
if (!viewItem) {
|
if (!viewItem) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('view item doesnt exist');
|
console.error('view item doesnt exist');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
@@ -100,6 +101,7 @@ export class HeightMap {
|
|||||||
viewItem = this.heightMap[i];
|
viewItem = this.heightMap[i];
|
||||||
|
|
||||||
if (!viewItem) {
|
if (!viewItem) {
|
||||||
|
// eslint-disable-next-line no-console
|
||||||
console.error('view item doesnt exist');
|
console.error('view item doesnt exist');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { URI } from 'vs/base/common/uri';
|
|||||||
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
import { IConfigurationService, ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||||
import { localize } from 'vs/nls';
|
import { localize } from 'vs/nls';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
|
||||||
export class MainThreadExtensionManagement extends Disposable implements MainThreadExtensionManagementShape {
|
export class MainThreadExtensionManagement extends Disposable implements MainThreadExtensionManagementShape {
|
||||||
@@ -22,7 +23,8 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr
|
|||||||
extHostContext: IExtHostContext,
|
extHostContext: IExtHostContext,
|
||||||
@IExtensionManagementService private _extensionService: IExtensionManagementService,
|
@IExtensionManagementService private _extensionService: IExtensionManagementService,
|
||||||
@IConfigurationService private _configurationService: IConfigurationService,
|
@IConfigurationService private _configurationService: IConfigurationService,
|
||||||
@INotificationService private _notificationService: INotificationService
|
@INotificationService private _notificationService: INotificationService,
|
||||||
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
}
|
}
|
||||||
@@ -32,7 +34,7 @@ export class MainThreadExtensionManagement extends Disposable implements MainThr
|
|||||||
}
|
}
|
||||||
|
|
||||||
public $showObsoleteExtensionApiUsageNotification(message: string): void {
|
public $showObsoleteExtensionApiUsageNotification(message: string): void {
|
||||||
console.warn(message);
|
this.logService.warn(message);
|
||||||
|
|
||||||
if (this._obsoleteExtensionApiUsageNotificationShown) {
|
if (this._obsoleteExtensionApiUsageNotificationShown) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ export class MainThreadQueryEditor extends Disposable implements MainThreadQuery
|
|||||||
let profile: IConnectionProfile = MainThreadQueryEditor.connectionProfileToIConnectionProfile(connection);
|
let profile: IConnectionProfile = MainThreadQueryEditor.connectionProfileToIConnectionProfile(connection);
|
||||||
let connectionResult = await this._connectionManagementService.connect(profile, fileUri, options);
|
let connectionResult = await this._connectionManagementService.connect(profile, fileUri, options);
|
||||||
if (connectionResult && connectionResult.connected) {
|
if (connectionResult && connectionResult.connected) {
|
||||||
console.log(`editor ${fileUri} connected`);
|
this._logService.info(`editor ${fileUri} connected`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import { SqlMainContext, ExtHostModelViewShape, MainThreadModelViewShape, ExtHos
|
|||||||
import { IItemConfig, ModelComponentTypes, IComponentShape, IComponentEventArgs, ComponentEventType, ColumnSizingMode } from 'sql/workbench/api/common/sqlExtHostTypes';
|
import { IItemConfig, ModelComponentTypes, IComponentShape, IComponentEventArgs, ComponentEventType, ColumnSizingMode } from 'sql/workbench/api/common/sqlExtHostTypes';
|
||||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||||
import { firstIndex } from 'vs/base/common/arrays';
|
import { firstIndex } from 'vs/base/common/arrays';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
class ModelBuilderImpl implements azdata.ModelBuilder {
|
class ModelBuilderImpl implements azdata.ModelBuilder {
|
||||||
private nextComponentId: number;
|
private nextComponentId: number;
|
||||||
@@ -25,7 +26,8 @@ class ModelBuilderImpl implements azdata.ModelBuilder {
|
|||||||
private readonly _proxy: MainThreadModelViewShape,
|
private readonly _proxy: MainThreadModelViewShape,
|
||||||
private readonly _handle: number,
|
private readonly _handle: number,
|
||||||
private readonly _extHostModelViewTree: ExtHostModelViewTreeViewsShape,
|
private readonly _extHostModelViewTree: ExtHostModelViewTreeViewsShape,
|
||||||
private readonly _extension: IExtensionDescription
|
private readonly _extension: IExtensionDescription,
|
||||||
|
private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
this.nextComponentId = 0;
|
this.nextComponentId = 0;
|
||||||
}
|
}
|
||||||
@@ -82,7 +84,7 @@ class ModelBuilderImpl implements azdata.ModelBuilder {
|
|||||||
private cardDeprecationMessagePrinted = false;
|
private cardDeprecationMessagePrinted = false;
|
||||||
card(): azdata.ComponentBuilder<azdata.CardComponent> {
|
card(): azdata.ComponentBuilder<azdata.CardComponent> {
|
||||||
if (!this.cardDeprecationMessagePrinted) {
|
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;
|
this.cardDeprecationMessagePrinted = true;
|
||||||
}
|
}
|
||||||
let id = this.getNextComponentId();
|
let id = this.getNextComponentId();
|
||||||
@@ -1699,9 +1701,10 @@ class ModelViewImpl implements azdata.ModelView {
|
|||||||
private readonly _connection: azdata.connection.Connection,
|
private readonly _connection: azdata.connection.Connection,
|
||||||
private readonly _serverInfo: azdata.ServerInfo,
|
private readonly _serverInfo: azdata.ServerInfo,
|
||||||
private readonly _extHostModelViewTree: ExtHostModelViewTreeViewsShape,
|
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<any> {
|
public get onClosed(): vscode.Event<any> {
|
||||||
@@ -1755,7 +1758,8 @@ export class ExtHostModelView implements ExtHostModelViewShape {
|
|||||||
private readonly _handlerToExtension = new Map<string, IExtensionDescription>();
|
private readonly _handlerToExtension = new Map<string, IExtensionDescription>();
|
||||||
constructor(
|
constructor(
|
||||||
_mainContext: IMainContext,
|
_mainContext: IMainContext,
|
||||||
private _extHostModelViewTree: ExtHostModelViewTreeViewsShape
|
private _extHostModelViewTree: ExtHostModelViewTreeViewsShape,
|
||||||
|
private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
this._proxy = _mainContext.getProxy(SqlMainContext.MainThreadModelView);
|
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 {
|
$registerWidget(handle: number, id: string, connection: azdata.connection.Connection, serverInfo: azdata.ServerInfo): void {
|
||||||
let extension = this._handlerToExtension.get(id);
|
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._modelViews.set(handle, view);
|
||||||
this._handlers.get(id)(view);
|
this._handlers.get(id)(view);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import * as vsTreeExt from 'vs/workbench/api/common/extHostTreeViews';
|
|||||||
import { Emitter } from 'vs/base/common/event';
|
import { Emitter } from 'vs/base/common/event';
|
||||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||||
import { assign } from 'vs/base/common/objects';
|
import { assign } from 'vs/base/common/objects';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape {
|
export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape {
|
||||||
private _proxy: MainThreadModelViewShape;
|
private _proxy: MainThreadModelViewShape;
|
||||||
@@ -21,7 +22,8 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
|
|||||||
private treeViews: Map<string, ExtHostTreeView<any>> = new Map<string, ExtHostTreeView<any>>();
|
private treeViews: Map<string, ExtHostTreeView<any>> = new Map<string, ExtHostTreeView<any>>();
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private _mainContext: IMainContext
|
private _mainContext: IMainContext,
|
||||||
|
private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
this._proxy = this._mainContext.getProxy(SqlMainContext.MainThreadModelView);
|
this._proxy = this._mainContext.getProxy(SqlMainContext.MainThreadModelView);
|
||||||
}
|
}
|
||||||
@@ -31,7 +33,7 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
|
|||||||
throw new Error('Options with treeDataProvider is mandatory');
|
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 {
|
return {
|
||||||
dispose: () => {
|
dispose: () => {
|
||||||
this.treeViews.delete(componentId);
|
this.treeViews.delete(componentId);
|
||||||
@@ -74,8 +76,8 @@ export class ExtHostModelViewTreeViews implements ExtHostModelViewTreeViewsShape
|
|||||||
$setVisible(treeViewId: string, visible: boolean): void {
|
$setVisible(treeViewId: string, visible: boolean): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
private createExtHostTreeViewer<T>(handle: number, id: string, dataProvider: azdata.TreeComponentDataProvider<T>, extension: IExtensionDescription): ExtHostTreeView<T> {
|
private createExtHostTreeViewer<T>(handle: number, id: string, dataProvider: azdata.TreeComponentDataProvider<T>, extension: IExtensionDescription, logService: ILogService): ExtHostTreeView<T> {
|
||||||
const treeView = new ExtHostTreeView<T>(handle, id, dataProvider, this._proxy, undefined, extension);
|
const treeView = new ExtHostTreeView<T>(handle, id, dataProvider, this._proxy, undefined, extension, logService);
|
||||||
this.treeViews.set(`${handle}-${id}`, treeView);
|
this.treeViews.set(`${handle}-${id}`, treeView);
|
||||||
return treeView;
|
return treeView;
|
||||||
}
|
}
|
||||||
@@ -89,14 +91,15 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
|||||||
public readonly ChangeSelection: vscode.Event<vscode.TreeViewSelectionChangeEvent<T>> = this._onChangeSelection.event;
|
public readonly ChangeSelection: vscode.Event<vscode.TreeViewSelectionChangeEvent<T>> = this._onChangeSelection.event;
|
||||||
constructor(
|
constructor(
|
||||||
private handle: number, private componentId: string, private componentDataProvider: azdata.TreeComponentDataProvider<T>,
|
private handle: number, private componentId: string, private componentDataProvider: azdata.TreeComponentDataProvider<T>,
|
||||||
private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter, extension: IExtensionDescription) {
|
private modelViewProxy: MainThreadModelViewShape, commands: CommandsConverter, extension: IExtensionDescription,
|
||||||
super(componentId, { treeDataProvider: componentDataProvider }, undefined, commands, undefined, extension);
|
private readonly _logService: ILogService) {
|
||||||
|
super(componentId, { treeDataProvider: componentDataProvider }, undefined, commands, _logService, extension);
|
||||||
}
|
}
|
||||||
|
|
||||||
onNodeCheckedChanged(parentHandle?: vsTreeExt.TreeItemHandle, checked?: boolean): void {
|
onNodeCheckedChanged(parentHandle?: vsTreeExt.TreeItemHandle, checked?: boolean): void {
|
||||||
const parentElement = parentHandle ? this.getExtensionElement(parentHandle) : void 0;
|
const parentElement = parentHandle ? this.getExtensionElement(parentHandle) : void 0;
|
||||||
if (parentHandle && !parentElement) {
|
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 });
|
this._onNodeCheckedChanged.fire({ element: parentElement, checked: checked });
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ import { ExtensionIdentifier, IExtensionDescription } from 'vs/platform/extensio
|
|||||||
import * as azdata from 'azdata';
|
import * as azdata from 'azdata';
|
||||||
import { IAzdataExtensionApiFactory } from 'sql/workbench/api/common/sqlExtHost.api.impl';
|
import { IAzdataExtensionApiFactory } from 'sql/workbench/api/common/sqlExtHost.api.impl';
|
||||||
import { INodeModuleFactory } from 'vs/workbench/api/common/extHostRequireInterceptor';
|
import { INodeModuleFactory } from 'vs/workbench/api/common/extHostRequireInterceptor';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
export class AzdataNodeModuleFactory implements INodeModuleFactory {
|
export class AzdataNodeModuleFactory implements INodeModuleFactory {
|
||||||
public readonly nodeModuleName = 'azdata';
|
public readonly nodeModuleName = 'azdata';
|
||||||
@@ -19,7 +20,8 @@ export class AzdataNodeModuleFactory implements INodeModuleFactory {
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private readonly _apiFactory: IAzdataExtensionApiFactory,
|
private readonly _apiFactory: IAzdataExtensionApiFactory,
|
||||||
private readonly _extensionPaths: TernarySearchTree<IExtensionDescription>
|
private readonly _extensionPaths: TernarySearchTree<IExtensionDescription>,
|
||||||
|
private readonly _logService: ILogService
|
||||||
) {
|
) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -40,7 +42,7 @@ export class AzdataNodeModuleFactory implements INodeModuleFactory {
|
|||||||
if (!this._defaultApiImpl) {
|
if (!this._defaultApiImpl) {
|
||||||
let extensionPathsPretty = '';
|
let extensionPathsPretty = '';
|
||||||
this._extensionPaths.forEach((value, index) => extensionPathsPretty += `\t${index} -> ${value.identifier.value}\n`);
|
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);
|
this._defaultApiImpl = this._apiFactory(nullExtensionDescription);
|
||||||
}
|
}
|
||||||
return this._defaultApiImpl;
|
return this._defaultApiImpl;
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
|||||||
const uriTransformer = accessor.get(IURITransformerService);
|
const uriTransformer = accessor.get(IURITransformerService);
|
||||||
const rpcProtocol = accessor.get(IExtHostRpcService);
|
const rpcProtocol = accessor.get(IExtHostRpcService);
|
||||||
const extHostLogService = accessor.get(ILogService);
|
const extHostLogService = accessor.get(ILogService);
|
||||||
|
const logService = accessor.get(ILogService);
|
||||||
|
|
||||||
// Addressable instances
|
// Addressable instances
|
||||||
const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol));
|
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 extHostTasks = rpcProtocol.set(SqlExtHostContext.ExtHostTasks, new ExtHostTasks(rpcProtocol, extHostLogService));
|
||||||
const extHostBackgroundTaskManagement = rpcProtocol.set(SqlExtHostContext.ExtHostBackgroundTaskManagement, new ExtHostBackgroundTaskManagement(rpcProtocol));
|
const extHostBackgroundTaskManagement = rpcProtocol.set(SqlExtHostContext.ExtHostBackgroundTaskManagement, new ExtHostBackgroundTaskManagement(rpcProtocol));
|
||||||
const extHostWebviewWidgets = rpcProtocol.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(rpcProtocol));
|
const extHostWebviewWidgets = rpcProtocol.set(SqlExtHostContext.ExtHostDashboardWebviews, new ExtHostDashboardWebviews(rpcProtocol));
|
||||||
const extHostModelViewTree = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewTreeViews, new ExtHostModelViewTreeViews(rpcProtocol));
|
const extHostModelViewTree = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewTreeViews, new ExtHostModelViewTreeViews(rpcProtocol, logService));
|
||||||
const extHostModelView = rpcProtocol.set(SqlExtHostContext.ExtHostModelView, new ExtHostModelView(rpcProtocol, extHostModelViewTree));
|
const extHostModelView = rpcProtocol.set(SqlExtHostContext.ExtHostModelView, new ExtHostModelView(rpcProtocol, extHostModelViewTree, logService));
|
||||||
const extHostDashboard = rpcProtocol.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(rpcProtocol));
|
const extHostDashboard = rpcProtocol.set(SqlExtHostContext.ExtHostDashboard, new ExtHostDashboard(rpcProtocol));
|
||||||
const extHostModelViewDialog = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewDialog, new ExtHostModelViewDialog(rpcProtocol, extHostModelView, extHostBackgroundTaskManagement));
|
const extHostModelViewDialog = rpcProtocol.set(SqlExtHostContext.ExtHostModelViewDialog, new ExtHostModelViewDialog(rpcProtocol, extHostModelView, extHostBackgroundTaskManagement));
|
||||||
const extHostQueryEditor = rpcProtocol.set(SqlExtHostContext.ExtHostQueryEditor, new ExtHostQueryEditor(rpcProtocol));
|
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 extHostNotebookDocumentsAndEditors = rpcProtocol.set(SqlExtHostContext.ExtHostNotebookDocumentsAndEditors, new ExtHostNotebookDocumentsAndEditors(rpcProtocol));
|
||||||
const extHostExtensionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostExtensionManagement, new ExtHostExtensionManagement(rpcProtocol));
|
const extHostExtensionManagement = rpcProtocol.set(SqlExtHostContext.ExtHostExtensionManagement, new ExtHostExtensionManagement(rpcProtocol));
|
||||||
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
azdata: function (extension: IExtensionDescription): typeof azdata {
|
azdata: function (extension: IExtensionDescription): typeof azdata {
|
||||||
// namespace: connection
|
// namespace: connection
|
||||||
@@ -113,7 +113,7 @@ export function createAdsApiFactory(accessor: ServicesAccessor): IAdsExtensionAp
|
|||||||
},
|
},
|
||||||
// "sqlops" back-compat APIs
|
// "sqlops" back-compat APIs
|
||||||
getActiveConnections(): Thenable<azdata.connection.Connection[]> {
|
getActiveConnections(): Thenable<azdata.connection.Connection[]> {
|
||||||
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();
|
return extHostConnectionManagement.$getActiveConnections();
|
||||||
},
|
},
|
||||||
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
getCredentials(connectionId: string): Thenable<{ [name: string]: string }> {
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import { ContainerBase, ComponentBase } from 'sql/workbench/browser/modelCompone
|
|||||||
import { Event } from 'vs/base/common/event';
|
import { Event } from 'vs/base/common/event';
|
||||||
import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview';
|
import { SplitView, Orientation, Sizing, IView } from 'vs/base/browser/ui/splitview/splitview';
|
||||||
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/platform/dashboard/browser/interfaces';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
class SplitPane implements IView {
|
class SplitPane implements IView {
|
||||||
orientation: Orientation;
|
orientation: Orientation;
|
||||||
@@ -63,7 +64,8 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
|||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef
|
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||||
|
@Inject(ILogService) private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super(changeRef, el);
|
super(changeRef, el);
|
||||||
this._flexFlow = ''; // default
|
this._flexFlow = ''; // default
|
||||||
@@ -117,7 +119,7 @@ export default class SplitViewContainer extends ContainerBase<FlexItemLayout> im
|
|||||||
this._splitView.addView(view, Sizing.Distribute);
|
this._splitView.addView(view, Sizing.Distribute);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
console.log('Could not add views inside split view container');
|
this.logService.warn('Could not add views inside split view container');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ export class BackupDialog extends Modal {
|
|||||||
* Get the bootstrap params and perform the bootstrap
|
* Get the bootstrap params and perform the bootstrap
|
||||||
*/
|
*/
|
||||||
private bootstrapAngular(bodyContainer: HTMLElement) {
|
private bootstrapAngular(bodyContainer: HTMLElement) {
|
||||||
bootstrapAngular(this._instantiationService,
|
this._instantiationService.invokeFunction(bootstrapAngular,
|
||||||
BackupModule,
|
BackupModule,
|
||||||
bodyContainer,
|
bodyContainer,
|
||||||
BACKUP_SELECTOR,
|
BACKUP_SELECTOR,
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ export class DashboardEditor extends BaseEditor {
|
|||||||
|
|
||||||
input.hasBootstrapped = true;
|
input.hasBootstrapped = true;
|
||||||
|
|
||||||
const uniqueSelector = bootstrapAngular(this.instantiationService,
|
const uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular,
|
||||||
DashboardModule,
|
DashboardModule,
|
||||||
this._dashboardContainer,
|
this._dashboardContainer,
|
||||||
DASHBOARD_SELECTOR,
|
DASHBOARD_SELECTOR,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { ViewPane, IViewPaneOptions } from 'vs/workbench/browser/parts/views/vie
|
|||||||
import { IViewDescriptorService } from 'vs/workbench/common/views';
|
import { IViewDescriptorService } from 'vs/workbench/common/views';
|
||||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
export class ConnectionViewletPanel extends ViewPane {
|
export class ConnectionViewletPanel extends ViewPane {
|
||||||
|
|
||||||
@@ -44,7 +45,8 @@ export class ConnectionViewletPanel extends ViewPane {
|
|||||||
@IContextKeyService contextKeyService: IContextKeyService,
|
@IContextKeyService contextKeyService: IContextKeyService,
|
||||||
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
@IViewDescriptorService viewDescriptorService: IViewDescriptorService,
|
||||||
@IOpenerService protected openerService: IOpenerService,
|
@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);
|
super({ ...(options as IViewPaneOptions), ariaHeaderLabel: options.title }, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, opener, themeService);
|
||||||
this._addServerAction = this.instantiationService.createInstance(AddServerAction,
|
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 viewletContainer = DOM.append(container, DOM.$('div.server-explorer-viewlet'));
|
||||||
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
const viewContainer = DOM.append(viewletContainer, DOM.$('div.object-explorer-view'));
|
||||||
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
this._serverTreeView.renderBody(viewContainer).then(undefined, error => {
|
||||||
console.warn('render registered servers: ' + error);
|
this.logService.warn('render registered servers: ' + error);
|
||||||
});
|
});
|
||||||
this._root = container;
|
this._root = container;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -445,7 +445,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
|||||||
() => this.nextPage(), this.navigationResult.next ? true : false);
|
() => this.nextPage(), this.navigationResult.next ? true : false);
|
||||||
this.detectChanges();
|
this.detectChanges();
|
||||||
}, err => {
|
}, err => {
|
||||||
console.log(err);
|
this.logService.info(err);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -227,7 +227,7 @@ export class NotebookEditor extends BaseEditor implements IFindNotebookControlle
|
|||||||
providerInfo: input.getProviderInfo(),
|
providerInfo: input.getProviderInfo(),
|
||||||
profile: input.connectionProfile
|
profile: input.connectionProfile
|
||||||
};
|
};
|
||||||
bootstrapAngular(this._instantiationService,
|
this._instantiationService.invokeFunction(bootstrapAngular,
|
||||||
NotebookModule,
|
NotebookModule,
|
||||||
this._notebookContainer,
|
this._notebookContainer,
|
||||||
NOTEBOOK_SELECTOR,
|
NOTEBOOK_SELECTOR,
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ export class QueryModelViewTabView implements IPanelView {
|
|||||||
* Load the angular components and record for this input that we have done so
|
* Load the angular components and record for this input that we have done so
|
||||||
*/
|
*/
|
||||||
private bootstrapAngular(container: HTMLElement): string {
|
private bootstrapAngular(container: HTMLElement): string {
|
||||||
let uniqueSelector = bootstrapAngular(this._instantiationService,
|
let uniqueSelector = this._instantiationService.invokeFunction(bootstrapAngular,
|
||||||
QueryModelViewTabModule,
|
QueryModelViewTabModule,
|
||||||
container,
|
container,
|
||||||
'querytab-modelview-container',
|
'querytab-modelview-container',
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ import { TreeViewItemHandleArg } from 'sql/workbench/common/views';
|
|||||||
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||||
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
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
|
* 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(
|
constructor(
|
||||||
editor: QueryEditor,
|
editor: QueryEditor,
|
||||||
@IQueryModelService private readonly queryModelService: IQueryModelService,
|
@IQueryModelService private readonly queryModelService: IQueryModelService,
|
||||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService
|
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||||
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super(connectionManagementService, editor, CancelQueryAction.ID, CancelQueryAction.EnabledClass);
|
super(connectionManagementService, editor, CancelQueryAction.ID, CancelQueryAction.EnabledClass);
|
||||||
this.enabled = false;
|
this.enabled = false;
|
||||||
@@ -278,7 +280,7 @@ export class CancelQueryAction extends QueryTaskbarAction {
|
|||||||
public async run(): Promise<void> {
|
public async run(): Promise<void> {
|
||||||
if (this.isConnected(this.editor)) {
|
if (this.isConnected(this.editor)) {
|
||||||
if (!this.editor.input) {
|
if (!this.editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.queryModelService.cancelQuery(this.editor.input.uri);
|
this.queryModelService.cancelQuery(this.editor.input.uri);
|
||||||
@@ -526,7 +528,8 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
|
|||||||
private _isSqlCmdMode: boolean,
|
private _isSqlCmdMode: boolean,
|
||||||
@IQueryManagementService protected readonly queryManagementService: IQueryManagementService,
|
@IQueryManagementService protected readonly queryManagementService: IQueryManagementService,
|
||||||
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
@IConfigurationService protected readonly configurationService: IConfigurationService,
|
||||||
@IConnectionManagementService connectionManagementService: IConnectionManagementService
|
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
|
||||||
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super(connectionManagementService, editor, ToggleSqlCmdModeAction.ID, undefined);
|
super(connectionManagementService, editor, ToggleSqlCmdModeAction.ID, undefined);
|
||||||
}
|
}
|
||||||
@@ -554,7 +557,7 @@ export class ToggleSqlCmdModeAction extends QueryTaskbarAction {
|
|||||||
let queryoptions: QueryExecutionOptions = { options: {} };
|
let queryoptions: QueryExecutionOptions = { options: {} };
|
||||||
queryoptions.options['isSqlCmdMode'] = toSqlCmdState;
|
queryoptions.options['isSqlCmdMode'] = toSqlCmdState;
|
||||||
if (!this.editor.input) {
|
if (!this.editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.queryManagementService.setQueryExecutionOptions(this.editor.input.uri, queryoptions);
|
this.queryManagementService.setQueryExecutionOptions(this.editor.input.uri, queryoptions);
|
||||||
@@ -586,7 +589,8 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
@IContextViewService contextViewProvider: IContextViewService,
|
@IContextViewService contextViewProvider: IContextViewService,
|
||||||
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
|
||||||
@INotificationService private readonly notificationService: INotificationService,
|
@INotificationService private readonly notificationService: INotificationService,
|
||||||
@IConfigurationService private readonly configurationService: IConfigurationService
|
@IConfigurationService private readonly configurationService: IConfigurationService,
|
||||||
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._databaseListDropdown = $('.databaseListDropdown');
|
this._databaseListDropdown = $('.databaseListDropdown');
|
||||||
@@ -680,7 +684,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
// PRIVATE HELPERS /////////////////////////////////////////////////////
|
// PRIVATE HELPERS /////////////////////////////////////////////////////
|
||||||
private databaseSelected(dbName: string): void {
|
private databaseSelected(dbName: string): void {
|
||||||
if (!this._editor.input) {
|
if (!this._editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -716,7 +720,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
|
|
||||||
private getCurrentDatabaseName(): string | undefined {
|
private getCurrentDatabaseName(): string | undefined {
|
||||||
if (!this._editor.input) {
|
if (!this._editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -744,7 +748,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!this._editor.input) {
|
if (!this._editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -758,7 +762,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
|
|
||||||
private onDropdownFocus(): void {
|
private onDropdownFocus(): void {
|
||||||
if (!this._editor.input) {
|
if (!this._editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -782,7 +786,7 @@ export class ListDatabasesActionItem extends Disposable implements IActionViewIt
|
|||||||
if (this._isInAccessibilityMode) {
|
if (this._isInAccessibilityMode) {
|
||||||
this._databaseSelectBox.enable();
|
this._databaseSelectBox.enable();
|
||||||
if (!this._editor.input) {
|
if (!this._editor.input) {
|
||||||
console.error('editor input was null');
|
this.logService.error('editor input was null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let uri = this._editor.input.uri;
|
let uri = this._editor.input.uri;
|
||||||
|
|||||||
@@ -333,7 +333,7 @@ suite('SQL QueryAction Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// If I call run on CancelQueryAction when I am not connected
|
// 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;
|
isConnected = false;
|
||||||
await queryAction.run();
|
await queryAction.run();
|
||||||
|
|
||||||
@@ -467,7 +467,7 @@ suite('SQL QueryAction Tests', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// If I query without having initialized anything, state should be clear
|
// 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.isEnabled(), false, 'do not expect dropdown enabled unless connected');
|
||||||
assert.equal(listItem.currentDatabaseName, undefined, 'do not expect dropdown to have entries 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(() => <IConnectionProfile>{ databaseName: databaseName });
|
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
|
||||||
|
|
||||||
// ... Create a database dropdown that has been connected
|
// ... 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();
|
listItem.onConnected();
|
||||||
|
|
||||||
// If: I raise a connection changed event
|
// If: I raise a connection changed event
|
||||||
@@ -520,7 +520,7 @@ suite('SQL QueryAction Tests', () => {
|
|||||||
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
|
connectionManagementService.setup(x => x.getConnectionProfile(TypeMoq.It.isAny())).returns(() => <IConnectionProfile>{ databaseName: databaseName });
|
||||||
|
|
||||||
// ... Create a database dropdown that has been connected
|
// ... 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();
|
listItem.onConnected();
|
||||||
|
|
||||||
// If: I raise a connection changed event for the 'wrong' URI
|
// 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);
|
connectionManagementService.setup(x => x.onConnectionChanged).returns(() => dbChangedEmitter.event);
|
||||||
|
|
||||||
// ... Create a database dropdown
|
// ... 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
|
// If: I raise a connection changed event
|
||||||
let eventParams = <IConnectionParams>{
|
let eventParams = <IConnectionParams>{
|
||||||
|
|||||||
@@ -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) => {
|
instantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns((classDef, editor, action) => {
|
||||||
if (classDef.ID) {
|
if (classDef.ID) {
|
||||||
if (classDef.ID === 'listDatabaseQueryActionItem') {
|
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
|
// Default
|
||||||
@@ -295,7 +295,7 @@ suite('SQL QueryEditor Tests', () => {
|
|||||||
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
queryActionInstantiationService.setup(x => x.createInstance(TypeMoq.It.isAny(), TypeMoq.It.isAny(), TypeMoq.It.isAny()))
|
||||||
.returns((definition, editor, action, selectBox) => {
|
.returns((definition, editor, action, selectBox) => {
|
||||||
if (definition.ID === 'listDatabaseQueryActionItem') {
|
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;
|
return item;
|
||||||
}
|
}
|
||||||
// Default
|
// Default
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export class QueryPlanEditor extends BaseEditor {
|
|||||||
planXml: input.planXml
|
planXml: input.planXml
|
||||||
};
|
};
|
||||||
|
|
||||||
let uniqueSelector = bootstrapAngular(this.instantiationService,
|
let uniqueSelector = this.instantiationService.invokeFunction(bootstrapAngular,
|
||||||
QueryPlanModule,
|
QueryPlanModule,
|
||||||
this.getContainer(),
|
this.getContainer(),
|
||||||
QUERYPLAN_SELECTOR,
|
QUERYPLAN_SELECTOR,
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import { URI } from 'vs/base/common/uri';
|
|||||||
import { firstIndex } from 'vs/base/common/arrays';
|
import { firstIndex } from 'vs/base/common/arrays';
|
||||||
import { values } from 'vs/base/common/collections';
|
import { values } from 'vs/base/common/collections';
|
||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
|
|
||||||
export class AccountManagementService implements IAccountManagementService {
|
export class AccountManagementService implements IAccountManagementService {
|
||||||
// CONSTANTS ///////////////////////////////////////////////////////////
|
// CONSTANTS ///////////////////////////////////////////////////////////
|
||||||
@@ -52,7 +53,8 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
@IInstantiationService private _instantiationService: IInstantiationService,
|
@IInstantiationService private _instantiationService: IInstantiationService,
|
||||||
@IStorageService private _storageService: IStorageService,
|
@IStorageService private _storageService: IStorageService,
|
||||||
@IClipboardService private _clipboardService: IClipboardService,
|
@IClipboardService private _clipboardService: IClipboardService,
|
||||||
@IOpenerService private _openerService: IOpenerService
|
@IOpenerService private _openerService: IOpenerService,
|
||||||
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
// Create the account store
|
// Create the account store
|
||||||
if (!this._mementoObj) {
|
if (!this._mementoObj) {
|
||||||
@@ -301,7 +303,7 @@ export class AccountManagementService implements IAccountManagementService {
|
|||||||
this.doWithProvider(providerId, provider => provider.provider.autoOAuthCancelled())
|
this.doWithProvider(providerId, provider => provider.provider.autoOAuthCancelled())
|
||||||
.then( // Swallow errors
|
.then( // Swallow errors
|
||||||
null,
|
null,
|
||||||
err => { console.warn(`Error when cancelling auto OAuth: ${err}`); }
|
err => { this.logService.warn(`Error when cancelling auto OAuth: ${err}`); }
|
||||||
)
|
)
|
||||||
.then(() => this.autoOAuthDialogController.closeAutoOAuthDialog());
|
.then(() => this.autoOAuthDialogController.closeAutoOAuthDialog());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -506,7 +506,7 @@ function getTestState(): AccountManagementState {
|
|||||||
let mockMemento = {};
|
let mockMemento = {};
|
||||||
|
|
||||||
// Create the account management service
|
// 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
|
// Wire up event handlers
|
||||||
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();
|
let evUpdate = new EventVerifierSingle<UpdateAccountListEventParams>();
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import { NgModuleRef, PlatformRef, Provider, enableProdMode } from '@angular/core';
|
import { NgModuleRef, PlatformRef, Provider, enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
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 { IEditorInput } from 'vs/workbench/common/editor';
|
||||||
import { Trace } from 'vs/platform/instantiation/common/instantiationService';
|
import { Trace } from 'vs/platform/instantiation/common/instantiationService';
|
||||||
import { values } from 'vs/base/common/map';
|
import { values } from 'vs/base/common/map';
|
||||||
@@ -40,14 +40,15 @@ function createUniqueSelector(selector: string): string {
|
|||||||
|
|
||||||
let platform: PlatformRef;
|
let platform: PlatformRef;
|
||||||
|
|
||||||
export function bootstrapAngular<T>(service: IInstantiationService, moduleType: IModuleFactory<T>, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef<T>) => void): string {
|
export function bootstrapAngular<T>(accessor: ServicesAccessor, moduleType: IModuleFactory<T>, container: HTMLElement, selectorString: string, params: IBootstrapParams, input?: IEditorInput, callbackSetModule?: (value: NgModuleRef<T>) => void): string {
|
||||||
// Create the uniqueSelectorString
|
// Create the uniqueSelectorString
|
||||||
let uniqueSelectorString = createUniqueSelector(selectorString);
|
let uniqueSelectorString = createUniqueSelector(selectorString);
|
||||||
let selector = document.createElement(uniqueSelectorString);
|
let selector = document.createElement(uniqueSelectorString);
|
||||||
container.appendChild(selector);
|
container.appendChild(selector);
|
||||||
|
const instantiationService = accessor.get(IInstantiationService);
|
||||||
|
|
||||||
if (!platform) {
|
if (!platform) {
|
||||||
service.invokeFunction((accessor) => {
|
instantiationService.invokeFunction((accessor) => {
|
||||||
const environmentService = accessor.get(IEnvironmentService);
|
const environmentService = accessor.get(IEnvironmentService);
|
||||||
if (environmentService.isBuilt) {
|
if (environmentService.isBuilt) {
|
||||||
enableProdMode();
|
enableProdMode();
|
||||||
@@ -56,7 +57,7 @@ export function bootstrapAngular<T>(service: IInstantiationService, moduleType:
|
|||||||
platform = platformBrowserDynamic();
|
platform = platformBrowserDynamic();
|
||||||
}
|
}
|
||||||
|
|
||||||
platform.bootstrapModule(moduleType(params, uniqueSelectorString, service)).then(moduleRef => {
|
platform.bootstrapModule(moduleType(params, uniqueSelectorString, instantiationService)).then(moduleRef => {
|
||||||
if (input) {
|
if (input) {
|
||||||
input.onDispose(() => {
|
input.onDispose(() => {
|
||||||
moduleRef.destroy();
|
moduleRef.destroy();
|
||||||
@@ -66,15 +67,9 @@ export function bootstrapAngular<T>(service: IInstantiationService, moduleType:
|
|||||||
callbackSetModule(moduleRef);
|
callbackSetModule(moduleRef);
|
||||||
}
|
}
|
||||||
}).catch((e) => {
|
}).catch((e) => {
|
||||||
service.invokeFunction((accessor) => {
|
|
||||||
const logService = accessor.get(ILogService);
|
const logService = accessor.get(ILogService);
|
||||||
if (!logService) {
|
|
||||||
console.error(e);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
logService.error(e);
|
logService.error(e);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
return uniqueSelectorString;
|
return uniqueSelectorString;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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
|
* Bootstrap angular for the dialog's model view controller with the given model view ID
|
||||||
*/
|
*/
|
||||||
private initializeModelViewContainer(bodyContainer: HTMLElement, modelViewId: string, tab?: DialogTab) {
|
private initializeModelViewContainer(bodyContainer: HTMLElement, modelViewId: string, tab?: DialogTab) {
|
||||||
bootstrapAngular(this._instantiationService,
|
this._instantiationService.invokeFunction(bootstrapAngular,
|
||||||
DialogModule,
|
DialogModule,
|
||||||
bodyContainer,
|
bodyContainer,
|
||||||
'dialog-modelview-container',
|
'dialog-modelview-container',
|
||||||
|
|||||||
@@ -232,7 +232,7 @@ export class WizardModal extends Modal {
|
|||||||
* Bootstrap angular for the wizard's left nav bar
|
* Bootstrap angular for the wizard's left nav bar
|
||||||
*/
|
*/
|
||||||
private initializeNavigation(bodyContainer: HTMLElement) {
|
private initializeNavigation(bodyContainer: HTMLElement) {
|
||||||
bootstrapAngular(this._instantiationService,
|
this._instantiationService.invokeFunction(bootstrapAngular,
|
||||||
DialogModule,
|
DialogModule,
|
||||||
bodyContainer,
|
bodyContainer,
|
||||||
'wizard-navigation',
|
'wizard-navigation',
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import { DialogPane } from 'sql/workbench/services/dialog/browser/dialogPane';
|
|||||||
import { DialogComponentParams } from 'sql/workbench/services/dialog/browser/dialogContainer.component';
|
import { DialogComponentParams } from 'sql/workbench/services/dialog/browser/dialogContainer.component';
|
||||||
import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService';
|
import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService';
|
||||||
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
import { TestThemeService } from 'vs/platform/theme/test/common/testThemeService';
|
||||||
|
import { workbenchInstantiationService } from 'vs/workbench/test/electron-browser/workbenchTestServices';
|
||||||
|
|
||||||
|
|
||||||
interface BootstrapAngular {
|
interface BootstrapAngular {
|
||||||
@@ -41,7 +42,7 @@ suite('Dialog Pane Tests', () => {
|
|||||||
});
|
});
|
||||||
dialog.content = modelViewId;
|
dialog.content = modelViewId;
|
||||||
const themeService = new TestThemeService();
|
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);
|
dialogPane.createBody(container);
|
||||||
assert.equal(bootstrapCalls, 1);
|
assert.equal(bootstrapCalls, 1);
|
||||||
});
|
});
|
||||||
@@ -56,7 +57,7 @@ suite('Dialog Pane Tests', () => {
|
|||||||
});
|
});
|
||||||
dialog.content = [new DialogTab('', modelViewId)];
|
dialog.content = [new DialogTab('', modelViewId)];
|
||||||
const themeService = new TestThemeService();
|
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);
|
dialogPane.createBody(container);
|
||||||
assert.equal(bootstrapCalls, 1);
|
assert.equal(bootstrapCalls, 1);
|
||||||
});
|
});
|
||||||
@@ -73,7 +74,7 @@ suite('Dialog Pane Tests', () => {
|
|||||||
let modelViewId2 = 'test_content_2';
|
let modelViewId2 = 'test_content_2';
|
||||||
dialog.content = [new DialogTab('tab1', modelViewId1), new DialogTab('tab2', modelViewId2)];
|
dialog.content = [new DialogTab('tab1', modelViewId1), new DialogTab('tab2', modelViewId2)];
|
||||||
const themeService = new TestThemeService();
|
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);
|
dialogPane.createBody(container);
|
||||||
|
|
||||||
let validityChanges: boolean[] = [];
|
let validityChanges: boolean[] = [];
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ import { Schemas } from 'vs/base/common/network';
|
|||||||
import { ILogService } from 'vs/platform/log/common/log';
|
import { ILogService } from 'vs/platform/log/common/log';
|
||||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||||
import { NotebookChangeType } from 'sql/workbench/services/notebook/common/contracts';
|
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 { find, firstIndex } from 'vs/base/common/arrays';
|
||||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||||
|
|
||||||
@@ -129,7 +128,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||||||
@IFileService private readonly _fileService: IFileService,
|
@IFileService private readonly _fileService: IFileService,
|
||||||
@ILogService private readonly _logService: ILogService,
|
@ILogService private readonly _logService: ILogService,
|
||||||
@IQueryManagementService private readonly _queryManagementService: IQueryManagementService,
|
@IQueryManagementService private readonly _queryManagementService: IQueryManagementService,
|
||||||
@IEnvironmentService environmentService: IEnvironmentService
|
@ILogService private readonly logService: ILogService
|
||||||
) {
|
) {
|
||||||
super();
|
super();
|
||||||
this._providersMemento = new Memento('notebookProviders', this._storageService);
|
this._providersMemento = new Memento('notebookProviders', this._storageService);
|
||||||
@@ -455,7 +454,7 @@ export class NotebookService extends Disposable implements INotebookService {
|
|||||||
try {
|
try {
|
||||||
await this._extensionService.whenInstalledExtensionsRegistered();
|
await this._extensionService.whenInstalledExtensionsRegistered();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
this.logService.error(error);
|
||||||
}
|
}
|
||||||
instance = await this.waitOnProviderAvailability(providerDescriptor);
|
instance = await this.waitOnProviderAvailability(providerDescriptor);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ suite('ExtHostModelView Validation Tests', () => {
|
|||||||
mockProxy.setup(x => x.$registerEvent(It.isAny(), It.isAny())).returns(() => Promise.resolve());
|
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());
|
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
|
// 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.$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());
|
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 => {
|
extHostModelView.$registerProvider(widgetId, async view => {
|
||||||
modelView = view;
|
modelView = view;
|
||||||
done();
|
done();
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ export abstract class RequireInterceptor {
|
|||||||
const extensionPaths = await this._extHostExtensionService.getExtensionPathIndex();
|
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 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));
|
this.register(this._instaService.createInstance(KeytarNodeModuleFactory));
|
||||||
if (this._initData.remote.isRemote) {
|
if (this._initData.remote.isRemote) {
|
||||||
this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme));
|
this.register(this._instaService.createInstance(OpenNodeModuleFactory, extensionPaths, this._initData.environment.appUriScheme));
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
*--------------------------------------------------------------------------------------------*/
|
*--------------------------------------------------------------------------------------------*/
|
||||||
|
|
||||||
import { Application } from '../../../../automation';
|
import { Application } from '../../../../automation';
|
||||||
import * as fs from 'fs';
|
import { promises as fs } from 'fs';
|
||||||
import * as os from 'os';
|
import * as os from 'os';
|
||||||
import * as path from 'path';
|
import * as path from 'path';
|
||||||
|
|
||||||
@@ -13,7 +13,7 @@ export function setup() {
|
|||||||
|
|
||||||
it('Can open and edit existing file', async function () {
|
it('Can open and edit existing file', async function () {
|
||||||
const testFilePath = path.join(os.tmpdir(), 'QueryEditorSmokeTest.sql');
|
const testFilePath = path.join(os.tmpdir(), 'QueryEditorSmokeTest.sql');
|
||||||
fs.writeFileSync(testFilePath, '');
|
await fs.writeFile(testFilePath, '');
|
||||||
try {
|
try {
|
||||||
const app = this.app as Application;
|
const app = this.app as Application;
|
||||||
await app.workbench.queryEditors.openFile(testFilePath);
|
await app.workbench.queryEditors.openFile(testFilePath);
|
||||||
@@ -21,7 +21,7 @@ export function setup() {
|
|||||||
await app.workbench.editor.waitForTypeInEditor(fileBaseName, 'SELECT * FROM sys.tables');
|
await app.workbench.editor.waitForTypeInEditor(fileBaseName, 'SELECT * FROM sys.tables');
|
||||||
}
|
}
|
||||||
finally {
|
finally {
|
||||||
fs.unlinkSync(testFilePath);
|
await fs.unlink(testFilePath);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user