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

View File

@@ -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';

View File

@@ -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; });
}
}

View File

@@ -3,4 +3,4 @@
* Licensed under the Source EULA. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import 'sql/workbench/api/electron-browser/mainThreadModalDialog';
import '../browser/extensionHost.contribution.common';

View File

@@ -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;
}

View File

@@ -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));

View File

@@ -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
);

View File

@@ -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,

View File

@@ -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);
}
}
}

View File

@@ -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);

View File

@@ -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);

View File

@@ -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

View File

@@ -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
});
}
}

View File

@@ -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 });
}
}
}

View File

@@ -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) {

View File

@@ -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);
}

View File

@@ -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();

View File

@@ -128,7 +128,6 @@ export class ConnectionViewletPanel extends ViewletPanel {
}
dispose(): void {
this.disposables = dispose(this.disposables);
super.dispose();
}

View File

@@ -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);
}
});
});

View File

@@ -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();
}

View File

@@ -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);

View File

@@ -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)}
}`);
});
}
}

View File

@@ -27,7 +27,7 @@ export class NotebookMarkdownRenderer {
const element: HTMLElement = markdown ? this.renderMarkdown(markdown, undefined) : document.createElement('span');
return {
element,
dispose: () => dispose()
dispose: () => { }
};
}

View File

@@ -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 {

View File

@@ -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));
}
});
});

View File

@@ -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);

View File

@@ -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);
}
}

View File

@@ -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();
}
}
}

View File

@@ -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);

View File

@@ -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();
}

View File

@@ -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);
}
}
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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')) {

View File

@@ -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 {

View File

@@ -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);
}

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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;