Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973 (#6381)

* Merge from vscode 8e0f348413f4f616c23a88ae30030efa85811973

* disable strict null check
This commit is contained in:
Anthony Dresser
2019-07-15 22:35:46 -07:00
committed by GitHub
parent f720ec642f
commit 0b7e7ddbf9
2406 changed files with 59140 additions and 35464 deletions
+9 -1
View File
@@ -11,8 +11,16 @@ exports.base = [{
dest: 'vs/base/worker/workerMain.js'
}];
exports.serviceWorker = [{
name: 'vs/workbench/contrib/resources/browser/resourceServiceWorker',
// include: ['vs/editor/common/services/editorSimpleWorker'],
prepend: ['vs/loader.js'],
append: ['vs/workbench/contrib/resources/browser/resourceServiceWorkerMain'],
dest: 'vs/workbench/contrib/resources/browser/resourceServiceWorkerMain.js'
}];
exports.workbench = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.main']);
exports.workbenchWeb = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.web.main']);
exports.workbenchWeb = require('./vs/workbench/buildfile').collectModules(['vs/workbench/workbench.web.api']);
exports.code = require('./vs/code/buildfile').collectModules();
+11 -20
View File
@@ -51,9 +51,11 @@ userDefinedLocale.then(locale => {
}
});
// Configure command line switches
// Cached data
const nodeCachedDataDir = getNodeCachedDir();
configureCommandlineSwitches(args, nodeCachedDataDir);
// Configure command line switches
configureCommandlineSwitches(args);
// Load our code once ready
app.once('ready', function () {
@@ -134,31 +136,25 @@ function onReady() {
* @typedef {import('minimist').ParsedArgs} ParsedArgs
*
* @param {ParsedArgs} cliArgs
* @param {{ jsFlags: () => string }} nodeCachedDataDir
*/
function configureCommandlineSwitches(cliArgs, nodeCachedDataDir) {
function configureCommandlineSwitches(cliArgs) {
// Force pre-Chrome-60 color profile handling (for https://github.com/Microsoft/vscode/issues/51791)
app.commandLine.appendSwitch('disable-color-correct-rendering');
// Support JS Flags
const jsFlags = resolveJSFlags(cliArgs, nodeCachedDataDir.jsFlags());
const jsFlags = getJSFlags(cliArgs);
if (jsFlags) {
app.commandLine.appendSwitch('--js-flags', jsFlags);
}
// Disable smooth scrolling for Webviews
if (cliArgs['disable-smooth-scrolling']) {
app.commandLine.appendSwitch('disable-smooth-scrolling');
}
}
/**
* @param {ParsedArgs} cliArgs
* @param {string[]} jsFlags
* @returns {string}
*/
function resolveJSFlags(cliArgs, ...jsFlags) {
function getJSFlags(cliArgs) {
const jsFlags = [];
// Add any existing JS flags we already got from the command line
if (cliArgs['js-flags']) {
@@ -205,7 +201,7 @@ function parseCLIArgs() {
function setCurrentWorkingDirectory() {
try {
if (process.platform === 'win32') {
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment letiable
process.env['VSCODE_CWD'] = process.cwd(); // remember as environment variable
process.chdir(path.dirname(app.getPath('exe'))); // always set application folder as cwd
} else if (process.env['VSCODE_CWD']) {
process.chdir(process.env['VSCODE_CWD']);
@@ -253,7 +249,7 @@ function registerListeners() {
}
/**
* @returns {{ jsFlags: () => string; ensureExists: () => Promise<string | void>, _compute: () => string; }}
* @returns {{ ensureExists: () => Promise<string | void> }}
*/
function getNodeCachedDir() {
return new class {
@@ -262,11 +258,6 @@ function getNodeCachedDir() {
this.value = this._compute();
}
jsFlags() {
// return this.value ? '--nolazy' : undefined;
return undefined;
}
ensureExists() {
return bootstrap.mkdirp(this.value).then(() => this.value, () => { /*ignore*/ });
}
@@ -347,4 +338,4 @@ function getUserDefinedLocale() {
return undefined;
});
}
//#endregion
//#endregion
+2 -2
View File
@@ -4559,8 +4559,8 @@ declare module 'azdata' {
* }
* ```
* @export
* @param {NotebookProvider} provider
* @returns {vscode.Disposable}
* @param notebook provider
* @returns disposable
*/
export function registerNotebookProvider(provider: NotebookProvider): vscode.Disposable;
+1 -1
View File
@@ -18,7 +18,7 @@ export class Button extends vsButton {
super(container, options);
this._register(DOM.addDisposableListener(this.element, DOM.EventType.FOCUS, () => {
this.element.style.outlineColor = this.buttonFocusOutline ? this.buttonFocusOutline.toString() : null;
this.element.style.outlineColor = this.buttonFocusOutline ? this.buttonFocusOutline.toString() : '';
this.element.style.outlineWidth = '1px';
}));
@@ -41,11 +41,11 @@ export class DropdownList extends Dropdown {
if (action) {
this.button = new Button(_contentContainer);
this.button.label = action.label;
this.toDispose.push(DOM.addDisposableListener(this.button.element, DOM.EventType.CLICK, () => {
this._register(DOM.addDisposableListener(this.button.element, DOM.EventType.CLICK, () => {
action.run();
this.hide();
}));
this.toDispose.push(DOM.addDisposableListener(this.button.element, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
this._register(DOM.addDisposableListener(this.button.element, DOM.EventType.KEY_DOWN, (e: KeyboardEvent) => {
let event = new StandardKeyboardEvent(e);
if (event.equals(KeyCode.Enter)) {
e.stopPropagation();
@@ -75,7 +75,7 @@ export class DropdownList extends Dropdown {
}
}));
this.toDispose.push(this._list.onSelectionChange(() => {
this._register(this._list.onSelectionChange(() => {
// focus on the dropdown label then hide the dropdown list
this.element.focus();
this.hide();
@@ -241,7 +241,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
}
this.onRemoveItems(new ArrayIterator([item.view.id!]));
});
const disposable = combinedDisposable([onChangeDisposable, containerDisposable]);
const disposable = combinedDisposable(onChangeDisposable, containerDisposable);
const onAdd = view.onAdd ? () => view.onAdd!() : () => { };
const onRemove = view.onRemove ? () => view.onRemove!() : () => { };
@@ -292,7 +292,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
const onEndDisposable = onEnd(this.onSashEnd, this);
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
const disposable = combinedDisposable([onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash]);
const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash);
const sashItem: ISashItem = { sash, disposable };
this.sashItems.splice(currentIndex - 1, 0, sashItem);
@@ -344,7 +344,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
}
this.onRemoveItems(new ArrayIterator([item.view.id!]));
});
const disposable = combinedDisposable([onChangeDisposable, containerDisposable]);
const disposable = combinedDisposable(onChangeDisposable, containerDisposable);
const onAdd = view.onAdd ? () => view.onAdd!() : () => { };
const onRemove = view.onRemove ? () => view.onRemove!() : () => { };
@@ -395,7 +395,7 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
const onEndDisposable = onEnd(this.onSashEnd, this);
const onDidResetDisposable = sash.onDidReset(() => this._onDidSashReset.fire(firstIndex(this.sashItems, item => item.sash === sash)));
const disposable = combinedDisposable([onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash]);
const disposable = combinedDisposable(onStartDisposable, onChangeDisposable, onEndDisposable, onDidResetDisposable, sash);
const sashItem: ISashItem = { sash, disposable };
this.sashItems.splice(index - 1, 0, sashItem);
@@ -527,10 +527,10 @@ export class ScrollableSplitView extends HeightMap implements IDisposable {
const index = firstIndex(this.sashItems, item => item.sash === sash);
// This way, we can press Alt while we resize a sash, macOS style!
const disposable = combinedDisposable([
const disposable = combinedDisposable(
domEvent(document.body, 'keydown')(e => resetSashDragState(this.sashDragState.current, e.altKey)),
domEvent(document.body, 'keyup')(() => resetSashDragState(this.sashDragState.current, false))
]);
);
const resetSashDragState = (start: number, alt: boolean) => {
const sizes = this.viewItems.map(i => i.size);
@@ -14,7 +14,7 @@ const defaultOptions: IAutoColumnSizeOptions = {
autoSizeOnRender: false
};
export class AutoColumnSize<T> implements Slick.Plugin<T> {
export class AutoColumnSize<T extends Object> implements Slick.Plugin<T> {
private _grid: Slick.Grid<T>;
private _$container: JQuery;
private _context: CanvasRenderingContext2D;
+1 -4
View File
@@ -43,13 +43,12 @@ export class ActionBar extends ActionRunner implements IActionRunner {
super();
this._options = options;
this._context = options.context;
this._toDispose = [];
if (this._options.actionRunner) {
this._actionRunner = this._options.actionRunner;
} else {
this._actionRunner = new ActionRunner();
this._toDispose.push(this._actionRunner);
this._register(this._actionRunner);
}
//this._toDispose.push(this.addEmitter(this._actionRunner));
@@ -365,8 +364,6 @@ export class ActionBar extends ActionRunner implements IActionRunner {
lifecycle.dispose(this._items);
this._items = [];
this._toDispose = lifecycle.dispose(this._toDispose);
this._domNode.remove();
super.dispose();
@@ -53,7 +53,7 @@ class AccountPanel extends ViewletPanel {
protected renderBody(container: HTMLElement): void {
this.accountList = new List<azdata.Account>(container, new AccountListDelegate(AccountDialog.ACCOUNTLIST_HEIGHT), [this.instantiationService.createInstance(AccountListRenderer)]);
this.disposables.push(attachListStyler(this.accountList, this.themeService));
this._register(attachListStyler(this.accountList, this.themeService));
}
protected layoutBody(size: number): void {
@@ -1,70 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/accountListStatusbarItem';
import { Action, IAction } from 'vs/base/common/actions';
import { IDisposable } from 'vs/base/common/lifecycle';
import { $, append } from 'vs/base/browser/dom';
import { onUnexpectedError } from 'vs/base/common/errors';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { localize } from 'vs/nls';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Themable, STATUS_BAR_FOREGROUND } from 'vs/workbench/common/theme';
import { IThemeService } from 'vs/platform/theme/common/themeService';
import { IAccountManagementService } from 'sql/platform/accounts/common/interfaces';
export class AccountListStatusbarItem extends Themable implements IStatusbarItem {
private _manageLinkedAccountAction: IAction;
private _icon: HTMLElement;
constructor(
@IInstantiationService private _instantiationService: IInstantiationService,
@IThemeService themeService: IThemeService
) {
super(themeService);
}
protected updateStyles(): void {
super.updateStyles();
if (this._icon) {
this._icon.style.backgroundColor = this.getColor(STATUS_BAR_FOREGROUND);
}
}
public render(container: HTMLElement): IDisposable {
// Create root element for account list
const rootElement = append(container, $('.linked-account-staus'));
const accountElement = append(rootElement, $('a.linked-account-status-selection'));
accountElement.title = ManageLinkedAccountAction.LABEL;
accountElement.onclick = () => this._onClick();
this._icon = append(accountElement, $('.linked-account-icon'));
this.updateStyles();
return this;
}
private _onClick() {
if (!this._manageLinkedAccountAction) {
this._manageLinkedAccountAction = this._instantiationService.createInstance(ManageLinkedAccountAction, ManageLinkedAccountAction.ID, ManageLinkedAccountAction.LABEL);
}
this._manageLinkedAccountAction.run().then(null, onUnexpectedError);
}
}
export class ManageLinkedAccountAction extends Action {
public static ID = 'sql.action.accounts.manageLinkedAccount';
public static LABEL = localize('manageLinedAccounts', 'Manage Linked Accounts');
constructor(id: string, label: string,
@IAccountManagementService protected _accountManagementService: IAccountManagementService) {
super(id, label);
}
public run(): Promise<any> {
return new Promise<any>(() => this._accountManagementService.openAccountListDialog());
}
}
@@ -3,9 +3,6 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { IExtensionPointUser, ExtensionsRegistry } from 'vs/workbench/services/extensions/common/extensionsRegistry';
import { IJSONSchema } from 'vs/base/common/jsonSchema';
import { localize } from 'vs/nls';
@@ -13,19 +10,6 @@ import { join } from 'path';
import { createCSSRule } from 'vs/base/browser/dom';
import { URI } from 'vs/base/common/uri';
import { ManageLinkedAccountAction } from 'sql/platform/accounts/browser/accountListStatusbarItem';
let actionRegistry = <IWorkbenchActionRegistry>Registry.as(Extensions.WorkbenchActions);
actionRegistry.registerWorkbenchAction(
new SyncActionDescriptor(
ManageLinkedAccountAction,
ManageLinkedAccountAction.ID,
ManageLinkedAccountAction.LABEL
),
ManageLinkedAccountAction.LABEL
);
export interface IAccountContrib {
id: string;
icon?: IUserFriendlyIcon;
@@ -23,14 +23,14 @@ export class ClipboardService implements IClipboardService {
clipboard.writeImage(image);
}
writeText(text: string): void {
this._vsClipboardService.writeText(text);
writeText(text: string): Promise<void> {
return this._vsClipboardService.writeText(text);
}
/**
* Reads the content of the clipboard in plain text
*/
readText(): string {
readText(): Promise<string> {
return this._vsClipboardService.readText();
}
/**
@@ -67,4 +67,8 @@ export class ClipboardService implements IClipboardService {
hasResources(): boolean {
return this._vsClipboardService.hasResources();
}
readTextSync(): string | undefined {
return this._vsClipboardService.readTextSync();
}
}
@@ -43,7 +43,6 @@ import * as platform from 'vs/platform/registry/common/platform';
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { ConnectionProfileGroup, IConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
import { Event, Emitter } from 'vs/base/common/event';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { IConnectionDialogService } from 'sql/workbench/services/connection/common/connectionDialogService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
@@ -68,7 +67,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
private _onConnectRequestSent = new Emitter<void>();
private _onConnectionChanged = new Emitter<IConnectionParams>();
private _onLanguageFlavorChanged = new Emitter<azdata.DidChangeLanguageFlavorParams>();
private _connectionGlobalStatus = new ConnectionGlobalStatus(this._statusBarService);
private _connectionGlobalStatus = new ConnectionGlobalStatus(this._notificationService);
private _mementoContext: Memento;
private _mementoObj: any;
@@ -85,14 +84,13 @@ export class ConnectionManagementService extends Disposable implements IConnecti
@IConfigurationService private _configurationService: IConfigurationService,
@ICapabilitiesService private _capabilitiesService: ICapabilitiesService,
@IQuickInputService private _quickInputService: IQuickInputService,
@IStatusbarService private _statusBarService: IStatusbarService,
@INotificationService private _notificationService: INotificationService,
@IResourceProviderService private _resourceProviderService: IResourceProviderService,
@IAngularEventingService private _angularEventing: IAngularEventingService,
@IAccountManagementService private _accountManagementService: IAccountManagementService,
@ILogService private _logService: ILogService,
@IStorageService private _storageService: IStorageService,
@IEnvironmentService private _environmentService: IEnvironmentService,
@INotificationService private _notificationService: INotificationService
@IEnvironmentService private _environmentService: IEnvironmentService
) {
super();
@@ -9,15 +9,11 @@ import QueryRunner from 'sql/platform/query/common/queryRunner';
import { DataService } from 'sql/workbench/parts/grid/services/dataService';
import { IQueryModelService, IQueryEvent } from 'sql/platform/query/common/queryModel';
import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
import { QueryStatusbarItem } from 'sql/workbench/parts/query/browser/queryStatus';
import { SqlFlavorStatusbarItem } from 'sql/workbench/parts/query/browser/flavorStatus';
import { RowCountStatusBarItem } from 'sql/workbench/parts/query/browser/rowCountStatus';
import { TimeElapsedStatusBarItem } from 'sql/workbench/parts/query/browser/timeElapsedStatus';
import * as azdata from 'azdata';
import * as nls from 'vs/nls';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import * as platform from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Event, Emitter } from 'vs/base/common/event';
@@ -85,32 +81,6 @@ export class QueryModelService implements IQueryModelService {
this._onRunQueryComplete = new Emitter<string>();
this._onQueryEvent = new Emitter<IQueryEvent>();
this._onEditSessionReady = new Emitter<azdata.EditSessionReadyParams>();
// Register Statusbar items
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
TimeElapsedStatusBarItem,
StatusbarAlignment.RIGHT,
100 /* Should appear to the right of the SQL editor status */
));
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
RowCountStatusBarItem,
StatusbarAlignment.RIGHT,
100 /* Should appear to the right of the SQL editor status */
));
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
QueryStatusbarItem,
StatusbarAlignment.RIGHT,
100 /* High Priority */
));
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
SqlFlavorStatusbarItem,
StatusbarAlignment.RIGHT,
90 /* Should appear to the right of the SQL editor status */
));
}
// IQUERYMODEL /////////////////////////////////////////////////////////
@@ -0,0 +1,23 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import './mainThreadAccountManagement';
import './mainThreadBackgroundTaskManagement';
import './mainThreadConnectionManagement';
import './mainThreadCredentialManagement';
import './mainThreadDashboard';
import './mainThreadDashboardWebview';
import './mainThreadDataProtocol';
import './mainThreadExtensionManagement';
import './mainThreadModalDialog';
import './mainThreadModelView';
import './mainThreadModelViewDialog';
import './mainThreadNotebook';
import './mainThreadNotebookDocumentsAndEditors';
import './mainThreadObjectExplorer';
import './mainThreadQueryEditor';
import './mainThreadResourceProvider';
import './mainThreadSerializationProvider';
import './mainThreadTasks';
@@ -7,7 +7,7 @@ import { SqlMainContext, MainThreadExtensionManagementShape } from 'sql/workbenc
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { IExtensionManagementService, IExtensionIdentifier } from 'vs/platform/extensionManagement/common/extensionManagement';
import { IExtensionManagementService, ILocalExtension } from 'vs/platform/extensionManagement/common/extensionManagement';
import { URI } from 'vs/base/common/uri';
@extHostNamedCustomer(SqlMainContext.MainThreadExtensionManagement)
@@ -27,6 +27,6 @@ export class MainThreadExtensionManagement implements MainThreadExtensionManagem
}
public $install(vsixPath: string): Thenable<string> {
return this._extensionService.install(URI.file(vsixPath)).then((value: IExtensionIdentifier) => { return undefined; }, (reason: any) => { return reason ? reason.toString() : undefined; });
return this._extensionService.install(URI.file(vsixPath)).then((value: ILocalExtension) => { return undefined; }, (reason: any) => { return reason ? reason.toString() : undefined; });
}
}
@@ -3,4 +3,4 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'vs/platform/update/node/update.config.contribution';
import '../browser/extensionHost.contribution.common';
@@ -160,8 +160,8 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
});
}
protected createTreeItem(element: T, extensionTreeItem: azdata.TreeComponentItem, parent?: vsTreeExt.TreeNode): ITreeComponentItem {
let item = super.createTreeItem(element, extensionTreeItem, parent);
protected createTreeNode(element: T, extensionTreeItem: azdata.TreeComponentItem, parent?: vsTreeExt.TreeNode): vsTreeExt.TreeNode {
let item = super.createTreeNode(element, extensionTreeItem, parent);
item = Object.assign({}, item, { checked: extensionTreeItem.checked, enabled: extensionTreeItem.enabled });
return item;
}
@@ -40,8 +40,7 @@ import { ExtHostWorkspace } from 'vs/workbench/api/common/extHostWorkspace';
import { ExtHostConfiguration, ExtHostConfigProvider } from 'vs/workbench/api/common/extHostConfiguration';
import { ExtHostStorage } from 'vs/workbench/api/common/extHostStorage';
import * as extHostTypes from 'vs/workbench/api/common/extHostTypes';
import { ISchemeTransformer } from 'vs/workbench/api/common/extHostLanguageFeatures';
import { AzureResource } from 'sql/platform/accounts/common/interfaces';
import { IURITransformer } from 'vs/base/common/uriIpc';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
export interface ISqlExtensionApiFactory {
@@ -61,10 +60,9 @@ export function createApiFactory(
extensionService: ExtHostExtensionService,
logService: ExtHostLogService,
extHostStorage: ExtHostStorage,
schemeTransformer: ISchemeTransformer | null,
outputChannelName: string
uriTransformer: IURITransformer | null
): ISqlExtensionApiFactory {
let vsCodeFactory = extHostApi.createApiFactory(initData, rpcProtocol, extHostWorkspace, extHostConfiguration, extensionService, logService, extHostStorage, schemeTransformer, outputChannelName);
let vsCodeFactory = extHostApi.createApiFactory(initData, rpcProtocol, extHostWorkspace, extHostConfiguration, extensionService, logService, extHostStorage, uriTransformer);
// Addressable instances
const extHostAccountManagement = rpcProtocol.set(SqlExtHostContext.ExtHostAccountManagement, new ExtHostAccountManagement(rpcProtocol));
@@ -1,46 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { Registry } from 'vs/platform/registry/common/platform';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
// --- SQL contributions
import 'sql/workbench/api/node/mainThreadConnectionManagement';
import 'sql/workbench/api/node/mainThreadCredentialManagement';
import 'sql/workbench/api/node/mainThreadDataProtocol';
import 'sql/workbench/api/node/mainThreadObjectExplorer';
import 'sql/workbench/api/node/mainThreadBackgroundTaskManagement';
import 'sql/workbench/api/node/mainThreadSerializationProvider';
import 'sql/workbench/api/node/mainThreadResourceProvider';
import 'sql/workbench/api/electron-browser/mainThreadTasks';
import 'sql/workbench/api/electron-browser/mainThreadDashboard';
import 'sql/workbench/api/node/mainThreadDashboardWebview';
import 'sql/workbench/api/node/mainThreadQueryEditor';
import 'sql/workbench/api/node/mainThreadModelView';
import 'sql/workbench/api/node/mainThreadModelViewDialog';
import 'sql/workbench/api/node/mainThreadNotebook';
import 'sql/workbench/api/node/mainThreadNotebookDocumentsAndEditors';
import 'sql/workbench/api/node/mainThreadAccountManagement';
import 'sql/workbench/api/node/mainThreadExtensionManagement';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
export class SqlExtHostContribution implements IWorkbenchContribution {
constructor(
@IInstantiationService private instantiationService: IInstantiationService
) {
}
public getId(): string {
return 'sql.api.sqlExtHost';
}
}
// Register File Tracker
Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench).registerWorkbenchContribution(
SqlExtHostContribution,
LifecyclePhase.Restored
);
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Event, Emitter } from 'vs/base/common/event';
import { IDisposable, dispose, Disposable, toDisposable } from 'vs/base/common/lifecycle';
import { IDisposable, dispose, Disposable, toDisposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IAction, ActionRunner, Action } from 'vs/base/common/actions';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
@@ -14,7 +14,7 @@ import { IContextKeyService } from 'vs/platform/contextkey/common/contextkey';
import { TreeItemCollapsibleState, ITreeViewDataProvider, TreeViewItemHandleArg, ViewContainer, ITreeItemLabel } from 'vs/workbench/common/views';
import { FileIconThemableWorkbenchTree } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IProgressService2 } from 'vs/platform/progress/common/progress';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -44,7 +44,7 @@ import { dirname } from 'vs/base/common/resources';
import { ITreeItem, ITreeView } from 'sql/workbench/common/views';
import { IOEShimService } from 'sql/workbench/parts/objectExplorer/common/objectExplorerViewTreeShim';
import { NodeContextKey } from 'sql/workbench/parts/dataExplorer/common/nodeContext';
import { fillInActionBarActions, fillInContextMenuActions, ContextAwareMenuEntryActionViewItem } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { ContextAwareMenuEntryActionViewItem, createAndFillInActionBarActions, createAndFillInContextMenuActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
class TitleMenus implements IDisposable {
@@ -74,7 +74,7 @@ class TitleMenus implements IDisposable {
const updateActions = () => {
this.titleActions = [];
this.titleSecondaryActions = [];
fillInActionBarActions(titleMenu, undefined, { primary: this.titleActions, secondary: this.titleSecondaryActions });
createAndFillInActionBarActions(titleMenu, undefined, { primary: this.titleActions, secondary: this.titleSecondaryActions });
this._onDidChangeTitle.fire();
};
@@ -159,7 +159,7 @@ export class CustomTreeView extends Disposable implements ITreeView {
@IInstantiationService private instantiationService: IInstantiationService,
@ICommandService private commandService: ICommandService,
@IConfigurationService private configurationService: IConfigurationService,
@IProgressService2 private progressService: IProgressService2
@IProgressService private progressService: IProgressService
) {
super();
this.root = new Root();
@@ -515,7 +515,7 @@ class TreeDataSource implements IDataSource {
private treeView: ITreeView,
private container: ViewContainer,
private id: string,
@IProgressService2 private progressService: IProgressService2,
@IProgressService private progressService: IProgressService,
@IOEShimService private objectExplorerService: IOEShimService
) {
}
@@ -853,7 +853,7 @@ class TreeMenus extends Disposable implements IDisposable {
const primary: IAction[] = [];
const secondary: IAction[] = [];
const result = { primary, secondary };
fillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => /^inline/.test(g));
createAndFillInContextMenuActions(menu, { shouldForwardArgs: true }, result, this.contextMenuService, g => /^inline/.test(g));
menu.dispose();
contextKeyService.dispose();
@@ -869,7 +869,7 @@ class MarkdownRenderer {
) {
}
private getOptions(disposeables: IDisposable[]): RenderOptions {
private getOptions(disposeables: DisposableStore): RenderOptions {
return {
actionHandler: {
callback: (content) => {
@@ -889,7 +889,7 @@ class MarkdownRenderer {
}
render(markdown: IMarkdownString): IMarkdownRenderResult {
let disposeables: IDisposable[] = [];
let disposeables = new DisposableStore();
const element: HTMLElement = markdown ? renderMarkdown(markdown, this.getOptions(disposeables)) : document.createElement('span');
return {
element,
@@ -18,7 +18,7 @@ import { IModelService } from 'vs/editor/common/services/modelService';
import { ComponentBase } from 'sql/workbench/electron-browser/modelComponents/componentBase';
import { IComponent, IComponentDescriptor, IModelStore } from 'sql/workbench/electron-browser/modelComponents/interfaces';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { TextDiffEditor } from 'vs/workbench/browser/parts/editor/textDiffEditor';
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
@@ -70,7 +70,7 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
}
private _createEditor(): void {
this._instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleProgressService()]));
this._instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleEditorProgressService()]));
this._editor = this._instantiationService.createInstance(TextDiffEditor);
this._editor.reverseColoring();
this._editor.create(this._el.nativeElement);
@@ -238,4 +238,4 @@ export default class DiffEditorComponent extends ComponentBase implements ICompo
public set title(newValue: string) {
this.setPropertyFromUI<azdata.EditorProperties, string>((properties, title) => { properties.title = title; }, newValue);
}
}
}
@@ -21,7 +21,7 @@ import { ComponentBase } from 'sql/workbench/electron-browser/modelComponents/co
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/workbench/electron-browser/modelComponents/interfaces';
import { QueryTextEditor } from 'sql/workbench/electron-browser/modelComponents/queryTextEditor';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IProgressService } from 'vs/platform/progress/common/progress';
@Component({
@@ -59,7 +59,7 @@ export default class EditorComponent extends ComponentBase implements IComponent
}
private _createEditor(): void {
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleProgressService()]));
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleEditorProgressService()]));
this._editor = instantiationService.createInstance(QueryTextEditor);
this._editor.create(this._el.nativeElement);
this._editor.setVisible(true);
@@ -0,0 +1,40 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { Registry } from 'vs/platform/registry/common/platform';
import { Disposable } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution, IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { IStatusbarService, StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { localize } from 'vs/nls';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IAccountManagementService } from 'sql/platform/accounts/common/interfaces';
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
CommandsRegistry.registerCommand('workbench.actions.modal.linkedAccount', accessor => {
const accountManagementService = accessor.get(IAccountManagementService);
accountManagementService.openAccountListDialog();
});
class AccountsStatusBarContributions extends Disposable implements IWorkbenchContribution {
constructor(
@IStatusbarService private readonly statusbarService: IStatusbarService
) {
super();
this._register(
this.statusbarService.addEntry({
command: 'workbench.actions.modal.linkedAccount',
text: '$(person-filled)'
},
'status.accountList',
localize('status.problems', "Problems"),
StatusbarAlignment.LEFT, 15000 /* Highest Priority */)
);
}
}
workbenchRegistry.registerWorkbenchContribution(AccountsStatusBarContributions, LifecyclePhase.Restored);
@@ -11,24 +11,19 @@ import * as azdata from 'azdata';
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
import { SyncActionDescriptor } from 'vs/platform/actions/common/actions';
import { localize } from 'vs/nls';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import { StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { ConnectionStatusbarItem } from 'sql/workbench/parts/connection/browser/connectionStatus';
import { CommandsRegistry } from 'vs/platform/commands/common/commands';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { integrated, azureMFA } from 'sql/platform/connection/common/constants';
import { AuthenticationType } from 'sql/workbench/services/connection/browser/connectionWidget';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
// Register Statusbar item
(<statusbar.IStatusbarRegistry>Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(new statusbar.StatusbarItemDescriptor(
ConnectionStatusbarItem,
StatusbarAlignment.RIGHT,
100 /* High Priority */
));
workbenchRegistry.registerWorkbenchContribution(ConnectionStatusbarItem, LifecyclePhase.Restored);
// Connection Dashboard registration
@@ -3,54 +3,64 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { $, append, show, hide } from 'vs/base/browser/dom';
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Disposable } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import * as TaskUtilities from 'sql/workbench/common/taskUtilities';
import { IStatusbarEntryAccessor, IStatusbarService, StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { localize } from 'vs/nls';
// Connection status bar showing the current global connection
export class ConnectionStatusbarItem implements IStatusbarItem {
export class ConnectionStatusbarItem extends Disposable implements IWorkbenchContribution {
private _element: HTMLElement;
private _connectionElement: HTMLElement;
private _toDispose: IDisposable[];
private static readonly ID = 'status.connection.status';
private statusItem: IStatusbarEntryAccessor;
constructor(
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IEditorService private _editorService: IEditorService,
@IObjectExplorerService private _objectExplorerService: IObjectExplorerService,
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService,
@IEditorService private readonly editorService: IEditorService,
@IObjectExplorerService private readonly objectExplorerService: IObjectExplorerService,
) {
}
public render(container: HTMLElement): IDisposable {
this._element = append(container, $('.connection-statusbar-item'));
this._connectionElement = append(this._element, $('div.connection-statusbar-conninfo'));
hide(this._connectionElement);
this._toDispose = [];
this._toDispose.push(
this._connectionManagementService.onConnect(() => this._updateStatus()),
this._connectionManagementService.onConnectionChanged(() => this._updateStatus()),
this._connectionManagementService.onDisconnect(() => this._updateStatus()),
this._editorService.onDidActiveEditorChange(() => this._updateStatus()),
this._objectExplorerService.onSelectionOrFocusChange(() => this._updateStatus())
super();
this.statusItem = this._register(
this.statusbarService.addEntry({
text: '',
},
ConnectionStatusbarItem.ID,
localize('status.connection.status', "Connection Status"),
StatusbarAlignment.RIGHT, 100)
);
return combinedDisposable(this._toDispose);
this.hide();
this._register(this.connectionManagementService.onConnect(() => this._updateStatus()));
this._register(this.connectionManagementService.onConnectionChanged(() => this._updateStatus()));
this._register(this.connectionManagementService.onDisconnect(() => this._updateStatus()));
this._register(this.editorService.onDidActiveEditorChange(() => this._updateStatus()));
this._register(this.objectExplorerService.onSelectionOrFocusChange(() => this._updateStatus()));
}
private hide() {
this.statusbarService.updateEntryVisibility(ConnectionStatusbarItem.ID, false);
}
private show() {
this.statusbarService.updateEntryVisibility(ConnectionStatusbarItem.ID, true);
}
// Update the connection status shown in the bar
private _updateStatus(): void {
let activeConnection = TaskUtilities.getCurrentGlobalConnection(this._objectExplorerService, this._connectionManagementService, this._editorService);
let activeConnection = TaskUtilities.getCurrentGlobalConnection(this.objectExplorerService, this.connectionManagementService, this.editorService);
if (activeConnection) {
this._setConnectionText(activeConnection);
show(this._connectionElement);
this.show();
} else {
hide(this._connectionElement);
this.hide();
}
}
@@ -73,7 +83,8 @@ export class ConnectionStatusbarItem implements IStatusbarItem {
tooltip = tooltip + 'Login: ' + connectionProfile.userName + '\r\n';
}
this._connectionElement.textContent = text;
this._connectionElement.title = tooltip;
this.statusItem.update({
text, tooltip
});
}
}
@@ -3,8 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ConnectionSummary } from 'azdata';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import * as LocalizedConstants from 'sql/workbench/parts/connection/common/localizedConstants';
import { INotificationService } from 'vs/platform/notification/common/notification';
// Status when making connections from the viewlet
export class ConnectionGlobalStatus {
@@ -12,12 +12,12 @@ export class ConnectionGlobalStatus {
private _displayTime: number = 5000; // (in ms)
constructor(
@IStatusbarService private _statusBarService: IStatusbarService
@INotificationService private _notificationService: INotificationService
) {
}
public setStatusToConnected(connectionSummary: ConnectionSummary): void {
if (this._statusBarService) {
if (this._notificationService) {
let text: string;
let connInfo: string = connectionSummary.serverName;
if (connInfo) {
@@ -28,13 +28,13 @@ export class ConnectionGlobalStatus {
}
text = LocalizedConstants.onDidConnectMessage + ' ' + connInfo;
}
this._statusBarService.setStatusMessage(text, this._displayTime);
this._notificationService.status(text, { hideAfter: this._displayTime });
}
}
public setStatusToDisconnected(fileUri: string): void {
if (this._statusBarService) {
this._statusBarService.setStatusMessage(LocalizedConstants.onDidDisconnectMessage, this._displayTime);
if (this._notificationService) {
this._notificationService.status(LocalizedConstants.onDidDisconnectMessage, { hideAfter: this._displayTime });
}
}
}
@@ -235,7 +235,7 @@ export class CollapseWidgetAction extends Action {
}
this.collpasedState = collapsed;
this._setClass(this.collpasedState ? CollapseWidgetAction.EXPAND_ICON : CollapseWidgetAction.COLLAPSE_ICON);
this._setLabel(this.collpasedState ? CollapseWidgetAction.EXPAND_LABEL : CollapseWidgetAction.COLLPASE_LABEL);
this.label = this.collpasedState ? CollapseWidgetAction.EXPAND_LABEL : CollapseWidgetAction.COLLPASE_LABEL;
}
public set state(collapsed: boolean) {
@@ -32,7 +32,7 @@ import { generateUuid } from 'vs/base/common/uuid';
import { $ } from 'vs/base/browser/dom';
import { ExecuteCommandAction } from 'vs/platform/actions/common/actions';
import { IKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { NewNotebookAction } from 'sql/workbench/parts/notebook/notebookActions';
export class ObjectMetadataWrapper implements ObjectMetadata {
@@ -112,7 +112,7 @@ export class ExplorerController extends TreeDefaults.DefaultController {
private _contextMenuService: IContextMenuService,
private _capabilitiesService: ICapabilitiesService,
private _instantiationService: IInstantiationService,
private _progressService: IProgressService
private _progressService: IEditorProgressService
) {
super();
}
@@ -426,7 +426,7 @@ class ExplorerScriptSelectAction extends ScriptSelectAction {
@IQueryEditorService queryEditorService: IQueryEditorService,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IProgressService private progressService: IProgressService
@IEditorProgressService private progressService: IEditorProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService);
}
@@ -445,7 +445,7 @@ class ExplorerScriptCreateAction extends ScriptCreateAction {
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private progressService: IProgressService
@IEditorProgressService private progressService: IEditorProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
@@ -464,7 +464,7 @@ class ExplorerScriptAlterAction extends ScriptAlterAction {
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private progressService: IProgressService
@IEditorProgressService private progressService: IEditorProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
@@ -483,7 +483,7 @@ class ExplorerScriptExecuteAction extends ScriptExecuteAction {
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IScriptingService scriptingService: IScriptingService,
@IErrorMessageService errorMessageService: IErrorMessageService,
@IProgressService private progressService: IProgressService
@IEditorProgressService private progressService: IEditorProgressService
) {
super(id, label, queryEditorService, connectionManagementService, scriptingService, errorMessageService);
}
@@ -500,7 +500,7 @@ class ExplorerManageAction extends ManageAction {
id: string, label: string,
@IConnectionManagementService connectionManagementService: IConnectionManagementService,
@IAngularEventingService angularEventingService: IAngularEventingService,
@IProgressService private _progressService: IProgressService
@IEditorProgressService private _progressService: IEditorProgressService
) {
super(id, label, connectionManagementService, angularEventingService);
}
@@ -7,7 +7,7 @@ import 'vs/css!sql/media/objectTypes/objecttypes';
import 'vs/css!sql/media/icons/common-icons';
import 'vs/css!./media/explorerWidget';
import { Component, Inject, forwardRef, ChangeDetectorRef, OnInit, ViewChild, ElementRef } from '@angular/core';
import { Component, Inject, forwardRef, OnInit, ViewChild, ElementRef } from '@angular/core';
import { Router } from '@angular/router';
import { DashboardWidget, IDashboardWidget, WidgetConfig, WIDGET_CONFIG } from 'sql/workbench/parts/dashboard/common/dashboardWidget';
@@ -26,7 +26,7 @@ import { Delayer } from 'vs/base/common/async';
import { IContextViewService, IContextMenuService } from 'vs/platform/contextview/browser/contextView';
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IEditorProgressService } from 'vs/platform/progress/common/progress';
import { ScrollbarVisibility } from 'vs/base/common/scrollable';
@Component({
@@ -58,7 +58,6 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget,
constructor(
@Inject(forwardRef(() => CommonServiceInterface)) private _bootstrap: CommonServiceInterface,
@Inject(forwardRef(() => Router)) private _router: Router,
@Inject(forwardRef(() => ChangeDetectorRef)) private _changeRef: ChangeDetectorRef,
@Inject(WIDGET_CONFIG) protected _config: WidgetConfig,
@Inject(forwardRef(() => ElementRef)) private _el: ElementRef,
@Inject(IWorkbenchThemeService) private themeService: IWorkbenchThemeService,
@@ -66,7 +65,7 @@ export class ExplorerWidget extends DashboardWidget implements IDashboardWidget,
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
@Inject(IContextMenuService) private contextMenuService: IContextMenuService,
@Inject(ICapabilitiesService) private capabilitiesService: ICapabilitiesService,
@Inject(IProgressService) private progressService: IProgressService
@Inject(IEditorProgressService) private progressService: IEditorProgressService
) {
super();
this.init();
@@ -128,7 +128,6 @@ export class ConnectionViewletPanel extends ViewletPanel {
}
dispose(): void {
this.disposables = dispose(this.disposables);
super.dispose();
}
@@ -13,7 +13,7 @@ import { ICustomViewDescriptor, TreeViewItemHandleArg } from 'sql/workbench/comm
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/commands';
import { IViewsRegistry, Extensions } from 'vs/workbench/common/views';
import { IProgressService2 } from 'vs/platform/progress/common/progress';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { Registry } from 'vs/platform/registry/common/platform';
import { NewNotebookAction } from 'sql/workbench/parts/notebook/notebookActions';
import { BackupAction, RestoreAction } from 'sql/workbench/common/actions';
@@ -98,7 +98,7 @@ CommandsRegistry.registerCommand({
CommandsRegistry.registerCommand({
id: REFRESH_COMMAND_ID,
handler: (accessor, args: TreeViewItemHandleArg) => {
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
if (args.$treeItem) {
const { treeView } = (<ICustomViewDescriptor>Registry.as<IViewsRegistry>(Extensions.ViewsRegistry).getView(args.$treeViewId));
if (args.$treeContainerId) {
@@ -173,4 +173,4 @@ CommandsRegistry.registerCommand({
let connectedContext: azdata.ConnectedContext = { connectionProfile: args.$treeItem.payload };
return commandService.executeCommand(RestoreAction.ID, connectedContext);
}
});
});
@@ -56,12 +56,11 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
this._setup = false;
this._stopButtonEnabled = false;
this._refreshButtonEnabled = false;
this._toDispose = [];
this._useQueryFilter = false;
// re-emit sql editor events through this editor if it exists
if (this._sql) {
this._toDispose.push(this._sql.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._register(this._sql.onDidChangeDirty(() => this._onDidChangeDirty.fire()));
this._sql.disableSaving();
}
this.disableSaving();
@@ -74,7 +73,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
let self = this;
// Register callbacks for the Actions
this._toDispose.push(
this._register(
this._queryModelService.onRunQueryStart(uri => {
if (self.uri === uri) {
self.initEditStart();
@@ -82,7 +81,7 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
})
);
this._toDispose.push(
this._register(
this._queryModelService.onEditSessionReady((result) => {
if (self.uri === result.ownerUri) {
self.initEditEnd(result);
@@ -210,7 +209,6 @@ export class EditDataInput extends EditorInput implements IConnectableInput {
this._queryModelService.disposeQuery(this.uri);
this._sql.dispose();
this._results.dispose();
this._toDispose = dispose(this._toDispose);
super.dispose();
}
@@ -17,7 +17,7 @@ import { NotebookModel } from 'sql/workbench/parts/notebook/models/notebookModel
import { IColorTheme, IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
import * as themeColors from 'vs/workbench/common/theme';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { SimpleProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { SimpleEditorProgressService } from 'vs/editor/standalone/browser/simpleServices';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { ITextModel } from 'vs/editor/common/model';
@@ -189,7 +189,7 @@ export class CodeComponent extends AngularDisposable implements OnInit, OnChange
}
private async createEditor(): Promise<void> {
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleProgressService()]));
let instantiationService = this._instantiationService.createChild(new ServiceCollection([IProgressService, new SimpleEditorProgressService()]));
this._editor = instantiationService.createInstance(QueryTextEditor);
this._editor.create(this.codeElement.nativeElement);
this._editor.setVisible(true);
@@ -7,8 +7,8 @@ import 'vs/css!./notebook';
import { registerThemingParticipant, ITheme, ICssStyleCollector } from 'vs/platform/theme/common/themeService';
import { SIDE_BAR_BACKGROUND, SIDE_BAR_SECTION_HEADER_BACKGROUND, EDITOR_GROUP_HEADER_TABS_BACKGROUND } from 'vs/workbench/common/theme';
import { activeContrastBorder, contrastBorder, buttonBackground, textLinkForeground, textLinkActiveForeground, textPreformatForeground, textBlockQuoteBackground, textBlockQuoteBorder } from 'vs/platform/theme/common/colorRegistry';
import { IDisposable } from 'vscode-xterm';
import { editorLineHighlight, editorLineHighlightBorder } from 'vs/editor/common/view/editorColorRegistry';
import { IDisposable } from 'vs/base/common/lifecycle';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { BareResultsGridInfo, getBareResultsGridInfoStyles } from 'sql/workbench/parts/query/browser/queryResultsEditor';
import { getZoomLevel } from 'vs/base/browser/browser';
@@ -254,4 +254,4 @@ export function registerNotebookThemes(overrideEditorThemeSetting: boolean, conf
${getBareResultsGridInfoStyles(rawOptions)}
}`);
});
}
}
@@ -27,7 +27,7 @@ export class NotebookMarkdownRenderer {
const element: HTMLElement = markdown ? this.renderMarkdown(markdown, undefined) : document.createElement('span');
return {
element,
dispose: () => dispose()
dispose: () => { }
};
}
@@ -8,30 +8,30 @@ import { ITree } from 'vs/base/parts/tree/browser/tree';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { IObjectExplorerService } from 'sql/workbench/services/objectExplorer/common/objectExplorerService';
import { IProgressService, IProgressRunner } from 'vs/platform/progress/common/progress';
// import { IProgressRunner, IProgressService } from 'vs/platform/progress/common/progress';
import { TreeNode } from 'sql/workbench/parts/objectExplorer/common/treeNode';
import { TreeUpdateUtils } from 'sql/workbench/parts/objectExplorer/browser/treeUpdateUtils';
export class TreeSelectionHandler {
progressRunner: IProgressRunner;
// progressRunner: IProgressRunner;
private _clicks: number = 0;
private _doubleClickTimeoutTimer: NodeJS.Timer = undefined;
constructor(@IProgressService private _progressService: IProgressService) {
// constructor(@IProgressService private _progressService: IProgressService) {
}
// }
public onTreeActionStateChange(started: boolean): void {
if (this.progressRunner) {
this.progressRunner.done();
}
// if (this.progressRunner) {
// this.progressRunner.done();
// }
if (started) {
this.progressRunner = this._progressService.show(true);
} else {
this.progressRunner = null;
}
// if (started) {
// this.progressRunner = this._progressService.show(true);
// } else {
// this.progressRunner = null;
// }
}
private isMouseEvent(event: any): boolean {
@@ -13,7 +13,7 @@ import { CommandsRegistry, ICommandService } from 'vs/platform/commands/common/c
import { IQueryEditorService } from 'sql/workbench/services/queryEditor/common/queryEditorService';
import { IScriptingService } from 'sql/platform/scripting/common/scriptingService';
import { IErrorMessageService } from 'sql/platform/errorMessage/common/errorMessageService';
import { IProgressService2 } from 'vs/platform/progress/common/progress';
import { IProgressService } from 'vs/platform/progress/common/progress';
import { ScriptCreateAction, BaseActionContext, ScriptDeleteAction, ScriptSelectAction, ScriptExecuteAction, ScriptAlterAction, EditDataAction } from 'sql/workbench/common/actions';
import { VIEWLET_ID } from 'sql/workbench/parts/dataExplorer/browser/dataExplorerExtensionPoint';
@@ -88,7 +88,7 @@ CommandsRegistry.registerCommand({
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const errorMessageService = accessor.get(IErrorMessageService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
profile: profile,
@@ -110,7 +110,7 @@ CommandsRegistry.registerCommand({
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const errorMessageService = accessor.get(IErrorMessageService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
profile: profile,
@@ -131,7 +131,7 @@ CommandsRegistry.registerCommand({
const queryEditorService = accessor.get(IQueryEditorService);
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
profile: profile,
@@ -152,7 +152,7 @@ CommandsRegistry.registerCommand({
const queryEditorService = accessor.get(IQueryEditorService);
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const errorMessageService = accessor.get(IErrorMessageService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
@@ -174,7 +174,7 @@ CommandsRegistry.registerCommand({
const queryEditorService = accessor.get(IQueryEditorService);
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const errorMessageService = accessor.get(IErrorMessageService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
@@ -196,7 +196,7 @@ CommandsRegistry.registerCommand({
const queryEditorService = accessor.get(IQueryEditorService);
const connectionManagementService = accessor.get(IConnectionManagementService);
const scriptingService = accessor.get(IScriptingService);
const progressService = accessor.get(IProgressService2);
const progressService = accessor.get(IProgressService);
const profile = new ConnectionProfile(capabilitiesService, args.$treeItem.payload);
const baseContext: BaseActionContext = {
profile: profile,
@@ -206,4 +206,4 @@ CommandsRegistry.registerCommand({
queryEditorService, connectionManagementService, scriptingService);
return progressService.withProgress({ location: VIEWLET_ID }, () => editDataAction.run(baseContext));
}
});
});
@@ -57,7 +57,7 @@ export class ProfilerConnect extends Action {
public set connected(value: boolean) {
this._connected = value;
this._setClass(value ? 'disconnect' : 'connect');
this._setLabel(value ? ProfilerConnect.DisconnectText : ProfilerConnect.ConnectText);
this.label = value ? ProfilerConnect.DisconnectText : ProfilerConnect.ConnectText;
}
public get connected(): boolean {
@@ -131,7 +131,7 @@ export class ProfilerPause extends Action {
public set paused(value: boolean) {
this._paused = value;
this._setClass(value ? ProfilerPause.ResumeCssClass : ProfilerPause.PauseCssClass);
this._setLabel(value ? ProfilerPause.ResumeText : ProfilerPause.PauseText);
this.label = value ? ProfilerPause.ResumeText : ProfilerPause.PauseText;
}
public get paused(): boolean {
@@ -183,7 +183,7 @@ export class ProfilerAutoScroll extends Action {
run(input: ProfilerInput): Promise<boolean> {
this.checked = !this.checked;
this._setLabel(this.checked ? ProfilerAutoScroll.AutoScrollOnText : ProfilerAutoScroll.AutoScrollOffText);
this.label = this.checked ? ProfilerAutoScroll.AutoScrollOnText : ProfilerAutoScroll.AutoScrollOffText;
this._setClass(this.checked ? ProfilerAutoScroll.CheckedCssClass : '');
input.state.change({ autoscroll: this.checked });
return Promise.resolve(true);
@@ -286,7 +286,7 @@ export class ProfilerTableEditor extends BaseEditor implements IProfilerControll
: localize('ProfilerTableEditor.eventCount', 'Events: {0}', this._input.data.getLength());
this._disposeStatusbarItem();
this._statusbarItem = this._statusbarService.addEntry({ text: message }, StatusbarAlignment.RIGHT);
this._statusbarItem = this._statusbarService.addEntry({ text: message }, 'status.eventCount', localize('status.eventCount', "Event Count"), StatusbarAlignment.RIGHT);
}
}
@@ -4,14 +4,10 @@
*--------------------------------------------------------------------------------------------*/
import 'vs/css!./media/flavorStatus';
import { $, append, show, hide } from 'vs/base/browser/dom';
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { Disposable } from 'vs/base/common/lifecycle';
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { Action } from 'vs/base/common/actions';
import errors = require('vs/base/common/errors');
import { getCodeEditor } from 'vs/editor/browser/editorBrowser';
import * as nls from 'vs/nls';
@@ -24,6 +20,8 @@ import { INotificationService } from 'vs/platform/notification/common/notificati
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
import { IQuickInputService, IQuickPickItem } from 'vs/platform/quickinput/common/quickInput';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { IStatusbarService, StatusbarAlignment, IStatusbarEntryAccessor } from 'vs/platform/statusbar/common/statusbar';
export interface ISqlProviderEntry extends IQuickPickItem {
providerId: string;
@@ -59,53 +57,54 @@ class SqlProviderEntry implements ISqlProviderEntry {
}
// Shows SQL flavor status in the editor
export class SqlFlavorStatusbarItem implements IStatusbarItem {
export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchContribution {
private static readonly ID = 'status.query.flavor';
private statusItem: IStatusbarEntryAccessor;
private _element: HTMLElement;
private _flavorElement: HTMLElement;
private _sqlStatusEditors: { [editorUri: string]: SqlProviderEntry };
private _toDispose: IDisposable[];
constructor(
@IConnectionManagementService private _connectionManagementService: IConnectionManagementService,
@IEditorService private _editorService: EditorServiceImpl,
@IInstantiationService private _instantiationService: IInstantiationService,
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IEditorService private readonly editorService: EditorServiceImpl,
@IConnectionManagementService private readonly connectionManagementService: IConnectionManagementService
) {
super();
this._sqlStatusEditors = {};
}
public render(container: HTMLElement): IDisposable {
this._element = append(container, $('.query-statusbar-group'));
this._flavorElement = append(this._element, $('a.editor-status-selection'));
this._flavorElement.title = nls.localize('changeProvider', "Change SQL language provider");
this._flavorElement.onclick = () => this._onSelectionClick();
hide(this._flavorElement);
this.statusItem = this._register(
this.statusbarService.addEntry({
text: nls.localize('changeProvider', "Change SQL language provider"),
this._toDispose = [];
this._toDispose.push(
this._connectionManagementService.onLanguageFlavorChanged((changeParams: DidChangeLanguageFlavorParams) => this._onFlavorChanged(changeParams)),
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
},
SqlFlavorStatusbarItem.ID,
nls.localize('status.query.flavor', "SQL Language Flavor"),
StatusbarAlignment.RIGHT, 100)
);
return combinedDisposable(this._toDispose);
this._register(this.connectionManagementService.onLanguageFlavorChanged((changeParams: DidChangeLanguageFlavorParams) => this._onFlavorChanged(changeParams)));
this._register(this.editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()));
this._register(this.editorService.onDidCloseEditor(event => this._onEditorClosed(event)));
}
private _onSelectionClick() {
const action = this._instantiationService.createInstance(ChangeFlavorAction, ChangeFlavorAction.ID, ChangeFlavorAction.LABEL);
private hide() {
this.statusbarService.updateEntryVisibility(SqlFlavorStatusbarItem.ID, false);
}
action.run().then(null, errors.onUnexpectedError);
action.dispose();
private show() {
this.statusbarService.updateEntryVisibility(SqlFlavorStatusbarItem.ID, true);
}
private _onEditorClosed(event: IEditorCloseEvent): void {
let uri = WorkbenchUtils.getEditorUri(event.editor);
if (uri && uri in this._sqlStatusEditors) {
// If active editor is being closed, hide the query status.
let activeEditor = this._editorService.activeControl;
let activeEditor = this.editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (uri === currentUri) {
hide(this._flavorElement);
this.hide();
}
}
// note: intentionally not removing language flavor. This is preserved across close/open events at present
@@ -114,7 +113,7 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
}
private _onEditorsChanged(): void {
let activeEditor = this._editorService.activeControl;
let activeEditor = this.editorService.activeControl;
if (activeEditor) {
let uri = WorkbenchUtils.getEditorUri(activeEditor.input);
@@ -122,10 +121,10 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
if (uri) {
this._showStatus(uri);
} else {
hide(this._flavorElement);
this.hide();
}
} else {
hide(this._flavorElement);
this.hide();
}
}
@@ -145,17 +144,17 @@ export class SqlFlavorStatusbarItem implements IStatusbarItem {
// Show/hide query status for active editor
private _showStatus(uri: string): void {
let activeEditor = this._editorService.activeControl;
let activeEditor = this.editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (uri === currentUri) {
let flavor: SqlProviderEntry = this._sqlStatusEditors[uri];
if (flavor) {
this._flavorElement.textContent = flavor.label;
this.statusItem.update({ text: flavor.label });
} else {
this._flavorElement.textContent = SqlProviderEntry.getDefaultLabel();
this.statusItem.update({ text: SqlProviderEntry.getDefaultLabel() });
}
show(this._flavorElement);
this.show();
}
}
}
@@ -29,6 +29,11 @@ import * as gridActions from 'sql/workbench/parts/grid/views/gridActions';
import * as gridCommands from 'sql/workbench/parts/grid/views/gridCommands';
import * as Constants from 'sql/workbench/parts/query/common/constants';
import { localize } from 'vs/nls';
import { IWorkbenchContributionsRegistry, Extensions as WorkbenchExtensions } from 'vs/workbench/common/contributions';
import { LifecyclePhase } from 'vs/platform/lifecycle/common/lifecycle';
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions } from 'sql/workbench/parts/query/browser/statusBarItems';
import { SqlFlavorStatusbarItem } from 'sql/workbench/parts/query/browser/flavorStatus';
const gridCommandsWeightBonus = 100; // give our commands a little bit more weight over other default list/tree commands
@@ -514,3 +519,10 @@ configurationRegistry.registerConfiguration({
'type': 'object',
'properties': registryProperties
});
const workbenchRegistry = Registry.as<IWorkbenchContributionsRegistry>(WorkbenchExtensions.Workbench);
workbenchRegistry.registerWorkbenchContribution(TimeElapsedStatusBarContributions, LifecyclePhase.Restored);
workbenchRegistry.registerWorkbenchContribution(RowCountStatusBarContributions, LifecyclePhase.Restored);
workbenchRegistry.registerWorkbenchContribution(QueryStatusStatusBarContributions, LifecyclePhase.Restored);
workbenchRegistry.registerWorkbenchContribution(SqlFlavorStatusbarItem, LifecyclePhase.Restored);
@@ -184,7 +184,7 @@ export class QueryEditor extends BaseEditor {
this.setTaskbarContent();
this._toDispose.push(this.configurationService.onDidChangeConfiguration(e => {
this._register(this.configurationService.onDidChangeConfiguration(e => {
if (e.affectedKeys.includes('workbench.enablePreviewFeatures')) {
this.setTaskbarContent();
}
@@ -1,117 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { $, append, show, hide } from 'vs/base/browser/dom';
import { IDisposable, combinedDisposable } from 'vs/base/common/lifecycle';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import * as LocalizedConstants from 'sql/workbench/parts/query/common/localizedConstants';
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
// Query execution status
enum QueryExecutionStatus {
Executing,
Completed
}
// Shows query status in the editor
export class QueryStatusbarItem implements IStatusbarItem {
private _element: HTMLElement;
private _queryElement: HTMLElement;
private _queryStatusEditors: { [editorUri: string]: QueryExecutionStatus };
private _toDispose: IDisposable[];
constructor(
@IQueryModelService private _queryModelService: IQueryModelService,
@IEditorService private _editorService: EditorServiceImpl
) {
this._queryStatusEditors = {};
}
public render(container: HTMLElement): IDisposable {
this._element = append(container, $('.query-statusbar-group'));
this._queryElement = append(this._element, $('div.query-statusbar-item'));
hide(this._queryElement);
this._toDispose = [];
this._toDispose.push(
this._queryModelService.onRunQueryStart((uri: string) => this._onRunQueryStart(uri)),
this._queryModelService.onRunQueryComplete((uri: string) => this._onRunQueryComplete(uri)),
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
);
return combinedDisposable(this._toDispose);
}
private _onEditorClosed(event: IEditorCloseEvent): void {
let uri = WorkbenchUtils.getEditorUri(event.editor);
if (uri && uri in this._queryStatusEditors) {
// If active editor is being closed, hide the query status.
let activeEditor = this._editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (uri === currentUri) {
hide(this._queryElement);
}
}
delete this._queryStatusEditors[uri];
}
}
private _onEditorsChanged(): void {
let activeEditor = this._editorService.activeControl;
if (activeEditor) {
let uri = WorkbenchUtils.getEditorUri(activeEditor.input);
// Show active editor's query status
if (uri && uri in this._queryStatusEditors) {
this._showStatus(uri);
} else {
hide(this._queryElement);
}
} else {
hide(this._queryElement);
}
}
private _onRunQueryStart(uri: string): void {
this._updateStatus(uri, QueryExecutionStatus.Executing);
}
private _onRunQueryComplete(uri: string): void {
this._updateStatus(uri, QueryExecutionStatus.Completed);
}
// Update query status for the editor
private _updateStatus(uri: string, newStatus: QueryExecutionStatus) {
if (uri) {
this._queryStatusEditors[uri] = newStatus;
this._showStatus(uri);
}
}
// Show/hide query status for active editor
private _showStatus(uri: string): void {
let activeEditor = this._editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (uri === currentUri) {
switch (this._queryStatusEditors[uri]) {
case QueryExecutionStatus.Executing:
this._queryElement.textContent = LocalizedConstants.msgStatusRunQueryInProgress;
show(this._queryElement);
break;
default:
hide(this._queryElement);
}
}
}
}
}
@@ -1,99 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import QueryRunner from 'sql/platform/query/common/queryRunner';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IDisposable, combinedDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { append, $, hide, show } from 'vs/base/browser/dom';
import * as nls from 'vs/nls';
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
export class RowCountStatusBarItem implements IStatusbarItem {
private _element: HTMLElement;
private _flavorElement: HTMLElement;
private dispose: IDisposable[];
constructor(
@IEditorService private _editorService: EditorServiceImpl,
@IQueryModelService private _queryModelService: IQueryModelService
) { }
render(container: HTMLElement): IDisposable {
let disposables = [
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
];
this._element = append(container, $('.query-statusbar-group'));
this._flavorElement = append(this._element, $('.editor-status-selection'));
this._flavorElement.title = nls.localize('rowStatus', "Row Count");
hide(this._flavorElement);
this._showStatus();
return combinedDisposable(disposables);
}
private _onEditorsChanged() {
this._showStatus();
}
private _onEditorClosed(event: IEditorCloseEvent) {
hide(this._flavorElement);
}
// Show/hide query status for active editor
private _showStatus(): void {
hide(this._flavorElement);
dispose(this.dispose);
this.dispose = [];
let activeEditor = this._editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (currentUri) {
let queryRunner = this._queryModelService.getQueryRunner(currentUri);
if (queryRunner) {
if (queryRunner.hasCompleted) {
this._displayValue(queryRunner);
}
this.dispose.push(queryRunner.onQueryEnd(e => {
this._displayValue(queryRunner);
}));
this.dispose.push(queryRunner.onQueryStart(e => {
hide(this._flavorElement);
}));
} else {
this.dispose.push(this._queryModelService.onRunQueryComplete(e => {
if (e === currentUri) {
this._displayValue(this._queryModelService.getQueryRunner(currentUri));
}
}));
this.dispose.push(this._queryModelService.onRunQueryStart(e => {
if (e === currentUri) {
hide(this._flavorElement);
}
}));
}
}
}
}
private _displayValue(runner: QueryRunner) {
let rowCount = runner.batchSets.reduce((p, c) => {
return p + c.resultSetSummaries.reduce((rp, rc) => {
return rp + rc.rowCount;
}, 0);
}, 0);
this._flavorElement.innerText = nls.localize('rowCount', "{0} rows", rowCount);
show(this._flavorElement);
}
}
@@ -0,0 +1,238 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import { IntervalTimer } from 'vs/base/common/async';
import { IStatusbarService, StatusbarAlignment, IStatusbarEntryAccessor } from 'vs/platform/statusbar/common/statusbar';
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
import { localize } from 'vs/nls';
import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
import QueryRunner from 'sql/platform/query/common/queryRunner';
import { parseNumAsTimeString } from 'sql/platform/connection/common/utils';
import { Event } from 'vs/base/common/event';
export class TimeElapsedStatusBarContributions extends Disposable implements IWorkbenchContribution {
private static readonly ID = 'status.query.timeElapsed';
private statusItem: IStatusbarEntryAccessor;
private intervalTimer = new IntervalTimer();
private disposable = this._register(new DisposableStore());
constructor(
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IEditorService private readonly editorService: IEditorService,
@IQueryModelService private readonly queryModelService: IQueryModelService
) {
super();
this.statusItem = this._register(
this.statusbarService.addEntry({
text: '',
},
TimeElapsedStatusBarContributions.ID,
localize('status.query.timeElapsed', "Time Elapsed"),
StatusbarAlignment.RIGHT, 100)
);
this._register(editorService.onDidActiveEditorChange(this.update, this));
this.update();
}
private hide() {
this.statusbarService.updateEntryVisibility(TimeElapsedStatusBarContributions.ID, false);
}
private show() {
this.statusbarService.updateEntryVisibility(TimeElapsedStatusBarContributions.ID, true);
}
private update() {
this.intervalTimer.cancel();
this.disposable.clear();
this.hide();
const activeInput = this.editorService.activeEditor;
if (activeInput && activeInput instanceof QueryInput && activeInput.uri) {
const uri = activeInput.uri;
const runner = this.queryModelService.getQueryRunner(uri);
if (runner) {
if (runner.hasCompleted || runner.isExecuting) {
this._displayValue(runner);
}
this.disposable.add(runner.onQueryStart(e => {
this._displayValue(runner);
}));
this.disposable.add(runner.onQueryEnd(e => {
this._displayValue(runner);
}));
} else {
this.disposable.add(this.queryModelService.onRunQueryStart(e => {
if (e === uri) {
this._displayValue(this.queryModelService.getQueryRunner(uri));
}
}));
this.disposable.add(this.queryModelService.onRunQueryComplete(e => {
if (e === uri) {
this._displayValue(this.queryModelService.getQueryRunner(uri));
}
}));
}
}
}
private _displayValue(runner: QueryRunner) {
this.intervalTimer.cancel();
if (runner.isExecuting) {
this.intervalTimer.cancelAndSet(() => {
const value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
this.statusItem.update({
text: parseNumAsTimeString(value, false)
});
}, 1000);
const value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
this.statusItem.update({
text: parseNumAsTimeString(value, false)
});
} else {
const value = runner.queryStartTime && runner.queryEndTime
? runner.queryEndTime.getTime() - runner.queryStartTime.getTime() : 0;
this.statusItem.update({
text: parseNumAsTimeString(value, false)
});
}
this.show();
}
}
export class RowCountStatusBarContributions extends Disposable implements IWorkbenchContribution {
private static readonly ID = 'status.query.rowCount';
private statusItem: IStatusbarEntryAccessor;
private disposable = this._register(new DisposableStore());
constructor(
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IEditorService private readonly editorService: IEditorService,
@IQueryModelService private readonly queryModelService: IQueryModelService
) {
super();
this.statusItem = this._register(
this.statusbarService.addEntry({
text: '',
},
RowCountStatusBarContributions.ID,
localize('status.query.rowCount', "Row Count"),
StatusbarAlignment.RIGHT, 100)
);
this._register(editorService.onDidActiveEditorChange(this.update, this));
this.update();
}
private hide() {
this.statusbarService.updateEntryVisibility(RowCountStatusBarContributions.ID, false);
}
private show() {
this.statusbarService.updateEntryVisibility(RowCountStatusBarContributions.ID, true);
}
private update() {
this.disposable.clear();
this.hide();
const activeInput = this.editorService.activeEditor;
if (activeInput && activeInput instanceof QueryInput && activeInput.uri) {
const uri = activeInput.uri;
const runner = this.queryModelService.getQueryRunner(uri);
if (runner) {
if (runner.hasCompleted || runner.isExecuting) {
this._displayValue(runner);
}
this.disposable.add(runner.onQueryStart(e => {
this._displayValue(runner);
}));
this.disposable.add(runner.onQueryEnd(e => {
this._displayValue(runner);
}));
} else {
this.disposable.add(this.queryModelService.onRunQueryStart(e => {
if (e === uri) {
this._displayValue(this.queryModelService.getQueryRunner(uri));
}
}));
this.disposable.add(this.queryModelService.onRunQueryComplete(e => {
if (e === uri) {
this._displayValue(this.queryModelService.getQueryRunner(uri));
}
}));
}
}
}
private _displayValue(runner: QueryRunner) {
const rowCount = runner.batchSets.reduce((p, c) => {
return p + c.resultSetSummaries.reduce((rp, rc) => {
return rp + rc.rowCount;
}, 0);
}, 0);
const text = localize('rowCount', "{0} rows", rowCount);
this.statusItem.update({ text });
this.show();
}
}
export class QueryStatusStatusBarContributions extends Disposable implements IWorkbenchContribution {
private static readonly ID = 'status.query.status';
private visisbleUri: string | undefined;
constructor(
@IStatusbarService private readonly statusbarService: IStatusbarService,
@IEditorService private readonly editorService: IEditorService,
@IQueryModelService private readonly queryModelService: IQueryModelService
) {
super();
this._register(
this.statusbarService.addEntry({
text: localize('query.status.executing', 'Executing query...'),
},
QueryStatusStatusBarContributions.ID,
localize('status.query.status', "Execution Status"),
StatusbarAlignment.RIGHT, 100)
);
this._register(Event.filter(this.queryModelService.onRunQueryStart, uri => uri === this.visisbleUri)(this.update, this));
this._register(Event.filter(this.queryModelService.onRunQueryComplete, uri => uri === this.visisbleUri)(this.update, this));
this._register(this.editorService.onDidActiveEditorChange(this.update, this));
this.update();
}
private update() {
this.hide();
this.visisbleUri = undefined;
const activeInput = this.editorService.activeEditor;
if (activeInput && activeInput instanceof QueryInput && activeInput.uri) {
this.visisbleUri = activeInput.uri;
const runner = this.queryModelService.getQueryRunner(this.visisbleUri);
if (runner && runner.isExecuting) {
this.show();
}
}
}
private hide() {
this.statusbarService.updateEntryVisibility(QueryStatusStatusBarContributions.ID, false);
}
private show() {
this.statusbarService.updateEntryVisibility(QueryStatusStatusBarContributions.ID, true);
}
}
@@ -1,112 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as WorkbenchUtils from 'sql/workbench/common/sqlWorkbenchUtils';
import { IQueryModelService } from 'sql/platform/query/common/queryModel';
import QueryRunner from 'sql/platform/query/common/queryRunner';
import { parseNumAsTimeString } from 'sql/platform/connection/common/utils';
import { IStatusbarItem } from 'vs/workbench/browser/parts/statusbar/statusbar';
import { IDisposable, combinedDisposable, dispose } from 'vs/base/common/lifecycle';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IEditorCloseEvent } from 'vs/workbench/common/editor';
import { append, $, hide, show } from 'vs/base/browser/dom';
import * as nls from 'vs/nls';
import { EditorServiceImpl } from 'vs/workbench/browser/parts/editor/editor';
import { IntervalTimer } from 'vs/base/common/async';
export class TimeElapsedStatusBarItem implements IStatusbarItem {
private _element: HTMLElement;
private _flavorElement: HTMLElement;
private dispose: IDisposable[] = [];
private intervalTimer = new IntervalTimer();
constructor(
@IEditorService private _editorService: EditorServiceImpl,
@IQueryModelService private _queryModelService: IQueryModelService
) { }
render(container: HTMLElement): IDisposable {
let disposables = [
this._editorService.onDidVisibleEditorsChange(() => this._onEditorsChanged()),
this._editorService.onDidCloseEditor(event => this._onEditorClosed(event))
];
this._element = append(container, $('.query-statusbar-group'));
this._flavorElement = append(this._element, $('.editor-status-selection'));
this._flavorElement.title = nls.localize('timeElapsed', "Time Elapsed");
hide(this._flavorElement);
this._showStatus();
return combinedDisposable(disposables);
}
private _onEditorsChanged() {
this._showStatus();
}
private _onEditorClosed(event: IEditorCloseEvent) {
hide(this._flavorElement);
}
// Show/hide query status for active editor
private _showStatus(): void {
this.intervalTimer.cancel();
hide(this._flavorElement);
dispose(this.dispose);
this._flavorElement.innerText = '';
this.dispose = [];
let activeEditor = this._editorService.activeControl;
if (activeEditor) {
let currentUri = WorkbenchUtils.getEditorUri(activeEditor.input);
if (currentUri) {
let queryRunner = this._queryModelService.getQueryRunner(currentUri);
if (queryRunner) {
if (queryRunner.hasCompleted || queryRunner.isExecuting) {
this._displayValue(queryRunner);
}
this.dispose.push(queryRunner.onQueryStart(e => {
this._displayValue(queryRunner);
}));
this.dispose.push(queryRunner.onQueryEnd(e => {
this._displayValue(queryRunner);
}));
} else {
this.dispose.push(this._queryModelService.onRunQueryStart(e => {
if (e === currentUri) {
this._displayValue(this._queryModelService.getQueryRunner(currentUri));
}
}));
this.dispose.push(this._queryModelService.onRunQueryComplete(e => {
if (e === currentUri) {
this._displayValue(this._queryModelService.getQueryRunner(currentUri));
}
}));
}
}
}
}
private _displayValue(runner: QueryRunner) {
this.intervalTimer.cancel();
if (runner.isExecuting) {
this.intervalTimer.cancelAndSet(() => {
let value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
this._flavorElement.innerText = parseNumAsTimeString(value, false);
}, 1000);
let value = runner.queryStartTime ? Date.now() - runner.queryStartTime.getTime() : 0;
this._flavorElement.innerText = parseNumAsTimeString(value, false);
} else {
let value = runner.queryStartTime && runner.queryEndTime
? runner.queryEndTime.getTime() - runner.queryStartTime.getTime() : 0;
this._flavorElement.innerText = parseNumAsTimeString(value, false);
}
show(this._flavorElement);
}
}
@@ -210,6 +210,13 @@ export class QueryInput extends EditorInput implements IEncodingSupport, IConnec
public getResource(): URI { return this._sql.getResource(); }
public getEncoding(): string { return this._sql.getEncoding(); }
public suggestFileName(): string { return this._sql.suggestFileName(); }
hasBackup(): boolean {
if (this.sql) {
return this.sql.hasBackup();
}
return false;
}
public getName(longForm?: boolean): string {
if (this._configurationService.getValue('sql.showConnectionInfoInTitle')) {
@@ -4,9 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import * as azdata from 'azdata';
import * as platform from 'vs/platform/registry/common/platform';
import * as statusbar from 'vs/workbench/browser/parts/statusbar/statusbar';
import { StatusbarAlignment } from 'vs/platform/statusbar/common/statusbar';
import { Event, Emitter } from 'vs/base/common/event';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
@@ -17,7 +14,6 @@ import { Memento } from 'vs/workbench/common/memento';
import AccountStore from 'sql/platform/accounts/common/accountStore';
import { AccountDialogController } from 'sql/platform/accounts/browser/accountDialogController';
import { AutoOAuthDialogController } from 'sql/platform/accounts/browser/autoOAuthDialogController';
import { AccountListStatusbarItem } from 'sql/platform/accounts/browser/accountListStatusbarItem';
import { AccountProviderAddedEventParams, UpdateAccountListEventParams } from 'sql/platform/accounts/common/eventTypes';
import { IAccountManagementService } from 'sql/platform/accounts/common/interfaces';
import { Deferred } from 'sql/base/common/promise';
@@ -65,14 +61,6 @@ export class AccountManagementService implements IAccountManagementService {
this._updateAccountListEmitter = new Emitter<UpdateAccountListEventParams>();
_storageService.onWillSaveState(() => this.shutdown());
// Register status bar item
let statusbarDescriptor = new statusbar.StatusbarItemDescriptor(
AccountListStatusbarItem,
StatusbarAlignment.LEFT,
15000 /* Highest Priority */
);
(<statusbar.IStatusbarRegistry>platform.Registry.as(statusbar.Extensions.Statusbar)).registerStatusbarItem(statusbarDescriptor);
}
private get autoOAuthDialogController(): AutoOAuthDialogController {
@@ -22,11 +22,11 @@ import { ICommandService } from 'vs/platform/commands/common/commands';
import { ipcRenderer as ipc } from 'electron';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { IStatusbarService } from 'vs/platform/statusbar/common/statusbar';
import { localize } from 'vs/nls';
import { QueryInput } from 'sql/workbench/parts/query/common/queryInput';
import { URI } from 'vs/base/common/uri';
import { ILogService } from 'vs/platform/log/common/log';
import { INotificationService } from 'vs/platform/notification/common/notification';
export class CommandLineService implements ICommandLineProcessing {
public _serviceBrand: any;
@@ -40,7 +40,7 @@ export class CommandLineService implements ICommandLineProcessing {
@IEditorService private _editorService: IEditorService,
@ICommandService private _commandService: ICommandService,
@IConfigurationService private _configurationService: IConfigurationService,
@IStatusbarService private _statusBarService: IStatusbarService,
@INotificationService private _notificationService: INotificationService,
@ILogService private logService: ILogService
) {
if (ipc) {
@@ -92,8 +92,8 @@ export class CommandLineService implements ICommandLineProcessing {
}
let connectedContext: azdata.ConnectedContext = undefined;
if (profile) {
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('connectingLabel', 'Connecting:') + profile.serverName, 2500);
if (this._notificationService) {
this._notificationService.status(localize('connectingLabel', 'Connecting: {0}', profile.serverName), { hideAfter: 2500 });
}
try {
await this._connectionManagementService.connectIfNotConnected(profile, 'connection', true);
@@ -106,8 +106,8 @@ export class CommandLineService implements ICommandLineProcessing {
}
}
if (commandName) {
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('runningCommandLabel', 'Running command:') + commandName, 2500);
if (this._notificationService) {
this._notificationService.status(localize('runningCommandLabel', 'Running command: {0}', commandName), { hideAfter: 2500 });
}
await this._commandService.executeCommand(commandName, connectedContext);
} else if (profile) {
@@ -119,8 +119,8 @@ export class CommandLineService implements ICommandLineProcessing {
}
else {
// Default to showing new query
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('openingNewQueryLabel', 'Opening new query:') + profile.serverName, 2500);
if (this._notificationService) {
this._notificationService.status(localize('openingNewQueryLabel', 'Opening new query: {0}', profile.serverName), { hideAfter: 2500 });
}
try {
await TaskUtilities.newQuery(profile,
@@ -150,8 +150,8 @@ export class CommandLineService implements ICommandLineProcessing {
showConnectionDialogOnError: warnOnConnectFailure,
showFirewallRuleOnError: warnOnConnectFailure
};
if (this._statusBarService) {
this._statusBarService.setStatusMessage(localize('connectingQueryLabel', 'Connecting query file'), 2500);
if (this._notificationService) {
this._notificationService.status(localize('connectingQueryLabel', 'Connecting query file'), { hideAfter: 2500 });
}
await this._connectionManagementService.connect(profile, uriString, options);
}
@@ -451,10 +451,6 @@ export class ConnectionDialogWidget extends Modal {
this.onProviderTypeSelected(providerDisplayName);
}
public dispose(): void {
this._toDispose.forEach(obj => obj.dispose());
}
public set databaseDropdownExpanded(val: boolean) {
this._databaseDropdownExpanded = val;
}
@@ -140,9 +140,9 @@ export class ConnectionWidget {
});
}
protected _handleClipboard(): void {
protected async _handleClipboard(): Promise<void> {
if (this._configurationService.getValue<boolean>('connection.parseClipboardForConnectionString')) {
let paste = this._clipboardService.readText();
let paste = await this._clipboardService.readText();
this._connectionManagementService.buildConnectionInfo(paste, this._providerName).then(e => {
if (e) {
let profile = new ConnectionProfile(this._capabilitiesService, this._providerName);
@@ -24,7 +24,16 @@ import { IConfigurationResolverService } from 'vs/workbench/services/configurati
import { IFileService } from 'vs/platform/files/common/files';
class TestEnvironmentService implements IWorkbenchEnvironmentService {
machineSettingsHome: string;
webviewCspSource: string;
webviewCspRule: string;
localeResource: URI;
userRoamingDataHome: URI;
webviewEndpoint?: string;
webviewResourceRoot: string;
keyboardLayoutResource: URI;
machineSettingsResource: URI;
keybindingsResource: URI;
machineSettingsHome: URI;
machineSettingsPath: string;
extensionDevelopmentLocationURI?: URI[];
@@ -47,14 +56,15 @@ class TestEnvironmentService implements IWorkbenchEnvironmentService {
userDataPath: string;
appNameLong: string;
appQuality?: string;
appSettingsHome: string;
appSettingsPath: string;
appSettingsHome: URI;
settingsResource: URI;
appKeybindingsPath: string;
settingsSearchBuildId?: number;
settingsSearchUrl?: string;
globalStorageHome: string;
workspaceStorageHome: string;
backupHome: string;
backupHome: URI;
backupWorkspacesPath: string;
untitledWorkspacesHome: URI;
isExtensionDevelopment: boolean;
@@ -8,7 +8,7 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
import { TelemetryServiceStub } from 'sqltest/stubs/telemetryServiceStub';
import * as TypeMoq from 'typemoq';
import * as assert from 'assert';
import { TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { NullLogService } from 'vs/platform/log/common/log';
suite('SQL Telemetry Utilities tests', () => {
let telemetryService: TypeMoq.Mock<ITelemetryService>;
@@ -42,7 +42,7 @@ suite('SQL Telemetry Utilities tests', () => {
test('addTelemetry should add provider id using the connection', (done) => {
let data: TelemetryUtils.IConnectionTelemetryData = {
};
const logService = new TestLogService();
const logService = new NullLogService();
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b.provider === providerName)), TypeMoq.Times.once());
done();
@@ -59,7 +59,7 @@ suite('SQL Telemetry Utilities tests', () => {
};
data.test1 = '1';
const logService = new TestLogService();
const logService = new NullLogService();
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
telemetryService.verify(x => x.publicLog(
TypeMoq.It.is(a => a === telemetryKey),
@@ -77,7 +77,7 @@ suite('SQL Telemetry Utilities tests', () => {
test('addTelemetry should not crash not given data', (done) => {
const logService = new TestLogService();
const logService = new NullLogService();
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey).then(() => {
telemetryService.verify(x => x.publicLog(
TypeMoq.It.is(a => a === telemetryKey),
@@ -95,7 +95,7 @@ suite('SQL Telemetry Utilities tests', () => {
};
data.provider = providerName + '1';
const logService = new TestLogService();
const logService = new NullLogService();
TelemetryUtils.addTelemetry(telemetryService.object, logService, telemetryKey, data, connectionProfile).then(() => {
telemetryService.verify(x => x.publicLog(TypeMoq.It.is(a => a === telemetryKey), TypeMoq.It.is(b => b.provider === data.provider)), TypeMoq.Times.once());
done();
@@ -22,10 +22,10 @@ import { WorkspaceConfigurationTestService } from 'sqltest/stubs/workspaceConfig
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { assertThrowsAsync } from 'sqltest/utils/testUtils';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { TestEditorService, TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { TestEditorService } from 'vs/workbench/test/workbenchTestServices';
import { QueryInput, QueryEditorState } from 'sql/workbench/parts/query/common/queryInput';
import { URI } from 'vs/base/common/uri';
import { ILogService } from 'vs/platform/log/common/log';
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
class TestParsedArgs implements ParsedArgs {
[arg: string]: any;
@@ -199,7 +199,7 @@ suite('commandLineService tests', () => {
.verifiable(TypeMoq.Times.once());
connectionManagementService.setup(c => c.getConnectionProfileById(TypeMoq.It.isAnyString())).returns(() => originalProfile);
const configurationService = getConfigurationServiceMock(true);
const logService = new TestLogService();
const logService = new NullLogService();
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, undefined, undefined, logService);
await service.processCommandLine(args);
connectionManagementService.verifyAll();
@@ -304,7 +304,7 @@ suite('commandLineService tests', () => {
connectionManagementService.setup(c => c.getConnectionProfileById(TypeMoq.It.isAnyString())).returns(() => originalProfile);
connectionManagementService.setup(c => c.getConnectionGroups(TypeMoq.It.isAny())).returns(() => []);
const configurationService = getConfigurationServiceMock(true);
const logService = new TestLogService();
const logService = new NullLogService();
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, undefined, undefined, logService);
await service.processCommandLine(args);
connectionManagementService.verifyAll();
@@ -347,7 +347,7 @@ suite('commandLineService tests', () => {
connectionManagementService.setup(c => c.getConnectionProfileById('testID')).returns(() => originalProfile).verifiable(TypeMoq.Times.once());
connectionManagementService.setup(x => x.getConnectionGroups(TypeMoq.It.isAny())).returns(() => [conProfGroup]);
const configurationService = getConfigurationServiceMock(true);
const logService = new TestLogService();
const logService = new NullLogService();
let service = getCommandLineService(connectionManagementService.object, configurationService.object, capabilitiesService, undefined, undefined, logService);
await service.processCommandLine(args);
connectionManagementService.verifyAll();
@@ -32,8 +32,9 @@ import * as TypeMoq from 'typemoq';
import { IConnectionProfileGroup, ConnectionProfileGroup } from 'sql/platform/connection/common/connectionProfileGroup';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { AccountManagementTestService } from 'sqltest/stubs/accountManagementStubs';
import { TestStorageService, TestEnvironmentService, TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { TestStorageService, TestEnvironmentService } from 'vs/workbench/test/workbenchTestServices';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { NullLogService } from 'vs/platform/log/common/log';
suite('SQL ConnectionManagementService tests', () => {
@@ -86,7 +87,7 @@ suite('SQL ConnectionManagementService tests', () => {
connectionStore = TypeMoq.Mock.ofType(ConnectionStore, TypeMoq.MockBehavior.Loose, new TestStorageService());
workbenchEditorService = TypeMoq.Mock.ofType(WorkbenchEditorTestService);
editorGroupService = TypeMoq.Mock.ofType(EditorGroupTestService);
connectionStatusManager = new ConnectionStatusManager(capabilitiesService, new TestLogService(), TestEnvironmentService, new TestNotificationService());
connectionStatusManager = new ConnectionStatusManager(capabilitiesService, new NullLogService(), TestEnvironmentService, new TestNotificationService());
mssqlConnectionProvider = TypeMoq.Mock.ofType(ConnectionProviderStub);
let resourceProviderStub = new ResourceProviderStub();
resourceProviderStubMock = TypeMoq.Mock.ofInstance(resourceProviderStub);
@@ -160,14 +161,13 @@ suite('SQL ConnectionManagementService tests', () => {
workspaceConfigurationServiceMock.object,
capabilitiesService,
undefined, // IQuickInputService
undefined, // IStatusbarService
new TestNotificationService(),
resourceProviderStubMock.object,
undefined, // IAngularEventingService
accountManagementService.object,
new TestLogService(), // ILogService
new NullLogService(), // ILogService
undefined, // IStorageService
TestEnvironmentService,
new TestNotificationService()
TestEnvironmentService
);
return connectionManagementService;
}
@@ -10,9 +10,10 @@ import * as Utils from 'sql/platform/connection/common/utils';
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
import { TestEnvironmentService, TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { TestEnvironmentService } from 'vs/workbench/test/workbenchTestServices';
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { NullLogService } from 'vs/platform/log/common/log';
let connections: ConnectionStatusManager;
let capabilitiesService: CapabilitiesTestService;
@@ -77,7 +78,7 @@ suite('SQL ConnectionStatusManager tests', () => {
setup(() => {
capabilitiesService = new CapabilitiesTestService();
connectionProfileObject = new ConnectionProfile(capabilitiesService, connectionProfile);
connections = new ConnectionStatusManager(capabilitiesService, new TestLogService(), TestEnvironmentService, new TestNotificationService());
connections = new ConnectionStatusManager(capabilitiesService, new NullLogService(), TestEnvironmentService, new TestNotificationService());
connection1Id = Utils.generateUri(connectionProfile);
connection2Id = 'connection2Id';
connection3Id = 'connection3Id';
@@ -254,4 +255,4 @@ suite('SQL ConnectionStatusManager tests', () => {
assert.equal(activeConnections.length, 4);
assert.equal(activeConnections.filter(connection => connection.matches(newConnection)).length, 1, 'Did not find newConnection in active connections');
});
});
});
@@ -18,8 +18,8 @@ import { ServerTreeView } from 'sql/workbench/parts/objectExplorer/browser/serve
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/workbench/api/common/sqlExtHostTypes';
import { Event, Emitter } from 'vs/base/common/event';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
import { TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { NullLogService } from 'vs/platform/log/common/log';
suite('SQL Object Explorer Service tests', () => {
let sqlOEProvider: TypeMoq.Mock<ObjectExplorerProviderTestService>;
@@ -270,7 +270,7 @@ suite('SQL Object Explorer Service tests', () => {
}
};
const logService = new TestLogService();
const logService = new NullLogService();
objectExplorerService = new ObjectExplorerService(connectionManagementService.object, undefined, capabilitiesService, logService);
objectExplorerService.registerProvider(mssqlProviderName, sqlOEProvider.object);
sqlOEProvider.setup(x => x.createNewSession(TypeMoq.It.is<azdata.ConnectionInfo>(x => x.options['serverName'] === connection.serverName))).returns(() => new Promise<any>((resolve) => {
@@ -15,8 +15,8 @@ import { ConnectionManagementInfo } from 'sql/platform/connection/common/connect
import * as TypeMoq from 'typemoq';
import * as assert from 'assert';
import { TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { NullLogService } from 'vs/platform/log/common/log';
class TestChangeDetectorRef extends ChangeDetectorRef {
reattach(): void {
@@ -98,7 +98,7 @@ suite('Dashboard Properties Widget Tests', () => {
dashboardService.setup(x => x.connectionManagementService).returns(() => singleConnectionService.object);
const testLogService = new class extends TestLogService {
const testLogService = new class extends NullLogService {
error() {
assert.fail('Called console Error unexpectedly');
}
@@ -24,11 +24,12 @@ import { Memento } from 'vs/workbench/common/memento';
import { Emitter } from 'vs/base/common/event';
import { CapabilitiesTestService } from 'sqltest/stubs/capabilitiesTestService';
import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService';
import { TestStorageService, TestLogService } from 'vs/workbench/test/workbenchTestServices';
import { TestStorageService } from 'vs/workbench/test/workbenchTestServices';
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
import { ServiceCollection } from 'vs/platform/instantiation/common/serviceCollection';
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { NullLogService } from 'vs/platform/log/common/log';
let expectedNotebookContent: nb.INotebookContents = {
cells: [{
@@ -83,7 +84,7 @@ suite('notebook model', function (): void {
let memento: TypeMoq.Mock<Memento>;
let queryConnectionService: TypeMoq.Mock<ConnectionManagementService>;
let defaultModelOptions: INotebookModelOptions;
const logService = new TestLogService();
const logService = new NullLogService();
setup(() => {
sessionReady = new Deferred<void>();
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
@@ -36,7 +36,7 @@ suite('ConnectionManagementService Tests:', () => {
connectionStoreMock.setup(x => x.getConnectionProfileGroups(TypeMoq.It.isAny(), undefined)).returns(() => {
return [group1];
});
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
const connectionManagementService = new ConnectionManagementService(connectionStoreMock.object, connectionStatusManagerMock.object, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined, undefined);
// dupe connections have been seeded the numbers below already reflected the de-duped results
@@ -80,4 +80,4 @@ function createConnectionProfile(id: string): ConnectionProfile {
function createConnectionGroup(id: string): ConnectionProfileGroup {
return new ConnectionProfileGroup(id, undefined, id, undefined, undefined);
}
}
+9 -13
View File
@@ -13,6 +13,15 @@ import { IDimension } from 'vs/editor/common/editorCommon';
import { IDisposable } from 'vs/base/common/lifecycle';
export class EditorGroupTestService implements IEditorGroupsService {
getSize(group: number | IEditorGroup): {
width: number; height: number; /**
* Move an editor from this group either within this group or to another group.
*/ } {
throw new Error('Method not implemented.');
}
setSize(group: number | IEditorGroup, size: { width: number; height: number; }): void {
throw new Error('Method not implemented.');
}
willRestoreEditors: boolean;
dimension: IDimension;
whenRestored: Promise<void>;
@@ -212,19 +221,6 @@ export class EditorGroupTestService implements IEditorGroupsService {
}
/**
* Returns the size of a group.
*/
getSize(group: IEditorGroup | GroupIdentifier): number {
return 0;
}
/**
* Sets the size of a group.
*/
setSize(group: IEditorGroup | GroupIdentifier, size: number): void {
}
/**
* Applies the provided layout by either moving existing groups or creating new groups.
*/
+3
View File
@@ -7,6 +7,9 @@ import { IStorageService, StorageScope, IWorkspaceStorageChangeEvent, IWillSaveS
import { Event } from 'vs/base/common/event';
export class StorageTestService implements IStorageService {
logStorage(): void {
}
_serviceBrand: any;
/**
@@ -3,6 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import { ITelemetryService, ITelemetryData, ITelemetryInfo } from 'vs/platform/telemetry/common/telemetry';
import { ClassifiedEvent, GDPRClassification, StrictPropertyCheck } from 'vs/platform/telemetry/common/gdprTypings';
// Test stubs for commonly used objects
@@ -21,6 +22,10 @@ export class TelemetryServiceStub implements ITelemetryService {
return undefined;
}
publicLog2<E extends ClassifiedEvent<T> = never, T extends GDPRClassification<T> = never>(eventName: string, data?: StrictPropertyCheck<T, E>, anonymizeFilePaths?: boolean): Promise<void> {
return undefined;
}
getTelemetryInfo(): Promise<ITelemetryInfo> {
return undefined;
}
@@ -12,7 +12,7 @@ import { TestRPCProtocol } from 'vs/workbench/test/electron-browser/api/testRPCP
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
import { IRPCProtocol } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { MainThreadAccountManagement } from 'sql/workbench/api/node/mainThreadAccountManagement';
import { MainThreadAccountManagement } from 'sql/workbench/api/browser/mainThreadAccountManagement';
import { IAccountManagementService, AzureResource } from 'sql/platform/accounts/common/interfaces';
import { createDecorator } from 'vs/platform/instantiation/common/instantiation';
@@ -9,7 +9,7 @@ import { TestInstantiationService } from 'vs/platform/instantiation/test/common/
import { ExtHostCredentialManagement } from 'sql/workbench/api/node/extHostCredentialManagement';
import { SqlMainContext } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { IRPCProtocol } from 'vs/workbench/services/extensions/common/proxyIdentifier';
import { MainThreadCredentialManagement } from 'sql/workbench/api/node/mainThreadCredentialManagement';
import { MainThreadCredentialManagement } from 'sql/workbench/api/browser/mainThreadCredentialManagement';
import { CredentialsTestProvider, CredentialsTestService } from 'sqltest/stubs/credentialsTestStubs';
import { ICredentialsService } from 'sql/platform/credentials/common/credentialsService';
import { Credential, CredentialProvider } from 'azdata';
@@ -5,7 +5,7 @@
import * as azdata from 'azdata';
import { Mock, It, Times } from 'typemoq';
import { MainThreadBackgroundTaskManagement, TaskStatus } from 'sql/workbench/api/node/mainThreadBackgroundTaskManagement';
import { MainThreadBackgroundTaskManagement, TaskStatus } from 'sql/workbench/api/browser/mainThreadBackgroundTaskManagement';
import { ExtHostBackgroundTaskManagementShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { ITaskService } from 'sql/platform/tasks/common/tasksService';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
@@ -5,7 +5,7 @@
import * as assert from 'assert';
import { Mock, It, Times } from 'typemoq';
import { MainThreadModelViewDialog } from 'sql/workbench/api/node/mainThreadModelViewDialog';
import { MainThreadModelViewDialog } from 'sql/workbench/api/browser/mainThreadModelViewDialog';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { IModelViewButtonDetails, IModelViewTabDetails, IModelViewDialogDetails, IModelViewWizardPageDetails, IModelViewWizardDetails, DialogMessage, MessageLevel } from 'sql/workbench/api/common/sqlExtHostTypes';
import { CustomDialogService } from 'sql/platform/dialog/customDialogService';
@@ -12,7 +12,7 @@ import { URI, UriComponents } from 'vs/base/common/uri';
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
import { ExtHostNotebookShape } from 'sql/workbench/api/node/sqlExtHost.protocol';
import { MainThreadNotebook } from 'sql/workbench/api/node/mainThreadNotebook';
import { MainThreadNotebook } from 'sql/workbench/api/browser/mainThreadNotebook';
import { NotebookService } from 'sql/workbench/services/notebook/common/notebookServiceImpl';
import { INotebookProvider } from 'sql/workbench/services/notebook/common/notebookService';
import { INotebookManagerDetails, INotebookSessionDetails, INotebookKernelDetails, INotebookFutureDetails } from 'sql/workbench/api/common/sqlExtHostTypes';
+2 -1
View File
@@ -9,7 +9,8 @@
"lib": [
"dom",
"es5",
"es2015.iterable"
"es2015.iterable",
"webworker"
]
},
"include": [
+177 -65
View File
@@ -5,84 +5,196 @@
declare module 'vscode-chokidar' {
// TypeScript Version: 3.0
import * as fs from "fs";
import { EventEmitter } from "events";
/**
* takes paths to be watched recursively and options
* The object's keys are all the directories (using absolute paths unless the `cwd` option was
* used), and the values are arrays of the names of the items contained in each directory.
*/
export function watch(paths: string | string[], options: IOptions): FSWatcher;
export interface IOptions {
/**
* (regexp or function) files to be ignored. This function or regexp is tested against the whole path, not just filename.
* If it is a function with two arguments, it gets called twice per path - once with a single argument (the path), second time with two arguments (the path and the fs.Stats object of that path).
*/
ignored?: any;
/**
* (default: false). Indicates whether the process should continue to run as long as files are being watched.
*/
persistent?: boolean;
/**
* (default: false). Indicates whether to watch files that don't have read permissions.
*/
ignorePermissionErrors?: boolean;
/**
* (default: false). Indicates whether chokidar should ignore the initial add events or not.
*/
ignoreInitial?: boolean;
/**
* (default: 100). Interval of file system polling.
*/
interval?: number;
/**
* (default: 300). Interval of file system polling for binary files (see extensions in src/is-binary).
*/
binaryInterval?: number;
/**
* (default: false on Windows, true on Linux and OS X). Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU utilization, consider setting this to false.
*/
usePolling?: boolean;
/**
* (default: true on OS X). Whether to use the fsevents watching interface if available. When set to true explicitly and fsevents is available this supercedes the usePolling setting. When set to false on OS X, usePolling: true becomes the default.
*/
useFsEvents?: boolean;
/**
* (default: true). When false, only the symlinks themselves will be watched for changes instead of following the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* (default: false). If set to true then the strings passed to .watch() and .add() are treated as literal path names, even if they look like globs.
*/
disableGlobbing?: boolean;
export interface WatchedPaths {
[directory: string]: string[];
}
export interface FSWatcher {
export class FSWatcher extends EventEmitter implements fs.FSWatcher {
add(fileDirOrGlob: string): void;
add(filesDirsOrGlobs: Array<string>): void;
unwatch(fileDirOrGlob: string): void;
unwatch(filesDirsOrGlobs: Array<string>): void;
readonly options?: WatchOptions;
/**
* Listen for an FS event. Available events: add, addDir, change, unlink, unlinkDir, error. Additionally all is available which gets emitted for every non-error event.
* Constructs a new FSWatcher instance with optional WatchOptions parameter.
*/
on(event: string, clb: (type: string, path: string) => void): void;
on(event: string, clb: (error: Error) => void): void;
constructor(options?: WatchOptions);
/**
* Add files, directories, or glob patterns for tracking. Takes an array of strings or just one
* string.
*/
add(paths: string | string[]): void;
/**
* Stop watching files, directories, or glob patterns. Takes an array of strings or just one
* string.
*/
unwatch(paths: string | string[]): void;
/**
* Returns an object representing all the paths on the file system being watched by this
* `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless
* the `cwd` option was used), and the values are arrays of the names of the items contained in
* each directory.
*/
getWatched(): WatchedPaths;
/**
* Removes all listeners from watched files.
*/
close(): void;
options: IOptions;
on(event: 'add' | 'addDir' | 'change', listener: (path: string, stats?: fs.Stats) => void): this;
on(event: 'all', listener: (eventName: 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir', path: string, stats?: fs.Stats) => void): this;
/**
* Error occured
*/
on(event: 'error', listener: (error: Error) => void): this;
/**
* Exposes the native Node `fs.FSWatcher events`
*/
on(event: 'raw', listener: (eventName: string, path: string, details: any) => void): this;
/**
* Fires when the initial scan is complete
*/
on(event: 'ready', listener: () => void): this;
on(event: 'unlink' | 'unlinkDir', listener: (path: string) => void): this;
on(event: string, listener: (...args: any[]) => void): this;
}
export interface WatchOptions {
/**
* Indicates whether the process should continue to run as long as files are being watched. If
* set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`,
* even if the process continues to run.
*/
persistent?: boolean;
/**
* ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to
* be ignored. The whole relative or absolute path is tested, not just filename. If a function
* with two arguments is provided, it gets called twice per path - once with a single argument
* (the path), second time with two arguments (the path and the
* [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path).
*/
ignored?: any;
/**
* If set to `false` then `add`/`addDir` events are also emitted for matching paths while
* instantiating the watching as chokidar discovers these file paths (before the `ready` event).
*/
ignoreInitial?: boolean;
/**
* When `false`, only the symlinks themselves will be watched for changes instead of following
* the link references and bubbling events through the link's path.
*/
followSymlinks?: boolean;
/**
* The base directory from which watch `paths` are to be derived. Paths emitted with events will
* be relative to this.
*/
cwd?: string;
/**
* If set to true then the strings passed to .watch() and .add() are treated as literal path
* names, even if they look like globs. Default: false.
*/
disableGlobbing?: boolean;
/**
* Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU
* utilization, consider setting this to `false`. It is typically necessary to **set this to
* `true` to successfully watch files over a network**, and it may be necessary to successfully
* watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides
* the `useFsEvents` default.
*/
usePolling?: boolean;
/**
* Whether to use the `fsevents` watching interface if available. When set to `true` explicitly
* and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on
* OS X, `usePolling: true` becomes the default.
*/
useFsEvents?: boolean;
/**
* If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that
* may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is
* provided even in cases where it wasn't already available from the underlying watch events.
*/
alwaysStat?: boolean;
/**
* If set, limits how many levels of subdirectories will be traversed.
*/
depth?: number;
/**
* Interval of file system polling.
*/
interval?: number;
/**
* Interval of file system polling for binary files. ([see list of binary extensions](https://gi
* thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json))
*/
binaryInterval?: number;
/**
* Indicates whether to watch files that don't have read permissions if possible. If watching
* fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed
* silently.
*/
ignorePermissionErrors?: boolean;
/**
* `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts
* that occur when using editors that use "atomic writes" instead of writing directly to the
* source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change`
* event rather than `unlink` then `add`. If the default of 100 ms does not work well for you,
* you can override it by setting `atomic` to a custom value, in milliseconds.
*/
atomic?: boolean | number;
/**
* can be set to an object in order to adjust timing params:
*/
awaitWriteFinish?: AwaitWriteFinishOptions | boolean;
}
export interface AwaitWriteFinishOptions {
/**
* Amount of time in milliseconds for a file size to remain constant before emitting its event.
*/
stabilityThreshold?: number;
/**
* File size polling interval.
*/
pollInterval?: number;
}
/**
* produces an instance of `FSWatcher`.
*/
export function watch(
paths: string | string[],
options?: WatchOptions
): FSWatcher;
}
+816 -293
View File
File diff suppressed because it is too large Load Diff
-19
View File
@@ -1,19 +0,0 @@
declare module 'gc-signals' {
export interface GCSignal {
}
/**
* Create a new GC signal. When being garbage collected the passed
* value is stored for later consumption.
*/
export const GCSignal: {
new(id: number): GCSignal;
};
/**
* Consume ids of garbage collected signals.
*/
export function consumeSignals(): number[];
export function onDidGarbageCollectSignals(callback: (ids: number[]) => any): {
dispose(): void;
};
export function trackGarbageCollection(obj: any, id: number): number;
}
+2
View File
@@ -4,6 +4,8 @@
*--------------------------------------------------------------------------------------------*/
interface ArrayConstructor {
isArray<T>(arg: ReadonlyArray<T> | null | undefined): arg is ReadonlyArray<T>;
isArray<T>(arg: Array<T> | null | undefined): arg is Array<T>;
isArray(arg: any): arg is Array<any>;
isArray<T>(arg: any): arg is Array<T>;
}
+2 -1
View File
@@ -3,7 +3,7 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'vscode-nsfw' {
declare module 'nsfw' {
interface NsfwWatcher {
start(): any;
stop(): any;
@@ -22,6 +22,7 @@ declare module 'vscode-nsfw' {
directory: string;
file?: string;
newFile?: string;
newDirectory?: string;
oldFile?: string;
}
+33
View File
@@ -0,0 +1,33 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module "onigasm-umd" {
function loadWASM(data: string | ArrayBuffer): Promise<void>;
class OnigString {
constructor(content: string);
readonly content: string;
readonly dispose?: () => void;
}
class OnigScanner {
constructor(patterns: string[]);
findNextMatchSync(string: string | OnigString, startPosition: number): IOnigMatch;
}
export interface IOnigCaptureIndex {
index: number
start: number
end: number
length: number
}
export interface IOnigMatch {
index: number
captureIndices: IOnigCaptureIndex[]
scanner: OnigScanner
}
}
+6 -1
View File
@@ -17,7 +17,12 @@ declare const enum LoaderEventType {
NodeEndEvaluatingScript = 32,
NodeBeginNativeRequire = 33,
NodeEndNativeRequire = 34
NodeEndNativeRequire = 34,
CachedDataFound = 60,
CachedDataMissed = 61,
CachedDataRejected = 62,
CachedDataCreated = 63,
}
declare class LoaderEvent {
+7 -1
View File
@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
// Type definitions for sqlite3 3.1
// Project: https://github.com/mapbox/node-sqlite3
// Project: http://github.com/mapbox/node-sqlite3
// Definitions by: Nick Malaguti <https://github.com/nmalaguti>
// Sumant Manne <https://github.com/dpyro>
// Behind The Math <https://github.com/BehindTheMath>
@@ -18,6 +18,9 @@ declare module 'vscode-sqlite3' {
export const OPEN_READONLY: number;
export const OPEN_READWRITE: number;
export const OPEN_CREATE: number;
export const OPEN_SHAREDCACHE: number;
export const OPEN_PRIVATECACHE: number;
export const OPEN_URI: number;
export const cached: {
Database(filename: string, callback?: (this: Database, err: Error | null) => void): Database;
@@ -100,6 +103,9 @@ declare module 'vscode-sqlite3' {
OPEN_READONLY: number;
OPEN_READWRITE: number;
OPEN_CREATE: number;
OPEN_SHAREDCACHE: number;
OPEN_PRIVATECACHE: number;
OPEN_URI: number;
cached: typeof cached;
RunResult: RunResult;
Statement: typeof Statement;
+3 -3
View File
@@ -30,7 +30,7 @@ declare module "vscode-textmate" {
*/
export interface RegistryOptions {
theme?: IRawTheme;
loadGrammar(scopeName: string): Thenable<IRawGrammar | null> | null;
loadGrammar(scopeName: string): Thenable<IRawGrammar | undefined | null>;
getInjections?(scopeName: string): string[];
getOnigLib?(): Thenable<IOnigLib>;
}
@@ -85,7 +85,7 @@ declare module "vscode-textmate" {
* Load the grammar for `scopeName` and all referenced included grammars asynchronously.
*/
loadGrammar(initialScopeName: string): Thenable<IGrammar>;
private _loadGrammar(initialScopeName, initialLanguage, embeddedLanguages, tokenTypes);
private _loadGrammar;
/**
* Adds a rawGrammar.
*/
@@ -182,7 +182,7 @@ declare module "vscode-textmate" {
equals(other: StackElement): boolean;
}
export const INITIAL: StackElement;
export const parseRawGrammar: (content: string, filePath: string) => IRawGrammar;
export const parseRawGrammar: (content: string, filePath?: string) => IRawGrammar;
export interface ILocation {
readonly filename: string;
readonly line: number;
@@ -3,6 +3,4 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.monaco-editor .code-inset {
z-index: 10;
}
declare module 'vscode-windows-ca-certs';
@@ -3,6 +3,8 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
.update-activity {
-webkit-mask: url('update.svg') no-repeat 50% 50%;
declare module 'vsda' {
export class signer {
sign(arg: any): any;
}
}
+69
View File
@@ -0,0 +1,69 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
// HACK: gulp-tsb doesn't play nice with importing from typings
// import { Terminal, ITerminalAddon } from 'xterm';
declare module 'xterm-addon-search' {
/**
* Options for a search.
*/
export interface ISearchOptions {
/**
* Whether the search term is a regex.
*/
regex?: boolean;
/**
* Whether to search for a whole word, the result is only valid if it's
* suppounded in "non-word" characters such as `_`, `(`, `)` or space.
*/
wholeWord?: boolean;
/**
* Whether the search is case sensitive.
*/
caseSensitive?: boolean;
/**
* Whether to do an indcremental search, this will expand the selection if it
* still matches the term the user typed. Note that this only affects
* `findNext`, not `findPrevious`.
*/
incremental?: boolean;
}
/**
* An xterm.js addon that provides search functionality.
*/
export class SearchAddon {
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
public activate(terminal: any): void;
/**
* Disposes the addon.
*/
public dispose(): void;
/**
* Search forwards for the next result that matches the search term and
* options.
* @param term The search term.
* @param searchOptions The options for the search.
*/
public findNext(term: string, searchOptions?: ISearchOptions): boolean;
/**
* Search backwards for the previous result that matches the search term and
* options.
* @param term The search term.
* @param searchOptions The options for the search.
*/
public findPrevious(term: string, searchOptions?: ISearchOptions): boolean;
}
}
+71
View File
@@ -0,0 +1,71 @@
/**
* Copyright (c) 2017 The xterm.js authors. All rights reserved.
* @license MIT
*/
// HACK: gulp-tsb doesn't play nice with importing from typings
// import { Terminal, ITerminalAddon } from 'xterm';
interface ILinkMatcherOptions {
/**
* The index of the link from the regex.match(text) call. This defaults to 0
* (for regular expressions without capture groups).
*/
matchIndex?: number;
/**
* A callback that validates whether to create an individual link, pass
* whether the link is valid to the callback.
*/
validationCallback?: (uri: string, callback: (isValid: boolean) => void) => void;
/**
* A callback that fires when the mouse hovers over a link for a moment.
*/
tooltipCallback?: (event: MouseEvent, uri: string) => boolean | void;
/**
* A callback that fires when the mouse leaves a link. Note that this can
* happen even when tooltipCallback hasn't fired for the link yet.
*/
leaveCallback?: () => void;
/**
* The priority of the link matcher, this defines the order in which the link
* matcher is evaluated relative to others, from highest to lowest. The
* default value is 0.
*/
priority?: number;
/**
* A callback that fires when the mousedown and click events occur that
* determines whether a link will be activated upon click. This enables
* only activating a link when a certain modifier is held down, if not the
* mouse event will continue propagation (eg. double click to select word).
*/
willLinkActivate?: (event: MouseEvent, uri: string) => boolean;
}
declare module 'xterm-addon-web-links' {
/**
* An xterm.js addon that enables web links.
*/
export class WebLinksAddon {
/**
* Creates a new web links addon.
* @param handler The callback when the link is called.
* @param options Options for the link matcher.
*/
constructor(handler?: (event: MouseEvent, uri: string) => void, options?: ILinkMatcherOptions);
/**
* Activates the addon
* @param terminal The terminal the addon is being loaded in.
*/
public activate(terminal: any): void;
/**
* Disposes the addon.
*/
public dispose(): void;
}
}

Some files were not shown because too many files have changed in this diff Show More