mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 09:35:37 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -58,7 +58,7 @@ const tabbableElementsQuerySelector = 'a[href], area[href], input:not([disabled]
|
||||
*/
|
||||
export function getFocusableElements(container: HTMLElement): HTMLElement[] {
|
||||
const elements = [];
|
||||
container.querySelectorAll(tabbableElementsQuerySelector).forEach((element: HTMLElement) => {
|
||||
container.querySelectorAll<HTMLElement>(tabbableElementsQuerySelector).forEach((element: HTMLElement) => {
|
||||
const style = window.getComputedStyle(element);
|
||||
// We should only return the elements that are visible. There are many ways to hide an element, for example setting the
|
||||
// visibility attribute to hidden/collapse, setting the display property to none, or if one of its ancestors is invisible.
|
||||
|
||||
@@ -8,7 +8,7 @@ import { IAction, IActionRunner } from 'vs/base/common/actions';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { AnchorAlignment } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { ResolvedKeybinding } from 'vs/base/common/keyCodes';
|
||||
import { append, $, addClasses } from 'vs/base/browser/dom';
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
import { IDropdownMenuOptions, DropdownMenu, IActionProvider, ILabelRenderer } from 'vs/base/browser/ui/dropdown/dropdown';
|
||||
import { IContextMenuProvider } from 'vs/base/browser/contextmenu';
|
||||
import { BaseActionViewItem } from 'vs/base/browser/ui/actionbar/actionViewItems';
|
||||
@@ -51,7 +51,7 @@ export class DropdownMenuActionViewItem extends BaseActionViewItem {
|
||||
const labelRenderer: ILabelRenderer = (el: HTMLElement): IDisposable | null => {
|
||||
this.element = append(el, $('a.action-label.button-menu'));
|
||||
if (this.cssClass) {
|
||||
addClasses(this.element, this.cssClass);
|
||||
this.element.classList.add(...this.cssClass.split(' '));
|
||||
}
|
||||
if (this.menuLabel) {
|
||||
this.element.innerText = this.menuLabel;
|
||||
|
||||
@@ -164,7 +164,7 @@ export class ScrollableView extends Disposable {
|
||||
for (const item of this.items) {
|
||||
if (item.domNode) {
|
||||
DOM.clearNode(item.domNode);
|
||||
DOM.removeNode(item.domNode);
|
||||
item.domNode.remove();
|
||||
item.domNode = undefined;
|
||||
}
|
||||
dispose(item.disposables);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { ITableRenderer } from 'sql/base/browser/ui/table/highPerf/table';
|
||||
|
||||
import { $, removeClass } from 'vs/base/browser/dom';
|
||||
import { $ } from 'vs/base/browser/dom';
|
||||
export interface ICell {
|
||||
domNode: HTMLElement | null;
|
||||
templateData: any;
|
||||
@@ -64,7 +64,7 @@ export class CellCache<T> implements IDisposable {
|
||||
release(cell: ICell) {
|
||||
const { domNode, templateId } = cell;
|
||||
if (domNode) {
|
||||
removeClass(domNode, 'scrolling');
|
||||
domNode.classList.remove('scrolling');
|
||||
removeFromParent(domNode);
|
||||
}
|
||||
|
||||
|
||||
@@ -176,7 +176,7 @@ export class TableView<T> implements IDisposable {
|
||||
this.domNode.classList.add(this.domId);
|
||||
this.domNode.tabIndex = 0;
|
||||
|
||||
DOM.toggleClass(this.domNode, 'mouse-support', typeof options.mouseSupport === 'boolean' ? options.mouseSupport : true);
|
||||
this.domNode.classList.toggle('mouse-support', typeof options.mouseSupport === 'boolean' ? options.mouseSupport : true);
|
||||
|
||||
// this.ariaSetProvider = { getSetSize: (e, i, length) => length, getPosInSet: (_, index) => index + 1 };
|
||||
|
||||
|
||||
@@ -157,7 +157,7 @@ class Trait<T> implements IDisposable {
|
||||
constructor(private _trait: string) { }
|
||||
|
||||
renderIndex(index: GridPosition, container: HTMLElement): void {
|
||||
DOM.toggleClass(container, this._trait, this.contains(index));
|
||||
container.classList.toggle(this._trait, this.contains(index));
|
||||
}
|
||||
|
||||
unrender(container: HTMLElement): void {
|
||||
@@ -1035,15 +1035,15 @@ export class Table<T> implements IDisposable {
|
||||
}
|
||||
|
||||
this.view.domNode.setAttribute('role', 'tree');
|
||||
DOM.toggleClass(this.view.domNode, 'element-focused', focus.length > 0);
|
||||
this.view.domNode.classList.toggle('element-focused', focus.length > 0);
|
||||
}
|
||||
|
||||
private _onSelectionChange(): void {
|
||||
const selection = this.selection.get();
|
||||
|
||||
DOM.toggleClass(this.view.domNode, 'selection-none', selection.length === 0);
|
||||
DOM.toggleClass(this.view.domNode, 'selection-single', selection.length === 1);
|
||||
DOM.toggleClass(this.view.domNode, 'selection-multiple', selection.length > 1);
|
||||
this.view.domNode.classList.toggle('selection-none', selection.length === 0);
|
||||
this.view.domNode.classList.toggle('selection-single', selection.length === 1);
|
||||
this.view.domNode.classList.toggle('selection-multiple', selection.length > 1);
|
||||
}
|
||||
|
||||
dispose(): void {
|
||||
|
||||
@@ -9,7 +9,7 @@ import { FilterableColumn } from 'sql/base/browser/ui/table/interfaces';
|
||||
import { addDisposableListener, EventType, EventHelper, $, isAncestor, clearNode, append } from 'vs/base/browser/dom';
|
||||
import { DisposableStore, dispose, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { withNullAsUndefined } from 'vs/base/common/types';
|
||||
import { instanceOfIDisposableDataProvider } from 'sql/base/common/dataProvider';
|
||||
import { IDisposableDataProvider, instanceOfIDisposableDataProvider } from 'sql/base/common/dataProvider';
|
||||
import { IContextViewProvider } from 'vs/base/browser/ui/contextview/contextview';
|
||||
import { IInputBoxStyles, InputBox } from 'sql/base/browser/ui/inputBox/inputBox';
|
||||
import { trapKeyboardNavigation } from 'sql/base/browser/dom';
|
||||
@@ -242,7 +242,7 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
||||
let filterItems: Array<string>;
|
||||
const dataView = this.grid.getData() as Slick.DataProvider<T>;
|
||||
if (instanceOfIDisposableDataProvider(dataView)) {
|
||||
filterItems = await dataView.getColumnValues(this.columnDef);
|
||||
filterItems = await (dataView as IDisposableDataProvider<T>).getColumnValues(this.columnDef);
|
||||
} else {
|
||||
const filterApplied = this.grid.getColumns().findIndex((col) => {
|
||||
const filterableColumn = col as FilterableColumn<T>;
|
||||
@@ -467,7 +467,7 @@ export class HeaderFilter<T extends Slick.SlickData> {
|
||||
this.hideMenu();
|
||||
const dataView = this.grid.getData();
|
||||
if (instanceOfIDisposableDataProvider(dataView)) {
|
||||
await dataView.filter(this.grid.getColumns());
|
||||
await (dataView as IDisposableDataProvider<T>).filter(this.grid.getColumns());
|
||||
this.grid.invalidateAllRows();
|
||||
this.grid.updateRowCount();
|
||||
this.grid.render();
|
||||
|
||||
@@ -89,7 +89,7 @@ export class ConnectionConfig {
|
||||
public addConnection(profile: IConnectionProfile, matcher: ProfileMatcher = ConnectionProfile.matchesProfile): Promise<IConnectionProfile> {
|
||||
if (profile.saveProfile) {
|
||||
return this.addGroupFromProfile(profile).then(groupId => {
|
||||
let profiles = deepClone(this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue);
|
||||
let profiles = deepClone(this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue as IConnectionProfileStore[]);
|
||||
if (!profiles) {
|
||||
profiles = [];
|
||||
}
|
||||
@@ -134,7 +134,7 @@ export class ConnectionConfig {
|
||||
if (profile.groupId && profile.groupId !== Utils.defaultGroupId) {
|
||||
return Promise.resolve(profile.groupId);
|
||||
} else {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue as IConnectionProfileGroup[]);
|
||||
let result = this.saveGroup(groups!, profile.groupFullName, undefined, undefined);
|
||||
groups = result.groups;
|
||||
|
||||
@@ -149,7 +149,7 @@ export class ConnectionConfig {
|
||||
if (profileGroup.id) {
|
||||
return Promise.resolve(profileGroup.id);
|
||||
} else {
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue);
|
||||
let groups = deepClone(this.configurationService.inspect<IConnectionProfileGroup[]>(GROUPS_CONFIG_KEY).userValue as IConnectionProfileGroup[]);
|
||||
let sameNameGroup = groups ? groups.find(group => group.name === profileGroup.name) : undefined;
|
||||
if (sameNameGroup) {
|
||||
let errMessage: string = nls.localize('invalidServerName', "A server group with the same name already exists.");
|
||||
@@ -169,9 +169,9 @@ export class ConnectionConfig {
|
||||
if (configs) {
|
||||
let fromConfig: IConnectionProfileStore[] | undefined;
|
||||
if (configTarget === ConfigurationTarget.USER) {
|
||||
fromConfig = configs.userValue;
|
||||
fromConfig = configs.userValue as IConnectionProfileStore[];
|
||||
} else if (configTarget === ConfigurationTarget.WORKSPACE) {
|
||||
fromConfig = configs.workspaceValue || [];
|
||||
fromConfig = configs.workspaceValue as IConnectionProfileStore[] || [];
|
||||
}
|
||||
if (fromConfig) {
|
||||
profiles = deepClone(fromConfig);
|
||||
@@ -340,8 +340,8 @@ export class ConnectionConfig {
|
||||
* Moves the connection under the target group with the new ID.
|
||||
*/
|
||||
private changeGroupIdForConnectionInSettings(profile: ConnectionProfile, newGroupID: string, target: ConfigurationTarget = ConfigurationTarget.USER): Promise<void> {
|
||||
let profiles = deepClone(target === ConfigurationTarget.USER ? this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue :
|
||||
this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).workspaceValue);
|
||||
let profiles = deepClone(target === ConfigurationTarget.USER ? this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).userValue as IConnectionProfileStore[] :
|
||||
this.configurationService.inspect<IConnectionProfileStore[]>(CONNECTIONS_CONFIG_KEY).workspaceValue as IConnectionProfileStore[]);
|
||||
if (profiles) {
|
||||
if (profile.parent && profile.parent.id === UNSAVED_GROUP_ID) {
|
||||
profile.groupId = newGroupID;
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
import { ConnectionProfile } from 'sql/platform/connection/common/connectionProfile';
|
||||
import { Disposable } from 'vs/base/common/lifecycle';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
export interface INewConnectionProfileGroup {
|
||||
id?: string;
|
||||
@@ -56,7 +55,7 @@ export class ConnectionProfileGroup extends Disposable implements IConnectionPro
|
||||
});
|
||||
}
|
||||
|
||||
return assign({}, { name: this.name, id: this.id, parentId: this.parentId, children: subgroups, color: this.color, description: this.description });
|
||||
return Object.assign({}, { name: this.name, id: this.id, parentId: this.parentId, children: subgroups, color: this.color, description: this.description });
|
||||
}
|
||||
|
||||
public get groupName(): string {
|
||||
|
||||
@@ -14,7 +14,6 @@ import { join } from 'vs/base/common/path';
|
||||
import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import * as azdata from 'azdata';
|
||||
import { INotificationService, Severity } from 'vs/platform/notification/common/notification';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
|
||||
export class ConnectionStatusManager {
|
||||
@@ -193,7 +192,7 @@ export class ConnectionStatusManager {
|
||||
}
|
||||
|
||||
private isSharedSession(fileUri: string): boolean {
|
||||
return !!(fileUri && startsWith(fileUri, 'vsls:'));
|
||||
return !!(fileUri && fileUri.startsWith('vsls:'));
|
||||
}
|
||||
|
||||
public isConnected(id: string): boolean {
|
||||
@@ -208,7 +207,7 @@ export class ConnectionStatusManager {
|
||||
}
|
||||
|
||||
public isDefaultTypeUri(uri: string): boolean {
|
||||
return !!(uri && startsWith(uri, Utils.uriPrefixes.default));
|
||||
return !!(uri && uri.startsWith(Utils.uriPrefixes.default));
|
||||
}
|
||||
|
||||
public getProviderIdFromUri(ownerUri: string): string {
|
||||
|
||||
@@ -9,7 +9,6 @@ import { isString } from 'vs/base/common/types';
|
||||
import * as azdata from 'azdata';
|
||||
import * as Constants from 'sql/platform/connection/common/constants';
|
||||
import { ICapabilitiesService, ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
type SettableProperty = 'serverName' | 'authenticationType' | 'databaseName' | 'password' | 'connectionName' | 'userName';
|
||||
@@ -95,7 +94,7 @@ export class ProviderConnectionInfo extends Disposable implements azdata.Connect
|
||||
|
||||
public clone(): ProviderConnectionInfo {
|
||||
let instance = new ProviderConnectionInfo(this.capabilitiesService, this.providerName);
|
||||
instance.options = assign({}, this.options);
|
||||
instance.options = Object.assign({}, this.options);
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,6 @@ import * as assert from 'assert';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
suite('SQL ConnectionProfileInfo tests', () => {
|
||||
let msSQLCapabilities: ConnectionProviderProperties;
|
||||
@@ -187,7 +186,7 @@ suite('SQL ConnectionProfileInfo tests', () => {
|
||||
});
|
||||
|
||||
test('createFromStoredProfile should set the id to new guid if not set in stored profile', () => {
|
||||
let savedProfile: IConnectionProfileStore = assign({}, storedProfile, { id: undefined });
|
||||
let savedProfile: IConnectionProfileStore = Object.assign({}, storedProfile, { id: undefined });
|
||||
let connectionProfile = ConnectionProfile.createFromStoredProfile(savedProfile, capabilitiesService);
|
||||
assert.equal(savedProfile.groupId, connectionProfile.groupId);
|
||||
assert.deepEqual(savedProfile.providerName, connectionProfile.providerName);
|
||||
|
||||
@@ -13,7 +13,7 @@ import { IConnectionProfile, ConnectionOptionSpecialType, ServiceOptionType } fr
|
||||
import { TestConfigurationService } from 'sql/platform/connection/test/common/testConfigurationService';
|
||||
import { TestCredentialsService } from 'sql/platform/credentials/test/common/testCredentialsService';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { deepClone, deepFreeze, assign } from 'vs/base/common/objects';
|
||||
import { deepClone, deepFreeze } from 'vs/base/common/objects';
|
||||
import { ConfigurationTarget } from 'vs/platform/configuration/common/configuration';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
@@ -154,7 +154,7 @@ suite('ConnectionStore', () => {
|
||||
const connectionStore = new ConnectionStore(storageService, configurationService,
|
||||
credentialsService, capabilitiesService);
|
||||
for (let i = 0; i < numCreds; i++) {
|
||||
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||
await connectionStore.addRecentConnection(connectionProfile);
|
||||
const current = connectionStore.getRecentlyUsedConnections();
|
||||
@@ -190,7 +190,7 @@ suite('ConnectionStore', () => {
|
||||
// Then expect the only 1 instance of that connection to be listed in the MRU
|
||||
const connectionStore = new ConnectionStore(storageService, configurationService,
|
||||
credentialsService, capabilitiesService);
|
||||
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + 1 });
|
||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + 1 });
|
||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||
await connectionStore.addRecentConnection(defaultNamedConnectionProfile);
|
||||
await connectionStore.addRecentConnection(connectionProfile);
|
||||
@@ -212,13 +212,13 @@ suite('ConnectionStore', () => {
|
||||
// Given we save 1 connection with password and multiple other connections without
|
||||
const connectionStore = new ConnectionStore(storageService, configurationService,
|
||||
credentialsService, capabilitiesService);
|
||||
const integratedCred = assign({}, defaultNamedProfile, {
|
||||
const integratedCred = Object.assign({}, defaultNamedProfile, {
|
||||
serverName: defaultNamedProfile.serverName + 'Integrated',
|
||||
authenticationType: 'Integrated',
|
||||
userName: '',
|
||||
password: ''
|
||||
});
|
||||
const noPwdCred = assign({}, defaultNamedProfile, {
|
||||
const noPwdCred = Object.assign({}, defaultNamedProfile, {
|
||||
serverName: defaultNamedProfile.serverName + 'NoPwd',
|
||||
password: ''
|
||||
});
|
||||
@@ -322,7 +322,7 @@ suite('ConnectionStore', () => {
|
||||
|
||||
const connectionStore = new ConnectionStore(storageService, configurationService,
|
||||
credentialsService, capabilitiesService);
|
||||
const connectionProfile: IConnectionProfile = assign({}, defaultNamedProfile, { providerName: providerName });
|
||||
const connectionProfile: IConnectionProfile = Object.assign({}, defaultNamedProfile, { providerName: providerName });
|
||||
|
||||
assert.ok(!connectionStore.isPasswordRequired(connectionProfile));
|
||||
});
|
||||
@@ -333,7 +333,7 @@ suite('ConnectionStore', () => {
|
||||
const credentialsService = new TestCredentialsService();
|
||||
|
||||
const password: string = 'asdf!@#$';
|
||||
const connectionProfile: IConnectionProfile = assign({}, defaultNamedProfile, { password });
|
||||
const connectionProfile: IConnectionProfile = Object.assign({}, defaultNamedProfile, { password });
|
||||
|
||||
const connectionStore = new ConnectionStore(storageService, configurationService,
|
||||
credentialsService, capabilitiesService);
|
||||
@@ -403,7 +403,7 @@ suite('ConnectionStore', () => {
|
||||
const profile = deepClone(defaultNamedProfile);
|
||||
profile.options['password'] = profile.password;
|
||||
profile.id = 'testId';
|
||||
let expectedProfile = assign({}, profile);
|
||||
let expectedProfile = Object.assign({}, profile);
|
||||
expectedProfile.password = '';
|
||||
expectedProfile.options['password'] = '';
|
||||
expectedProfile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, expectedProfile).toIConnectionProfile();
|
||||
@@ -416,7 +416,7 @@ suite('ConnectionStore', () => {
|
||||
const configurationService = new TestConfigurationService();
|
||||
const credentialsService = new TestCredentialsService();
|
||||
|
||||
const profile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, assign({}, defaultNamedProfile, { password: undefined }));
|
||||
const profile = ConnectionProfile.fromIConnectionProfile(capabilitiesService, Object.assign({}, defaultNamedProfile, { password: undefined }));
|
||||
|
||||
const credId = `Microsoft.SqlTools|itemtype:Profile|id:${profile.getConnectionInfoId()}`;
|
||||
const password: string = 'asdf!@#$';
|
||||
@@ -477,7 +477,7 @@ suite('ConnectionStore', () => {
|
||||
credentialsService, capabilitiesService);
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||
await connectionStore.addRecentConnection(connectionProfile);
|
||||
const current = connectionStore.getRecentlyUsedConnections();
|
||||
@@ -485,7 +485,7 @@ suite('ConnectionStore', () => {
|
||||
}
|
||||
|
||||
for (let i = 0; i < 5; i++) {
|
||||
const cred = assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const cred = Object.assign({}, defaultNamedProfile, { serverName: defaultNamedProfile.serverName + i });
|
||||
const connectionProfile = new ConnectionProfile(capabilitiesService, cred);
|
||||
connectionStore.removeRecentConnection(connectionProfile);
|
||||
const current = connectionStore.getRecentlyUsedConnections();
|
||||
|
||||
@@ -9,7 +9,6 @@ import * as azdata from 'azdata';
|
||||
import * as assert from 'assert';
|
||||
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
suite('SQL ProviderConnectionInfo tests', () => {
|
||||
let msSQLCapabilities: any;
|
||||
@@ -202,7 +201,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
||||
test('constructor should initialize the options given a valid model with options', () => {
|
||||
let options: { [key: string]: string } = {};
|
||||
options['encrypt'] = 'test value';
|
||||
let conn2 = assign({}, connectionProfile, { options: options });
|
||||
let conn2 = Object.assign({}, connectionProfile, { options: options });
|
||||
let conn = new ProviderConnectionInfo(capabilitiesService, conn2);
|
||||
|
||||
assert.equal(conn.connectionName, conn2.connectionName);
|
||||
@@ -223,7 +222,7 @@ suite('SQL ProviderConnectionInfo tests', () => {
|
||||
|
||||
test('getOptionsKey should create different id for different server names', () => {
|
||||
let conn = new ProviderConnectionInfo(capabilitiesService, connectionProfile);
|
||||
let conn2 = new ProviderConnectionInfo(capabilitiesService, assign({}, connectionProfile, { serverName: connectionProfile.serverName + '1' }));
|
||||
let conn2 = new ProviderConnectionInfo(capabilitiesService, Object.assign({}, connectionProfile, { serverName: connectionProfile.serverName + '1' }));
|
||||
|
||||
assert.notEqual(conn.getOptionsKey(), conn2.getOptionsKey());
|
||||
});
|
||||
|
||||
@@ -15,7 +15,6 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { NativeEnvironmentService } from 'vs/platform/environment/node/environmentService';
|
||||
import { parseArgs, OPTIONS } from 'vs/platform/environment/node/argv';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import product from 'vs/platform/product/common/product';
|
||||
|
||||
let connections: ConnectionStatusManager;
|
||||
@@ -171,7 +170,7 @@ suite('SQL ConnectionStatusManager tests', () => {
|
||||
let expectedConnectionId = 'new id';
|
||||
connections.addConnection(connectionProfile, connection1Id);
|
||||
|
||||
let updatedConnection = assign({}, connectionProfile, { groupId: expected, getOptionsKey: () => connectionProfile.getOptionsKey() + expected, id: expectedConnectionId });
|
||||
let updatedConnection = Object.assign({}, connectionProfile, { groupId: expected, getOptionsKey: () => connectionProfile.getOptionsKey() + expected, id: expectedConnectionId });
|
||||
let actualId = connections.updateConnectionProfile(updatedConnection, connection1Id);
|
||||
|
||||
let newId = Utils.generateUri(updatedConnection);
|
||||
@@ -246,7 +245,7 @@ suite('SQL ConnectionStatusManager tests', () => {
|
||||
|
||||
test('getActiveConnectionProfiles should return a list of all the unique connections that the status manager knows about', () => {
|
||||
// Add duplicate connections
|
||||
let newConnection = assign({}, connectionProfile);
|
||||
let newConnection = Object.assign({}, connectionProfile);
|
||||
newConnection.id = 'test_id';
|
||||
newConnection.serverName = 'new_server_name';
|
||||
newConnection.options['databaseDisplayName'] = newConnection.databaseName;
|
||||
|
||||
@@ -7,7 +7,6 @@ import * as azdata from 'azdata';
|
||||
import { IAdsTelemetryService, ITelemetryInfo, ITelemetryEvent, ITelemetryEventMeasures, ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { EventName } from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
|
||||
|
||||
@@ -36,17 +35,17 @@ class TelemetryEventImpl implements ITelemetryEvent {
|
||||
}
|
||||
|
||||
public withAdditionalProperties(additionalProperties: ITelemetryEventProperties): ITelemetryEvent {
|
||||
assign(this._properties, additionalProperties);
|
||||
Object.assign(this._properties, additionalProperties);
|
||||
return this;
|
||||
}
|
||||
|
||||
public withAdditionalMeasurements(additionalMeasurements: ITelemetryEventMeasures): ITelemetryEvent {
|
||||
assign(this._measurements, additionalMeasurements);
|
||||
Object.assign(this._measurements, additionalMeasurements);
|
||||
return this;
|
||||
}
|
||||
|
||||
public withConnectionInfo(connectionInfo?: azdata.IConnectionProfile): ITelemetryEvent {
|
||||
assign(this._properties,
|
||||
Object.assign(this._properties,
|
||||
{
|
||||
authenticationType: connectionInfo?.authenticationType,
|
||||
provider: connectionInfo?.providerName
|
||||
@@ -55,7 +54,7 @@ class TelemetryEventImpl implements ITelemetryEvent {
|
||||
}
|
||||
|
||||
public withServerInfo(serverInfo?: azdata.ServerInfo): ITelemetryEvent {
|
||||
assign(this._properties,
|
||||
Object.assign(this._properties,
|
||||
{
|
||||
connectionType: serverInfo?.isCloud !== undefined ? (serverInfo.isCloud ? 'Azure' : 'Standalone') : '',
|
||||
serverVersion: serverInfo?.serverVersion ?? '',
|
||||
|
||||
@@ -25,7 +25,6 @@ import { ISerializationService } from 'sql/platform/serialization/common/seriali
|
||||
import { IFileBrowserService } from 'sql/workbench/services/fileBrowser/common/interfaces';
|
||||
import { IExtHostContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { extHostNamedCustomer } from 'vs/workbench/api/common/extHostCustomers';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { serializableToMap } from 'sql/base/common/map';
|
||||
import { IAssessmentService } from 'sql/workbench/services/assessment/common/interfaces';
|
||||
import { IDataGridProviderService } from 'sql/workbench/services/dataGridProvider/common/dataGridProviderService';
|
||||
@@ -570,7 +569,7 @@ export class MainThreadDataProtocol extends Disposable implements MainThreadData
|
||||
}
|
||||
|
||||
public $onObjectExplorerNodeExpanded(providerId: string, expandResponse: azdata.ObjectExplorerExpandInfo): void {
|
||||
let expandInfo: NodeExpandInfoWithProviderId = assign({ providerId: providerId }, expandResponse);
|
||||
let expandInfo: NodeExpandInfoWithProviderId = Object.assign({ providerId: providerId }, expandResponse);
|
||||
this._objectExplorerService.onNodeExpanded(expandInfo);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import { ModelViewInput, ModelViewInputModel, ModeViewSaveHandler } from 'sql/wo
|
||||
|
||||
import * as vscode from 'vscode';
|
||||
import * as azdata from 'azdata';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { TelemetryView, TelemetryAction } from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { IEditorInput, IEditorPane } from 'vs/workbench/common/editor';
|
||||
@@ -92,7 +91,7 @@ export class MainThreadModelViewDialog extends Disposable implements MainThreadM
|
||||
|
||||
public $openDialog(handle: number, dialogName?: string): Thenable<void> {
|
||||
let dialog = this.getDialog(handle);
|
||||
const options = assign({}, DefaultDialogOptions);
|
||||
const options = Object.assign({}, DefaultDialogOptions);
|
||||
options.width = dialog.width;
|
||||
options.dialogStyle = dialog.dialogStyle;
|
||||
options.dialogPosition = dialog.dialogPosition;
|
||||
@@ -247,7 +246,7 @@ export class MainThreadModelViewDialog extends Disposable implements MainThreadM
|
||||
|
||||
public $openWizard(handle: number, source?: string): Thenable<void> {
|
||||
let wizard = this.getWizard(handle);
|
||||
const options = assign({}, DefaultWizardOptions);
|
||||
const options = Object.assign({}, DefaultWizardOptions);
|
||||
options.width = wizard.width;
|
||||
this._dialogService.showWizard(wizard, options, source);
|
||||
return Promise.resolve();
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
import { IMainContext } from 'vs/workbench/api/common/extHost.protocol';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { deepClone, assign } from 'vs/base/common/objects';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
@@ -323,17 +323,17 @@ class ComponentBuilderImpl<T extends azdata.Component, TPropertyBag extends azda
|
||||
|
||||
withProperties<U>(properties: U): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
// Keep any properties that may have been set during initial object construction
|
||||
this._component.properties = assign({}, this._component.properties, properties);
|
||||
this._component.properties = Object.assign({}, this._component.properties, properties);
|
||||
return this;
|
||||
}
|
||||
|
||||
withProps(properties: TPropertyBag): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
this._component.properties = assign({}, this._component.properties, properties);
|
||||
this._component.properties = Object.assign({}, this._component.properties, properties);
|
||||
return this;
|
||||
}
|
||||
|
||||
withValidation(validation: (component: T) => boolean | Thenable<boolean>): azdata.ComponentBuilder<T, TPropertyBag> {
|
||||
this._component.customValidations.push(validation);
|
||||
this._component.customValidations.push(validation as (component: ThisType<ComponentWrapper>) => boolean | Thenable<boolean>); // Use specific type to avoid type assertion error
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -406,7 +406,7 @@ class FormContainerBuilder extends GenericContainerBuilder<azdata.FormContainer,
|
||||
});
|
||||
}
|
||||
|
||||
return new InternalItemConfig(componentWrapper, assign({}, itemLayout || {}, {
|
||||
return new InternalItemConfig(componentWrapper, Object.assign({}, itemLayout || {}, {
|
||||
title: formComponent.title,
|
||||
actions: actions,
|
||||
isFormComponent: true,
|
||||
@@ -794,7 +794,7 @@ class ComponentWrapper implements azdata.Component {
|
||||
}
|
||||
|
||||
public updateProperties(properties: { [key: string]: any }): Thenable<void> {
|
||||
this.properties = assign(this.properties, properties);
|
||||
this.properties = Object.assign(this.properties, properties);
|
||||
return this.notifyPropertyChanged();
|
||||
}
|
||||
|
||||
@@ -803,7 +803,7 @@ class ComponentWrapper implements azdata.Component {
|
||||
}
|
||||
|
||||
public updateCssStyles(cssStyles: { [key: string]: string }): Thenable<void> {
|
||||
this.properties.CSSStyles = assign(this.properties.CSSStyles || {}, cssStyles);
|
||||
this.properties.CSSStyles = Object.assign(this.properties.CSSStyles || {}, cssStyles);
|
||||
return this.notifyPropertyChanged();
|
||||
}
|
||||
|
||||
@@ -1648,7 +1648,7 @@ class DeclarativeTableWrapper extends ComponentWrapper implements azdata.Declara
|
||||
// and so map them into their IDs instead. We don't want to update the actual
|
||||
// data property though since the caller would still expect that to contain
|
||||
// the Component objects they created
|
||||
const properties = assign({}, this.properties);
|
||||
const properties = Object.assign({}, this.properties);
|
||||
const componentsToAdd: ComponentWrapper[] = [];
|
||||
if (properties.data?.length > 0) {
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class ModelViewPanelImpl implements azdata.window.ModelViewPanel {
|
||||
public handle: number;
|
||||
protected _modelViewId: string;
|
||||
protected _valid: boolean = true;
|
||||
protected _onValidityChanged: vscode.Event<boolean>;
|
||||
protected _onValidityChanged: Event<boolean>;
|
||||
|
||||
constructor(private _viewType: string,
|
||||
protected _extHostModelViewDialog: ExtHostModelViewDialog,
|
||||
|
||||
@@ -14,7 +14,6 @@ import * as azdata from 'azdata';
|
||||
import * as vsTreeExt from 'vs/workbench/api/common/extHostTreeViews';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { IExtensionDescription } from 'vs/platform/extensions/common/extensions';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { TreeDataTransferDTO } from 'vs/workbench/api/common/shared/treeDataTransfer';
|
||||
|
||||
@@ -166,7 +165,7 @@ export class ExtHostTreeView<T> extends vsTreeExt.ExtHostTreeView<T> {
|
||||
protected override createTreeNode(element: T, extensionTreeItem: azdata.TreeComponentItem, parent?: vsTreeExt.TreeNode | vsTreeExt.Root): vsTreeExt.TreeNode {
|
||||
let node = super.createTreeNode(element, extensionTreeItem, parent);
|
||||
if (node.item) {
|
||||
node.item = assign(node.item, { checked: extensionTreeItem.checked, enabled: extensionTreeItem.enabled });
|
||||
node.item = Object.assign(node.item, { checked: extensionTreeItem.checked, enabled: extensionTreeItem.enabled });
|
||||
}
|
||||
return node;
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IConnectionManagementService, IConnectableInput, INewConnectionParams } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
@@ -18,6 +18,7 @@ import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/u
|
||||
import { IResolvedTextEditorModel } from 'vs/editor/common/services/resolverService';
|
||||
import { IUntitledTextEditorModel, UntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
|
||||
import { EncodingMode } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
/**
|
||||
* Input for the EditDataEditor.
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
|
||||
@@ -11,7 +11,7 @@ import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { generateUuid } from 'vs/base/common/uuid';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as azdata from 'azdata';
|
||||
import * as nls from 'vs/nls';
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { DataGridProvider, IDataGridProviderService } from 'sql/workbench/services/dataGridProvider/common/dataGridProviderService';
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { SelectBox } from 'sql/base/browser/ui/selectBox/selectBox';
|
||||
import { Button } from 'sql/base/browser/ui/button/button';
|
||||
import { append, $, addClass, addClasses } from 'vs/base/browser/dom';
|
||||
import { append, $ } from 'vs/base/browser/dom';
|
||||
|
||||
import * as types from 'vs/base/common/types';
|
||||
|
||||
@@ -15,9 +15,9 @@ export function appendRow(container: HTMLElement, label: string, labelClass: str
|
||||
let rowContainer = append(container, $('tr'));
|
||||
if (rowContainerClass) {
|
||||
if (types.isString(rowContainerClass)) {
|
||||
addClass(rowContainer, rowContainerClass);
|
||||
rowContainer.classList.add(rowContainerClass);
|
||||
} else {
|
||||
addClasses(rowContainer, ...rowContainerClass);
|
||||
rowContainer.classList.add(...rowContainerClass);
|
||||
}
|
||||
}
|
||||
const labelContainer = append(append(rowContainer, $(`td.${labelClass}`)), $('div.dialog-label-container'));
|
||||
|
||||
@@ -161,7 +161,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
* (hyoshi - 10/2/2017 tracked by https://github.com/Microsoft/carbon/issues/1836)
|
||||
*/
|
||||
public setWide(isWide: boolean): void {
|
||||
DOM.toggleClass(this._bodyContainer!, 'wide', isWide);
|
||||
this._bodyContainer!.classList.toggle('wide', isWide);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -356,18 +356,18 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
if (this.shouldShowExpandMessageButton) {
|
||||
DOM.append(this._detailsButtonContainer!, this._toggleMessageDetailButton!.element);
|
||||
} else {
|
||||
DOM.removeNode(this._toggleMessageDetailButton!.element);
|
||||
this._toggleMessageDetailButton!.element.remove();
|
||||
}
|
||||
}
|
||||
|
||||
private toggleMessageDetail() {
|
||||
const isExpanded = DOM.hasClass(this._messageSummary!, MESSAGE_EXPANDED_MODE_CLASS);
|
||||
DOM.toggleClass(this._messageSummary!, MESSAGE_EXPANDED_MODE_CLASS, !isExpanded);
|
||||
const isExpanded = this._messageSummary!.classList.contains(MESSAGE_EXPANDED_MODE_CLASS);
|
||||
this._messageSummary!.classList.toggle(MESSAGE_EXPANDED_MODE_CLASS, !isExpanded);
|
||||
this._toggleMessageDetailButton!.label = isExpanded ? SHOW_DETAILS_TEXT : localize('hideMessageDetails', "Hide Details");
|
||||
|
||||
if (this._messageDetailText) {
|
||||
if (isExpanded) {
|
||||
DOM.removeNode(this._messageDetail!);
|
||||
this._messageDetail!.remove();
|
||||
} else {
|
||||
DOM.append(this._messageBody!, this._messageDetail!);
|
||||
}
|
||||
@@ -576,8 +576,8 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
severityText = WARNING_ALT_TEXT;
|
||||
}
|
||||
levelClasses.forEach(level => {
|
||||
DOM.toggleClass(this._messageIcon!, level, selectedLevel === level);
|
||||
DOM.toggleClass(this._messageElement!, level, selectedLevel === level);
|
||||
this._messageIcon!.classList.toggle(level, selectedLevel === level);
|
||||
this._messageElement!.classList.toggle(level, selectedLevel === level);
|
||||
});
|
||||
|
||||
this._messageIcon!.title = severityText;
|
||||
@@ -586,7 +586,7 @@ export abstract class Modal extends Disposable implements IThemable {
|
||||
this._messageSummary!.title = message!;
|
||||
this._messageDetail!.innerText = description;
|
||||
}
|
||||
DOM.removeNode(this._messageDetail!);
|
||||
this._messageDetail!.remove();
|
||||
this.messagesElementVisible = !!this._messageSummaryText;
|
||||
// Read out the description to screen readers so they don't have to
|
||||
// search around for the alert box to hear the extra information
|
||||
|
||||
@@ -268,9 +268,10 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
||||
}
|
||||
|
||||
private static ACCEPTABLE_VALUES = new Set<string>(['number', 'string', 'boolean']);
|
||||
public override setProperties(properties: azdata.DeclarativeTableProperties): void {
|
||||
const basicData: any[][] = properties.data ?? [];
|
||||
const complexData: azdata.DeclarativeTableCellValue[][] = properties.dataValues ?? [];
|
||||
public override setProperties(properties: { [key: string]: any; }): void {
|
||||
let castProperties = properties as azdata.DeclarativeTableProperties;
|
||||
const basicData: any[][] = castProperties.data ?? [];
|
||||
const complexData: azdata.DeclarativeTableCellValue[][] = castProperties.dataValues ?? [];
|
||||
let finalData: azdata.DeclarativeTableCellValue[][];
|
||||
|
||||
finalData = basicData.map(row => {
|
||||
@@ -291,7 +292,7 @@ export default class DeclarativeTableComponent extends ContainerBase<any, azdata
|
||||
finalData = complexData;
|
||||
}
|
||||
|
||||
this.columns = properties.columns ?? [];
|
||||
this.columns = castProperties.columns ?? [];
|
||||
|
||||
// check whether the data property is changed before actually setting the properties.
|
||||
const isDataPropertyChanged = !arrayEquals(this.data, finalData ?? [], (a, b) => {
|
||||
|
||||
@@ -10,7 +10,7 @@ import {
|
||||
import * as azdata from 'azdata';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { TextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
@@ -96,8 +96,8 @@ export default class DiffEditorComponent extends ComponentBase<azdata.DiffEditor
|
||||
}
|
||||
});
|
||||
|
||||
let editorinput1 = this._instantiationService.createInstance(ResourceEditorInput, uri1, 'source', undefined, undefined);
|
||||
let editorinput2 = this._instantiationService.createInstance(ResourceEditorInput, uri2, 'target', undefined, undefined);
|
||||
let editorinput1 = this._instantiationService.createInstance(TextResourceEditorInput, uri1, 'source', undefined, undefined, undefined);
|
||||
let editorinput2 = this._instantiationService.createInstance(TextResourceEditorInput, uri2, 'target', undefined, undefined, undefined);
|
||||
this._editorInput = new DiffEditorInput('DiffEditor', undefined, editorinput1, editorinput2, true,
|
||||
this.labelService, this.fileService);
|
||||
this._editor.setInput(this._editorInput, undefined, undefined, cancellationTokenSource.token);
|
||||
|
||||
@@ -12,7 +12,6 @@ import {
|
||||
import { GroupLayout, GroupContainerProperties, CssStyles } from 'azdata';
|
||||
|
||||
import { ContainerBase } from 'sql/workbench/browser/modelComponents/componentBase';
|
||||
import { endsWith } from 'vs/base/common/strings';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -107,7 +106,7 @@ export default class GroupContainer extends ContainerBase<GroupLayout, GroupCont
|
||||
public getContainerWidth(): string {
|
||||
if (this._containerLayout && this._containerLayout.width) {
|
||||
let width: string = this._containerLayout.width.toString();
|
||||
if (!endsWith(width, '%') && !endsWith(width.toLowerCase(), 'px')) {
|
||||
if (!width.endsWith('%') && !width.toLowerCase().endsWith('px')) {
|
||||
width = width + 'px';
|
||||
}
|
||||
return width;
|
||||
|
||||
@@ -8,7 +8,6 @@ import {
|
||||
OnDestroy, AfterViewInit, ElementRef, ViewChild
|
||||
} from '@angular/core';
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as azdata from 'azdata';
|
||||
import { ITitledComponent } from 'sql/workbench/browser/modelComponents/interfaces';
|
||||
import { ComponentWithIconBase } from 'sql/workbench/browser/modelComponents/componentWithIconBase';
|
||||
@@ -56,7 +55,7 @@ export default class ImageComponent extends ComponentWithIconBase<azdata.ImageCo
|
||||
if (this.iconPath) {
|
||||
if (!this._iconClass) {
|
||||
super.updateIcon();
|
||||
DOM.addClasses(this.imageContainer.nativeElement, this._iconClass, 'icon');
|
||||
this.imageContainer.nativeElement.classList.add(this._iconClass, 'icon');
|
||||
} else {
|
||||
super.updateIcon();
|
||||
}
|
||||
|
||||
@@ -22,7 +22,6 @@ import { inputBackground, inputBorder } from 'vs/platform/theme/common/colorRegi
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IComponent, IComponentDescriptor, IModelStore, ComponentEventType } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { isNumber } from 'vs/base/common/types';
|
||||
import { convertSize, convertSizeToNumber } from 'sql/base/browser/dom';
|
||||
@@ -89,7 +88,7 @@ export default class InputBoxComponent extends ComponentBase<azdata.InputBoxProp
|
||||
this.registerInput(this._input, () => !this.multiline);
|
||||
}
|
||||
if (this._textareaContainer) {
|
||||
let textAreaInputOptions = assign({}, inputOptions, { flexibleHeight: true, type: 'textarea' });
|
||||
let textAreaInputOptions = Object.assign({}, inputOptions, { flexibleHeight: true, type: 'textarea' });
|
||||
this._textAreaInput = new InputBox(this._textareaContainer.nativeElement, this.contextViewService, textAreaInputOptions);
|
||||
this.onkeydown(this._textAreaInput.inputElement, (e: StandardKeyboardEvent) => {
|
||||
if (this.tryHandleKeyEvent(e)) {
|
||||
|
||||
@@ -7,12 +7,13 @@ import 'vs/css!./media/modelViewEditor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
|
||||
import { ModelViewInput } from 'sql/workbench/browser/modelComponents/modelViewInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export class ModelViewEditor extends EditorPane {
|
||||
|
||||
@@ -62,7 +63,7 @@ export class ModelViewEditor extends EditorPane {
|
||||
}
|
||||
}
|
||||
|
||||
override async setInput(input: ModelViewInput, options?: EditorOptions, context?: IEditorOpenContext): Promise<void> {
|
||||
override async setInput(input: ModelViewInput, options?: IEditorOptions, context?: IEditorOpenContext): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import * as azdata from 'azdata';
|
||||
|
||||
import { IEditorModel } from 'vs/platform/editor/common/editor';
|
||||
import { EditorInput, EditorModel, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -15,6 +15,8 @@ import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { IWorkbenchLayoutService, Parts } from 'vs/workbench/services/layout/browser/layoutService';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EditorModel } from 'vs/workbench/common/editor/editorModel';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IEditorOptions, EditorOption } from 'vs/editor/common/config/editorOptions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
|
||||
import { BaseTextEditor, IEditorConfiguration } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
@@ -15,13 +15,14 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ICodeEditor } from 'vs/editor/browser/editorBrowser';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
/**
|
||||
* Extension of TextResourceEditor that is always readonly rather than only with non UntitledInputs
|
||||
@@ -85,9 +86,9 @@ export class QueryTextEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
override async setInput(input: UntitledTextEditorInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
override async setInput(input: UntitledTextEditorInput, options: ITextEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
await super.setInput(input, options, context, CancellationToken.None);
|
||||
const editorModel = await this.input.resolve() as ResourceEditorModel;
|
||||
const editorModel = await this.input.resolve() as TextResourceEditorModel;
|
||||
await editorModel.resolve();
|
||||
this.getControl().setModel(editorModel.textEditorModel);
|
||||
}
|
||||
|
||||
@@ -17,8 +17,7 @@ import { Link } from 'vs/platform/opener/browser/link';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { attachLinkStyler } from 'vs/platform/theme/common/styler';
|
||||
import { IColorTheme, ICssStyleCollector, IThemeService, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { IColorTheme, ICssStyleCollector, registerThemingParticipant } from 'vs/platform/theme/common/themeService';
|
||||
import { errorForeground } from 'vs/platform/theme/common/colorRegistry';
|
||||
|
||||
export enum TextType {
|
||||
@@ -52,8 +51,7 @@ export default class TextComponent extends TitledComponent<azdata.TextComponentP
|
||||
@Inject(forwardRef(() => ChangeDetectorRef)) changeRef: ChangeDetectorRef,
|
||||
@Inject(forwardRef(() => ElementRef)) el: ElementRef,
|
||||
@Inject(IInstantiationService) private instantiationService: IInstantiationService,
|
||||
@Inject(ILogService) logService: ILogService,
|
||||
@Inject(IThemeService) private themeService: IThemeService) {
|
||||
@Inject(ILogService) logService: ILogService) {
|
||||
super(changeRef, el, logService);
|
||||
}
|
||||
|
||||
@@ -150,7 +148,7 @@ export default class TextComponent extends TitledComponent<azdata.TextComponentP
|
||||
const linkElement = this._register(this.instantiationService.createInstance(Link, {
|
||||
label: link.text,
|
||||
href: link.url
|
||||
}));
|
||||
}, undefined));
|
||||
if (link.accessibilityInformation) {
|
||||
linkElement.el.setAttribute('aria-label', link.accessibilityInformation.label);
|
||||
if (link.accessibilityInformation.role) {
|
||||
@@ -158,7 +156,6 @@ export default class TextComponent extends TitledComponent<azdata.TextComponentP
|
||||
}
|
||||
}
|
||||
|
||||
this._register(attachLinkStyler(linkElement, this.themeService));
|
||||
(<HTMLElement>this.textContainer.nativeElement).appendChild(linkElement.el);
|
||||
|
||||
// And finally update the text to remove the text up through the placeholder we just added
|
||||
|
||||
@@ -144,7 +144,7 @@ export class TreeComponentRenderer extends Disposable implements IRenderer {
|
||||
templateData.icon.style.backgroundImage = iconUri ? `url('${iconUri.toString(true)}')` : '';
|
||||
templateData.icon.style.backgroundRepeat = 'no-repeat';
|
||||
templateData.icon.style.backgroundPosition = 'center';
|
||||
dom.toggleClass(templateData.icon, 'model-view-tree-node-item-icon', !!icon);
|
||||
templateData.icon.classList.toggle('model-view-tree-node-item-icon', !!icon);
|
||||
if (element) {
|
||||
element.onCheckedChanged = (checked: boolean) => {
|
||||
this._dataProvider.onNodeCheckedChanged(element.handle, checked);
|
||||
|
||||
@@ -14,7 +14,6 @@ import { Extensions, IComponentRegistry } from 'sql/platform/dashboard/browser/m
|
||||
import { AngularDisposable } from 'sql/base/browser/lifecycle';
|
||||
import { ModelStore } from 'sql/workbench/browser/modelComponents/modelStore';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IModelStore, IComponentDescriptor, IComponent, ModelComponentTypes } from 'sql/platform/dashboard/browser/interfaces';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
|
||||
@@ -191,7 +190,7 @@ export abstract class ViewBase extends AngularDisposable implements IModelView {
|
||||
this.queueAction(componentId, (component) => {
|
||||
this.logService.debug(`Registering event handler for component ${componentId}`);
|
||||
this._register(component.registerEventHandler(e => {
|
||||
let modelViewEvent: IModelViewEventArgs = assign({
|
||||
let modelViewEvent: IModelViewEventArgs = Object.assign({
|
||||
componentId: componentId,
|
||||
isRootComponent: componentId === this.rootDescriptor.id
|
||||
}, e);
|
||||
|
||||
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
|
||||
import { IDisposable, Disposable } from 'vs/base/common/lifecycle';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { EditorInput, GroupIdentifier, IRevertOptions, ISaveOptions, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { GroupIdentifier, IRevertOptions, ISaveOptions, IEditorInput, EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
|
||||
import { IConnectionManagementService, IConnectableInput, INewConnectionParams, RunQueryOnConnectionMode } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -15,10 +15,10 @@ import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResult
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
|
||||
import { ExecutionPlanOptions } from 'azdata';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { AbstractTextResourceEditorInput } from 'vs/workbench/common/editor/textResourceEditorInput';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
const MAX_SIZE = 13;
|
||||
|
||||
@@ -183,8 +183,8 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
|
||||
return this._text.revert(group, options);
|
||||
}
|
||||
|
||||
public override isReadonly(): boolean {
|
||||
return false;
|
||||
public override get capabilities(): EditorInputCapabilities {
|
||||
return EditorInputCapabilities.None;
|
||||
}
|
||||
|
||||
public override matches(otherInput: any): boolean {
|
||||
@@ -320,6 +320,6 @@ export abstract class QueryEditorInput extends EditorInput implements IConnectab
|
||||
}
|
||||
|
||||
public get isSharedSession(): boolean {
|
||||
return !!(this.uri && startsWith(this.uri, 'vsls:'));
|
||||
return !!(this.uri && this.uri.startsWith('vsls:'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
import { TopOperationsState } from 'sql/workbench/common/editor/query/topOperationsState';
|
||||
import { ChartState } from 'sql/workbench/common/editor/query/chartState';
|
||||
|
||||
@@ -13,6 +13,7 @@ import { IResolvedTextEditorModel } from 'vs/editor/common/services/resolverServ
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { IUntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
|
||||
import { EncodingMode, IEncodingSupport } from 'vs/workbench/services/textfile/common/textfiles';
|
||||
import { EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
|
||||
export class UntitledQueryEditorInput extends QueryEditorInput implements IEncodingSupport {
|
||||
|
||||
@@ -61,8 +62,8 @@ export class UntitledQueryEditorInput extends QueryEditorInput implements IEncod
|
||||
return this.text.setEncoding(encoding, mode);
|
||||
}
|
||||
|
||||
override isUntitled(): boolean {
|
||||
override get capabilities(): EditorInputCapabilities {
|
||||
// Subclasses need to explicitly opt-in to being untitled.
|
||||
return true;
|
||||
return EditorInputCapabilities.Untitled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -238,7 +238,8 @@ suite('Assessment Actions', () => {
|
||||
mtime: Date.now(),
|
||||
name: '',
|
||||
resource: fileUri,
|
||||
size: 42
|
||||
size: 42,
|
||||
readonly: false
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import { IFileService } from 'vs/platform/files/common/files';
|
||||
import { IFileDialogService, FileFilter } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { VSBuffer } from 'vs/base/common/buffer';
|
||||
import { IOpenerService } from 'vs/platform/opener/common/opener';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
@@ -55,7 +54,7 @@ export class CreateInsightAction extends Action {
|
||||
let queryFile = uri.fsPath;
|
||||
let query: string | undefined = undefined;
|
||||
let type: { [key: string]: any } = {};
|
||||
let options = assign({}, context.options);
|
||||
let options = Object.assign({}, context.options);
|
||||
delete (options as any).type;
|
||||
type[context.options.type] = options;
|
||||
// create JSON
|
||||
|
||||
@@ -9,7 +9,6 @@ import { $ } from 'vs/base/browser/dom';
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { IInsightOptions, InsightType } from 'sql/workbench/contrib/charts/common/interfaces';
|
||||
import * as nls from 'vs/nls';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { IInsightData } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
|
||||
export interface IConfig extends IInsightOptions {
|
||||
@@ -71,7 +70,7 @@ export class ImageInsight implements IInsight {
|
||||
|
||||
private static _hexToBase64(hexVal: string) {
|
||||
|
||||
if (startsWith(hexVal, '0x')) {
|
||||
if (hexVal.startsWith('0x')) {
|
||||
hexVal = hexVal.slice(2);
|
||||
}
|
||||
// should be able to be replaced with new Buffer(hexVal, 'hex').toString('base64')
|
||||
|
||||
@@ -30,8 +30,8 @@ import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { TestDialogService } from 'vs/platform/dialogs/test/common/testDialogService';
|
||||
import { NativeParsedArgs } from 'vs/platform/environment/common/argv';
|
||||
|
||||
@@ -394,7 +394,7 @@ suite('commandLineService tests', () => {
|
||||
querymodelService.setup(c => c.onRunQueryComplete).returns(() => Event.None);
|
||||
let uri = URI.file(args._[0]);
|
||||
const workbenchinstantiationService = workbenchInstantiationService();
|
||||
const editorInput = workbenchinstantiationService.createInstance(FileEditorInput, uri, undefined, undefined, undefined, undefined, undefined);
|
||||
const editorInput = workbenchinstantiationService.createInstance(FileEditorInput, uri, undefined, undefined, undefined, undefined, undefined, undefined);
|
||||
const queryInput = new FileQueryEditorInput(undefined, editorInput, undefined, connectionManagementService.object, querymodelService.object, configurationService.object);
|
||||
queryInput.state.connected = true;
|
||||
const editorService: TypeMoq.Mock<IEditorService> = TypeMoq.Mock.ofType<IEditorService>(TestEditorService, TypeMoq.MockBehavior.Strict);
|
||||
|
||||
@@ -19,6 +19,7 @@ export class ConnectionStatusbarItem extends Disposable implements IWorkbenchCon
|
||||
private static readonly ID = 'status.connection.status';
|
||||
|
||||
private statusItem: IStatusbarEntryAccessor;
|
||||
private readonly name = localize('status.connection.status', "Connection Status");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -29,11 +30,11 @@ export class ConnectionStatusbarItem extends Disposable implements IWorkbenchCon
|
||||
super();
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: '',
|
||||
ariaLabel: ''
|
||||
},
|
||||
ConnectionStatusbarItem.ID,
|
||||
localize('status.connection.status', "Connection Status"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -85,7 +86,9 @@ export class ConnectionStatusbarItem extends Disposable implements IWorkbenchCon
|
||||
}
|
||||
|
||||
this.statusItem.update({
|
||||
text, ariaLabel: text, tooltip
|
||||
name: this.name,
|
||||
text: text,
|
||||
ariaLabel: text, tooltip
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,7 +181,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
let secondary: IAction[] = [];
|
||||
const menu = this.menuService.createMenu(MenuId.DashboardToolbar, this.contextKeyService);
|
||||
let groups = menu.getActions({ arg: this.connectionManagementService.connectionInfo.connectionProfile.toIConnectionProfile(), shouldForwardArgs: true });
|
||||
fillInActions(groups, { primary, secondary }, false, '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
fillInActions(groups, { primary, secondary }, false, g => g === '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
|
||||
primary.forEach(a => {
|
||||
if (a instanceof MenuItemAction) {
|
||||
@@ -504,7 +504,7 @@ export abstract class DashboardPage extends AngularDisposable implements IConfig
|
||||
return [this.propertiesWidget];
|
||||
} else if (types.isArray(properties)) {
|
||||
return properties.map((item) => {
|
||||
const retVal = objects.assign({}, this.propertiesWidget);
|
||||
const retVal = Object.assign({}, this.propertiesWidget);
|
||||
retVal.edition = item.edition;
|
||||
retVal.provider = item.provider;
|
||||
retVal.widget = { 'properties-widget': { properties: item.properties } };
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkbenchThemeService } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
@@ -24,6 +24,7 @@ import { IConnectionManagementService } from 'sql/platform/connection/common/con
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export class DashboardEditor extends EditorPane {
|
||||
|
||||
@@ -77,7 +78,7 @@ export class DashboardEditor extends EditorPane {
|
||||
this._dashboardService.layout(dimension);
|
||||
}
|
||||
|
||||
public override async setInput(input: DashboardInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
public override async setInput(input: DashboardInput, options: IEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import { IThemeService, IColorTheme } from 'vs/platform/theme/common/themeServic
|
||||
import { IPointDataSet } from 'sql/workbench/contrib/charts/browser/interfaces';
|
||||
import { IInsightsView, IInsightData } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
import { ChartType, LegendPosition } from 'sql/workbench/contrib/charts/common/interfaces';
|
||||
import { createMemoizer } from 'vs/base/common/decorators';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
|
||||
@Component({
|
||||
@@ -35,8 +34,6 @@ import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
</div>`
|
||||
})
|
||||
export abstract class ChartInsight extends Disposable implements IInsightsView {
|
||||
protected static readonly MEMOIZER = createMemoizer();
|
||||
|
||||
private _isDataAvailable: boolean = false;
|
||||
protected _hasInit: boolean = false;
|
||||
protected _hasError: boolean = false;
|
||||
@@ -132,7 +129,7 @@ export abstract class ChartInsight extends Disposable implements IInsightsView {
|
||||
|
||||
@Input() set data(data: IInsightData) {
|
||||
// unmemoize chart data as the data needs to be recalced
|
||||
ChartInsight.MEMOIZER.clear();
|
||||
this.clearMemoize();
|
||||
this._data = this.filterToTopNData(data);
|
||||
if (isValidData(data)) {
|
||||
this._isDataAvailable = true;
|
||||
@@ -170,8 +167,9 @@ export abstract class ChartInsight extends Disposable implements IInsightsView {
|
||||
}
|
||||
|
||||
protected clearMemoize(): void {
|
||||
// unmemoize getters since their result can be changed by a new config
|
||||
ChartInsight.MEMOIZER.clear();
|
||||
this._cachedChartData = undefined;
|
||||
this._cachedColors = undefined;
|
||||
this._cachedLabels = undefined;
|
||||
}
|
||||
|
||||
public setConfig(config: IChartConfig) {
|
||||
@@ -185,77 +183,85 @@ export abstract class ChartInsight extends Disposable implements IInsightsView {
|
||||
}
|
||||
|
||||
/* Typescript does not allow you to access getters/setters for super classes.
|
||||
his is a workaround that allows us to still call base getter */
|
||||
@ChartInsight.MEMOIZER
|
||||
his is a workaround that allows us to still call base getter */
|
||||
private _cachedChartData: Array<IDataSet>;
|
||||
protected getChartData(): Array<IDataSet> {
|
||||
if (this._config.dataDirection === 'horizontal') {
|
||||
if (this._config.labelFirstColumn) {
|
||||
return this._data.rows.map((row) => {
|
||||
return {
|
||||
data: row.map(item => Number(item)).slice(1),
|
||||
label: row[0]
|
||||
};
|
||||
});
|
||||
if (!this._cachedChartData) {
|
||||
if (this._config.dataDirection === 'horizontal') {
|
||||
if (this._config.labelFirstColumn) {
|
||||
this._cachedChartData = this._data.rows.map((row) => {
|
||||
return {
|
||||
data: row.map(item => Number(item)).slice(1),
|
||||
label: row[0]
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this._cachedChartData = this._data.rows.map((row, i) => {
|
||||
return {
|
||||
data: row.map(item => Number(item)),
|
||||
label: 'Series' + i
|
||||
};
|
||||
});
|
||||
}
|
||||
} else {
|
||||
return this._data.rows.map((row, i) => {
|
||||
return {
|
||||
data: row.map(item => Number(item)),
|
||||
label: 'Series' + i
|
||||
};
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this._config.columnsAsLabels) {
|
||||
return this._data.rows[0].slice(1).map((row, i) => {
|
||||
return {
|
||||
data: this._data.rows.map(row => Number(row[i + 1])),
|
||||
label: this._data.columns[i + 1]
|
||||
};
|
||||
});
|
||||
} else {
|
||||
return this._data.rows[0].slice(1).map((row, i) => {
|
||||
return {
|
||||
data: this._data.rows.map(row => Number(row[i + 1])),
|
||||
label: 'Series' + (i + 1)
|
||||
};
|
||||
});
|
||||
if (this._config.columnsAsLabels) {
|
||||
this._cachedChartData = this._data.rows[0].slice(1).map((row, i) => {
|
||||
return {
|
||||
data: this._data.rows.map(row => Number(row[i + 1])),
|
||||
label: this._data.columns[i + 1]
|
||||
};
|
||||
});
|
||||
} else {
|
||||
this._cachedChartData = this._data.rows[0].slice(1).map((row, i) => {
|
||||
return {
|
||||
data: this._data.rows.map(row => Number(row[i + 1])),
|
||||
label: 'Series' + (i + 1)
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
return this._cachedChartData;
|
||||
}
|
||||
|
||||
public get chartData(): Array<IDataSet | IPointDataSet> {
|
||||
return this.getChartData();
|
||||
}
|
||||
|
||||
@ChartInsight.MEMOIZER
|
||||
private _cachedLabels: Array<string>;
|
||||
public getLabels(): Array<string> {
|
||||
if (this._config.dataDirection === 'horizontal') {
|
||||
if (this._config.labelFirstColumn) {
|
||||
return this._data.columns.slice(1);
|
||||
if (!this._cachedLabels) {
|
||||
if (this._config.dataDirection === 'horizontal') {
|
||||
if (this._config.labelFirstColumn) {
|
||||
this._cachedLabels = this._data.columns.slice(1);
|
||||
} else {
|
||||
this._cachedLabels = this._data.columns;
|
||||
}
|
||||
} else {
|
||||
return this._data.columns;
|
||||
this._cachedLabels = this._data.rows.map(row => row[0]);
|
||||
}
|
||||
} else {
|
||||
return this._data.rows.map(row => row[0]);
|
||||
}
|
||||
return this._cachedLabels;
|
||||
}
|
||||
|
||||
public get labels(): Array<string> {
|
||||
return this.getLabels();
|
||||
}
|
||||
|
||||
|
||||
@ChartInsight.MEMOIZER
|
||||
private _cachedColors: { backgroundColor: string[] }[];
|
||||
public get colors(): { backgroundColor: string[] }[] {
|
||||
if (this._config && this._config.colorMap) {
|
||||
const backgroundColor = this.labels.map((item) => {
|
||||
return this._config.colorMap[item];
|
||||
});
|
||||
const colorsMap = { backgroundColor };
|
||||
return [colorsMap];
|
||||
} else {
|
||||
return undefined;
|
||||
if (!this._cachedColors) {
|
||||
if (this._config && this._config.colorMap) {
|
||||
const backgroundColor = this.labels.map((item) => {
|
||||
return this._config.colorMap[item];
|
||||
});
|
||||
const colorsMap = { backgroundColor };
|
||||
this._cachedColors = [colorsMap];
|
||||
} else {
|
||||
this._cachedColors = undefined;
|
||||
}
|
||||
}
|
||||
return this._cachedColors;
|
||||
}
|
||||
|
||||
public set legendPosition(input: LegendPosition) {
|
||||
|
||||
@@ -50,22 +50,25 @@ export default class LineChart extends BarChart {
|
||||
|
||||
protected override clearMemoize() {
|
||||
super.clearMemoize();
|
||||
LineChart.MEMOIZER.clear();
|
||||
this._cachedPointData = undefined;
|
||||
}
|
||||
|
||||
@LineChart.MEMOIZER
|
||||
private _cachedPointData: Array<IPointDataSet>;
|
||||
protected getDataAsPoint(): Array<IPointDataSet> {
|
||||
const dataSetMap: { [label: string]: IPointDataSet } = {};
|
||||
this._data.rows.map(row => {
|
||||
if (row && row.length >= 3) {
|
||||
const legend = row[0];
|
||||
if (!dataSetMap[legend]) {
|
||||
dataSetMap[legend] = { label: legend, data: [], fill: false };
|
||||
if (!this._cachedPointData) {
|
||||
const dataSetMap: { [label: string]: IPointDataSet } = {};
|
||||
this._data.rows.map(row => {
|
||||
if (row && row.length >= 3) {
|
||||
const legend = row[0];
|
||||
if (!dataSetMap[legend]) {
|
||||
dataSetMap[legend] = { label: legend, data: [], fill: false };
|
||||
}
|
||||
dataSetMap[legend].data.push({ x: Number(row[1]), y: Number(row[2]) });
|
||||
}
|
||||
dataSetMap[legend].data.push({ x: Number(row[1]), y: Number(row[2]) });
|
||||
}
|
||||
});
|
||||
return values(dataSetMap);
|
||||
});
|
||||
this._cachedPointData = values(dataSetMap);
|
||||
}
|
||||
return this._cachedPointData;
|
||||
}
|
||||
|
||||
public override get labels(): Array<string> {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import LineChart, { ILineConfig } from './lineChart.component';
|
||||
import { defaultChartConfig } from 'sql/workbench/contrib/dashboard/browser/widgets/insights/views/charts/interfaces';
|
||||
|
||||
import { mixin, deepClone, assign } from 'vs/base/common/objects';
|
||||
import { mixin, deepClone } from 'vs/base/common/objects';
|
||||
import { Color } from 'vs/base/common/color';
|
||||
import { ChangeDetectorRef, Inject, forwardRef } from '@angular/core';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
@@ -58,7 +58,7 @@ export default class TimeSeriesChart extends LineChart {
|
||||
}
|
||||
};
|
||||
|
||||
this.options = assign({}, mixin(this.options, options));
|
||||
this.options = Object.assign({}, mixin(this.options, options));
|
||||
}
|
||||
|
||||
protected override getDataAsPoint(): Array<IPointDataSet> {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { Component, Input, Inject, ChangeDetectorRef, forwardRef, ViewChild, OnI
|
||||
|
||||
import { mixin } from 'vs/base/common/objects';
|
||||
import { IInsightsView, IInsightData } from 'sql/platform/dashboard/browser/insightRegistry';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
|
||||
interface IConfig {
|
||||
encoding?: string;
|
||||
@@ -70,7 +69,7 @@ export default class ImageInsight implements IInsightsView, OnInit {
|
||||
|
||||
private static _hexToBase64(hexVal: string) {
|
||||
|
||||
if (startsWith(hexVal, '0x')) {
|
||||
if (hexVal.startsWith('0x')) {
|
||||
hexVal = hexVal.slice(2);
|
||||
}
|
||||
// should be able to be replaced with new Buffer(hexVal, 'hex').toString('base64')
|
||||
|
||||
@@ -74,7 +74,7 @@ export class ConnectionViewletPanel extends ViewPane {
|
||||
|
||||
override layoutBody(size: number): void {
|
||||
this._serverTreeView.layout(size);
|
||||
DOM.toggleClass(this._root!, 'narrow', this._root!.clientWidth < 300);
|
||||
this._root!.classList.toggle('narrow', this._root!.clientWidth < 300);
|
||||
}
|
||||
|
||||
show(): void {
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { toggleClass, Dimension } from 'vs/base/browser/dom';
|
||||
import { Dimension } from 'vs/base/browser/dom';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -80,7 +80,7 @@ export class DataExplorerViewPaneContainer extends ViewPaneContainer {
|
||||
}
|
||||
|
||||
override layout(dimension: Dimension): void {
|
||||
toggleClass(this.root!, 'narrow', dimension.width <= 300);
|
||||
this.root!.classList.toggle('narrow', dimension.width <= 300);
|
||||
super.layout(new Dimension(dimension.width, dimension.height));
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ import * as strings from 'vs/base/common/strings';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as nls from 'vs/nls';
|
||||
|
||||
import { EditorOptions, EditorInput, IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorControl, IEditorPane, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -35,9 +35,12 @@ import { EditDataResultsEditor } from 'sql/workbench/contrib/editData/browser/ed
|
||||
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IEditorGroup } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
|
||||
/**
|
||||
* Editor that hosts an action bar and a resultSetInput for an edit data session
|
||||
@@ -71,6 +74,7 @@ export class EditDataEditor extends EditorPane {
|
||||
private _queryEditorVisible: IContextKey<boolean>;
|
||||
private hideQueryResultsView = false;
|
||||
|
||||
private readonly _disposables = new DisposableStore();
|
||||
constructor(
|
||||
@ITelemetryService _telemetryService: ITelemetryService,
|
||||
@IThemeService themeService: IThemeService,
|
||||
@@ -79,7 +83,8 @@ export class EditDataEditor extends EditorPane {
|
||||
@IQueryModelService private _queryModelService: IQueryModelService,
|
||||
@IEditorDescriptorService private _editorDescriptorService: IEditorDescriptorService,
|
||||
@IContextKeyService contextKeyService: IContextKeyService,
|
||||
@IStorageService storageService: IStorageService
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IEditorGroupsService editorGroupsService: IEditorGroupsService
|
||||
) {
|
||||
super(EditDataEditor.ID, _telemetryService, themeService, storageService);
|
||||
|
||||
@@ -87,18 +92,28 @@ export class EditDataEditor extends EditorPane {
|
||||
this._queryEditorVisible = queryContext.QueryEditorVisibleContext.bindTo(contextKeyService);
|
||||
}
|
||||
|
||||
if (_editorService) {
|
||||
_editorService.overrideOpenEditor({
|
||||
open: (editor, options, group) => {
|
||||
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
});
|
||||
if (editorGroupsService) {
|
||||
// Add all the initial groups to be listened to
|
||||
editorGroupsService.whenReady.then(() => editorGroupsService.groups.forEach(group => {
|
||||
this.registerGroupListener(group);
|
||||
}));
|
||||
|
||||
// Additional groups added should also be listened to
|
||||
this._register(editorGroupsService.onDidAddGroup((group) => this.registerGroupListener(group)));
|
||||
|
||||
this._register(this._disposables);
|
||||
}
|
||||
}
|
||||
|
||||
private registerGroupListener(group: IEditorGroup): void {
|
||||
const listener = group.onWillOpenEditor(e => {
|
||||
if (this.isVisible() && (e.editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
});
|
||||
this._disposables.add(listener);
|
||||
}
|
||||
|
||||
// PUBLIC METHODS ////////////////////////////////////////////////////////////
|
||||
|
||||
// Getters and Setters
|
||||
@@ -214,7 +229,7 @@ export class EditDataEditor extends EditorPane {
|
||||
/**
|
||||
* Sets the input data for this editor.
|
||||
*/
|
||||
public override setInput(newInput: EditDataInput, options?: EditorOptions, context?: IEditorOpenContext): Promise<void> {
|
||||
public override setInput(newInput: EditDataInput, options?: IEditorOptions, context?: IEditorOpenContext): Promise<void> {
|
||||
let oldInput = <EditDataInput>this.input;
|
||||
if (!newInput.setup) {
|
||||
this._initialized = false;
|
||||
@@ -492,7 +507,7 @@ export class EditDataEditor extends EditorPane {
|
||||
/**
|
||||
* Sets input for the results editor after it has been created.
|
||||
*/
|
||||
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: EditorOptions): Promise<void> {
|
||||
private _onResultsEditorCreated(resultsEditor: EditDataResultsEditor, resultsInput: EditDataResultsInput, options: IEditorOptions): Promise<void> {
|
||||
this._resultsEditor = resultsEditor;
|
||||
return this._resultsEditor.setInput(resultsInput, options, undefined);
|
||||
}
|
||||
@@ -500,7 +515,7 @@ export class EditDataEditor extends EditorPane {
|
||||
/**
|
||||
* Sets input for the SQL editor after it has been created.
|
||||
*/
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledTextEditorInput, options: EditorOptions): Thenable<void> {
|
||||
private _onSqlEditorCreated(sqlEditor: TextResourceEditor, sqlInput: UntitledTextEditorInput, options: IEditorOptions): Thenable<void> {
|
||||
this._sqlEditor = sqlEditor;
|
||||
return this._sqlEditor.setInput(sqlInput, options, undefined, CancellationToken.None);
|
||||
}
|
||||
@@ -520,7 +535,7 @@ export class EditDataEditor extends EditorPane {
|
||||
* - Opened for the first time
|
||||
* - Opened with a new EditDataInput
|
||||
*/
|
||||
private _setNewInput(newInput: EditDataInput, options?: EditorOptions): Promise<any> {
|
||||
private _setNewInput(newInput: EditDataInput, options?: IEditorOptions): Promise<any> {
|
||||
|
||||
// Promises that will ensure proper ordering of editor creation logic
|
||||
let createEditors: () => Promise<any>;
|
||||
@@ -606,7 +621,7 @@ export class EditDataEditor extends EditorPane {
|
||||
* Handles setting input for this editor. If this new input does not match the old input (e.g. a new file
|
||||
* has been opened with the same editor, or we are opening the editor for the first time).
|
||||
*/
|
||||
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: EditorOptions): Promise<void> {
|
||||
private _updateInput(oldInput: EditDataInput, newInput: EditDataInput, options?: IEditorOptions): Promise<void> {
|
||||
if (this._sqlEditor) {
|
||||
this._sqlEditor.clearInput();
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import { KeyCode } from 'vs/base/common/keyCodes';
|
||||
import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
|
||||
import { EditUpdateCellResult } from 'azdata';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { deepClone, assign } from 'vs/base/common/objects';
|
||||
import { deepClone } from 'vs/base/common/objects';
|
||||
import { Event } from 'vs/base/common/event';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
@@ -362,7 +362,7 @@ export class EditDataGridPanel extends GridParentComponent {
|
||||
|
||||
async handleResultSet(self: EditDataGridPanel, event: any): Promise<void> {
|
||||
// Clone the data before altering it to avoid impacting other subscribers
|
||||
let resultSet = assign({}, event.data);
|
||||
let resultSet = Object.assign({}, event.data);
|
||||
if (!resultSet.complete) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { getZoomLevel } from 'vs/base/browser/browser';
|
||||
import { Configuration } from 'vs/editor/browser/config/configuration';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -20,6 +20,7 @@ import { EditDataGridPanel } from 'sql/workbench/contrib/editData/browser/editDa
|
||||
import { EditDataResultsInput } from 'sql/workbench/browser/editData/editDataResultsInput';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export class EditDataResultsEditor extends EditorPane {
|
||||
|
||||
@@ -63,7 +64,7 @@ export class EditDataResultsEditor extends EditorPane {
|
||||
public layout(dimension: DOM.Dimension): void {
|
||||
}
|
||||
|
||||
public override setInput(input: EditDataResultsInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
public override setInput(input: EditDataResultsInput, options: IEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
super.setInput(input, options, context, CancellationToken.None);
|
||||
this._applySettings();
|
||||
if (!input.hasBootstrapped) {
|
||||
|
||||
@@ -318,6 +318,7 @@ export class NotebookFindDecorations implements IDisposable {
|
||||
}
|
||||
|
||||
private static readonly _CURRENT_FIND_MATCH_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'CURRENT_FIND_MATCH_DECORATION',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
zIndex: 13,
|
||||
className: 'currentFindMatch',
|
||||
@@ -333,6 +334,7 @@ export class NotebookFindDecorations implements IDisposable {
|
||||
});
|
||||
|
||||
private static readonly _FIND_MATCH_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'FIND_MATCH_DECORATION',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'findMatch',
|
||||
showIfCollapsed: true,
|
||||
@@ -347,12 +349,14 @@ export class NotebookFindDecorations implements IDisposable {
|
||||
});
|
||||
|
||||
private static readonly _FIND_MATCH_NO_OVERVIEW_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'FIND_MATCH_NO_OVERVIEW_DECORATION',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'findMatch',
|
||||
showIfCollapsed: true
|
||||
});
|
||||
|
||||
private static readonly _FIND_MATCH_ONLY_OVERVIEW_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'FIND_MATCH_ONLY_OVERVIEW_DECORATION',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
overviewRuler: {
|
||||
color: themeColorFromId(overviewRulerFindMatchForeground),
|
||||
@@ -361,12 +365,14 @@ export class NotebookFindDecorations implements IDisposable {
|
||||
});
|
||||
|
||||
private static readonly _RANGE_HIGHLIGHT_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'RANGE_HIGHLIGHT_DECORATION',
|
||||
stickiness: TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges,
|
||||
className: 'rangeHighlight',
|
||||
isWholeLine: false
|
||||
});
|
||||
|
||||
private static readonly _FIND_SCOPE_DECORATION = ModelDecorationOptions.register({
|
||||
description: 'FIND_SCOPE_DECORATION',
|
||||
className: 'findScope',
|
||||
isWholeLine: true
|
||||
});
|
||||
|
||||
@@ -130,9 +130,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
|
||||
if (FIND_WIDGET_INITIAL_WIDTH + 28 + minimapWidth - MAX_MATCHES_COUNT_WIDTH >= editorWidth + 50) {
|
||||
collapsedFindWidget = true;
|
||||
}
|
||||
dom.toggleClass(this._domNode, 'collapsed-find-widget', collapsedFindWidget);
|
||||
dom.toggleClass(this._domNode, 'narrow-find-widget', narrowFindWidget);
|
||||
dom.toggleClass(this._domNode, 'reduced-find-widget', reducedFindWidget);
|
||||
this._domNode.classList.toggle('collapsed-find-widget', collapsedFindWidget);
|
||||
this._domNode.classList.toggle('narrow-find-widget', narrowFindWidget);
|
||||
this._domNode.classList.toggle('reduced-find-widget', reducedFindWidget);
|
||||
|
||||
if (!narrowFindWidget && !collapsedFindWidget) {
|
||||
// the minimal left offset of findwidget is 15px.
|
||||
@@ -215,7 +215,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
|
||||
}
|
||||
if (e.searchString || e.matchesCount || e.matchesPosition) {
|
||||
let showRedOutline = (this._state.searchString.length > 0 && this._state.matchesCount === 0);
|
||||
dom.toggleClass(this._domNode, 'no-results', showRedOutline);
|
||||
this._domNode.classList.toggle('no-results', showRedOutline);
|
||||
|
||||
this._updateMatchesCount();
|
||||
}
|
||||
@@ -568,7 +568,7 @@ class SimpleButton extends Widget {
|
||||
}
|
||||
|
||||
public setEnabled(enabled: boolean): void {
|
||||
dom.toggleClass(this._domNode, 'disabled', !enabled);
|
||||
this._domNode.classList.toggle('disabled', !enabled);
|
||||
this._domNode.setAttribute('aria-disabled', String(!enabled));
|
||||
this._domNode.tabIndex = enabled ? 0 : -1;
|
||||
}
|
||||
@@ -578,6 +578,6 @@ class SimpleButton extends Widget {
|
||||
}
|
||||
|
||||
public toggleClass(className: string, shouldHaveIt: boolean): void {
|
||||
dom.toggleClass(this._domNode, className, shouldHaveIt);
|
||||
this._domNode.classList.toggle(className, shouldHaveIt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { SideBySideEditorInput } from 'vs/workbench/common/editor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { SideBySideEditorInput } from 'vs/workbench/common/editor/sideBySideEditorInput';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/fileNotebookInput';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput, EditorModel, IRevertOptions, GroupIdentifier, IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { IRevertOptions, GroupIdentifier, IEditorInput, EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
import { Emitter, Event } from 'vs/base/common/event';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import * as resources from 'vs/base/common/resources';
|
||||
@@ -12,7 +12,7 @@ import * as azdata from 'azdata';
|
||||
import { IStandardKernelWithProvider, getProvidersForFileName, getStandardKernelsForProvider } from 'sql/workbench/services/notebook/browser/models/notebookUtils';
|
||||
import { INotebookService, DEFAULT_NOTEBOOK_PROVIDER, IProviderInfo } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { ITextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService';
|
||||
import { INotebookModel, IContentManager, NotebookContentChange } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { TextFileEditorModel } from 'vs/workbench/services/textfile/common/textFileEditorModel';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
@@ -25,16 +25,18 @@ import { NotebookChangeType } from 'sql/workbench/services/notebook/common/contr
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
import { NotebookTextFileModel } from 'sql/workbench/contrib/notebook/browser/models/notebookTextFileModel';
|
||||
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
|
||||
import { UntitledTextEditorModel, IUntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { AbstractResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
import { NotebookFindModel } from 'sql/workbench/contrib/notebook/browser/find/notebookFindModel';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { NotebookModel } from 'sql/workbench/services/notebook/browser/models/notebookModel';
|
||||
import { INotebookInput } from 'sql/workbench/services/notebook/browser/interface';
|
||||
import { EditorModel } from 'vs/workbench/common/editor/editorModel';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
|
||||
export type ModeViewSaveHandler = (handle: number) => Thenable<boolean>;
|
||||
|
||||
@@ -46,7 +48,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
private _lastEditFullReplacement: boolean;
|
||||
private _isFirstKernelChange: boolean = true;
|
||||
constructor(public readonly notebookUri: URI,
|
||||
private textEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | ResourceEditorModel,
|
||||
private textEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | TextResourceEditorModel,
|
||||
@INotebookService private notebookService: INotebookService,
|
||||
@ITextResourcePropertiesService private textResourcePropertiesService: ITextResourcePropertiesService
|
||||
) {
|
||||
@@ -72,18 +74,18 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}));
|
||||
if (this.textEditorModel instanceof UntitledTextEditorModel) {
|
||||
this._register(this.textEditorModel.onDidChangeDirty(e => {
|
||||
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
let dirty = this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
this.setDirty(dirty);
|
||||
}));
|
||||
} else {
|
||||
if (this.textEditorModel instanceof TextFileEditorModel) {
|
||||
this._register(this.textEditorModel.onDidSave(() => {
|
||||
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
let dirty = this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
this.setDirty(dirty);
|
||||
this.sendNotebookSerializationStateChange();
|
||||
}));
|
||||
this._register(this.textEditorModel.onDidChangeDirty(() => {
|
||||
let dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
let dirty = this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
this.setDirty(dirty);
|
||||
}));
|
||||
this._register(this.textEditorModel.onDidResolve(async (e) => {
|
||||
@@ -94,7 +96,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}));
|
||||
}
|
||||
}
|
||||
this._dirty = this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
this._dirty = this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
}
|
||||
|
||||
public get contentString(): string {
|
||||
@@ -107,7 +109,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}
|
||||
|
||||
isDirty(): boolean {
|
||||
return this.textEditorModel instanceof ResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
return this.textEditorModel instanceof TextResourceEditorModel ? false : this.textEditorModel.isDirty();
|
||||
}
|
||||
|
||||
public setDirty(dirty: boolean): void {
|
||||
@@ -208,7 +210,7 @@ export class NotebookEditorModel extends EditorModel {
|
||||
}
|
||||
}
|
||||
|
||||
type TextInput = ResourceEditorInput | UntitledTextEditorInput | FileEditorInput;
|
||||
type TextInput = AbstractResourceEditorInput | UntitledTextEditorInput | FileEditorInput;
|
||||
|
||||
export abstract class NotebookInput extends EditorInput implements INotebookInput {
|
||||
private _providerId: string;
|
||||
@@ -286,8 +288,8 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
|
||||
return this._title;
|
||||
}
|
||||
|
||||
public override isReadonly(): boolean {
|
||||
return false;
|
||||
public override get capabilities(): EditorInputCapabilities {
|
||||
return EditorInputCapabilities.None;
|
||||
}
|
||||
|
||||
public async getProviderInfo(): Promise<IProviderInfo> {
|
||||
@@ -384,7 +386,7 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
|
||||
if (this._model) {
|
||||
return Promise.resolve(this._model);
|
||||
} else {
|
||||
let textOrUntitledEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | ResourceEditorModel;
|
||||
let textOrUntitledEditorModel: ITextFileEditorModel | IUntitledTextEditorModel | TextResourceEditorModel;
|
||||
if (this.resource.scheme === Schemas.untitled) {
|
||||
if (this._untitledEditorModel) {
|
||||
this._untitledEditorModel.textEditorModel.onBeforeAttached();
|
||||
@@ -392,15 +394,15 @@ export abstract class NotebookInput extends EditorInput implements INotebookInpu
|
||||
} else {
|
||||
let resolvedInput = await this._textInput.resolve();
|
||||
if (!(resolvedInput instanceof BinaryEditorModel)) {
|
||||
resolvedInput.textEditorModel.onBeforeAttached();
|
||||
(resolvedInput as ITextEditorModel).textEditorModel.onBeforeAttached();
|
||||
}
|
||||
textOrUntitledEditorModel = resolvedInput as TextFileEditorModel | UntitledTextEditorModel | ResourceEditorModel;
|
||||
textOrUntitledEditorModel = resolvedInput as TextFileEditorModel | UntitledTextEditorModel | TextResourceEditorModel;
|
||||
}
|
||||
} else {
|
||||
const textEditorModelReference = await this.textModelService.createModelReference(this.resource);
|
||||
textEditorModelReference.object.textEditorModel.onBeforeAttached();
|
||||
await textEditorModelReference.object.resolve();
|
||||
textOrUntitledEditorModel = textEditorModelReference.object as TextFileEditorModel | ResourceEditorModel;
|
||||
textOrUntitledEditorModel = textEditorModelReference.object as TextFileEditorModel | TextResourceEditorModel;
|
||||
}
|
||||
this._model = this._register(this.instantiationService.createInstance(NotebookEditorModel, this.resource, textOrUntitledEditorModel));
|
||||
this.hookDirtyListener(this._model.onDidChangeDirty, () => this._onDidChangeDirty.fire());
|
||||
|
||||
@@ -9,7 +9,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
|
||||
import { FileNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/fileNotebookInput';
|
||||
import { UntitledNotebookInput } from 'sql/workbench/contrib/notebook/browser/models/untitledNotebookInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { ILanguageAssociation } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
@@ -44,7 +44,7 @@ export class NotebookEditorInputAssociation implements ILanguageAssociation {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
syncConvertinput(activeEditor: IEditorInput): NotebookInput | DiffNotebookInput | undefined {
|
||||
syncConvertInput(activeEditor: IEditorInput): NotebookInput | DiffNotebookInput | undefined {
|
||||
return this.convertInput(activeEditor);
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@ import { IExtensionService } from 'vs/workbench/services/extensions/common/exten
|
||||
import { NotebookInput } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
|
||||
export class UntitledNotebookInput extends NotebookInput {
|
||||
public static ID: string = 'workbench.editorinputs.untitledNotebookInput';
|
||||
@@ -34,9 +35,9 @@ export class UntitledNotebookInput extends NotebookInput {
|
||||
this.textInput.setMode(mode);
|
||||
}
|
||||
|
||||
override isUntitled(): boolean {
|
||||
override get capabilities(): EditorInputCapabilities {
|
||||
// Subclasses need to explicitly opt-in to being untitled.
|
||||
return true;
|
||||
return EditorInputCapabilities.Untitled;
|
||||
}
|
||||
|
||||
override get typeId(): string {
|
||||
|
||||
@@ -589,7 +589,7 @@ export class NotebookComponent extends AngularDisposable implements OnInit, OnDe
|
||||
let secondary: IAction[] = [];
|
||||
let notebookBarMenu = this.menuService.createMenu(MenuId.NotebookToolbar, this.contextKeyService);
|
||||
let groups = notebookBarMenu.getActions({ arg: null, shouldForwardArgs: true });
|
||||
fillInActions(groups, { primary, secondary }, false, '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
fillInActions(groups, { primary, secondary }, false, g => g === '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
this.addPrimaryContributedActions(primary);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ import { INotebookManager } from 'sql/workbench/services/notebook/browser/notebo
|
||||
import { NotebookExplorerViewletViewsContribution } from 'sql/workbench/contrib/notebook/browser/notebookExplorer/notebookExplorerViewlet';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { ContributedEditorPriority, IEditorOverrideService } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { DiffEditorInput } from 'vs/workbench/common/editor/diffEditorInput';
|
||||
@@ -717,7 +717,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
// Create the selector from the list of all the language extensions we want to associate with the
|
||||
// notebook editor (filtering out any languages which didn't have any extensions registered yet)
|
||||
const selector = `*{${langExtensions.join(',')}}`;
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerContributionPoint(
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: NotebookEditor.ID,
|
||||
@@ -745,7 +745,7 @@ export class NotebookEditorOverrideContribution extends Disposable implements IW
|
||||
|
||||
private tryConvertInput(input: IEditorInput, lang: string): IEditorInput | undefined {
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const notebookEditorInput = langAssociation?.syncConvertinput?.(input);
|
||||
const notebookEditorInput = langAssociation?.syncConvertInput?.(input);
|
||||
if (!notebookEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', input instanceof DiffEditorInput ? `${input.primary.resource.toString()} <-> ${input.secondary.resource.toString()}` : input.resource.toString());
|
||||
return undefined;
|
||||
|
||||
@@ -171,7 +171,7 @@ export class NotebookEditorComponent extends AngularDisposable {
|
||||
let secondary: IAction[] = [];
|
||||
let notebookBarMenu = this.menuService.createMenu(MenuId.NotebookToolbar, this.contextKeyService);
|
||||
let groups = notebookBarMenu.getActions({ arg: null, shouldForwardArgs: true });
|
||||
fillInActions(groups, { primary, secondary }, false, '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
fillInActions(groups, { primary, secondary }, false, g => g === '', Number.MAX_SAFE_INTEGER, (action: SubmenuAction, group: string, groupSize: number) => group === undefined || group === '');
|
||||
}
|
||||
|
||||
private get modelFactory(): IModelFactory {
|
||||
|
||||
@@ -7,7 +7,7 @@ import { localize } from 'vs/nls';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { bootstrapAngular } from 'sql/workbench/services/bootstrap/browser/bootstrapService';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -35,6 +35,7 @@ import { NotebookFindDecorations } from 'sql/workbench/contrib/notebook/browser/
|
||||
import { TimeoutTimer } from 'vs/base/common/async';
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
export class NotebookEditor extends EditorPane implements IFindNotebookController {
|
||||
|
||||
@@ -190,7 +191,7 @@ export class NotebookEditor extends EditorPane implements IFindNotebookControlle
|
||||
}
|
||||
}
|
||||
|
||||
public override async setInput(input: NotebookInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
public override async setInput(input: NotebookInput, options: IEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
if (this.input && this.input.matches(input)) {
|
||||
return Promise.resolve(undefined);
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { localize } from 'vs/nls';
|
||||
import { IWorkbenchContribution } from 'vs/workbench/common/contributions';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { $, toggleClass, Dimension, IFocusTracker, getTotalHeight, prepend } from 'vs/base/browser/dom';
|
||||
import { $, Dimension, IFocusTracker, getTotalHeight, prepend } from 'vs/base/browser/dom';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -381,7 +381,7 @@ export class NotebookExplorerViewPaneContainer extends ViewPaneContainer {
|
||||
}
|
||||
|
||||
override layout(dimension: Dimension): void {
|
||||
toggleClass(this.root, 'narrow', dimension.width <= 300);
|
||||
this.root.classList.toggle('narrow', dimension.width <= 300);
|
||||
super.layout(new Dimension(dimension.width, dimension.height - getTotalHeight(this.searchWidgetsContainerElement)));
|
||||
}
|
||||
|
||||
|
||||
@@ -86,11 +86,11 @@ export class NotebookSearchView extends SearchView {
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IOpenerService openerService: IOpenerService,
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@ICommandService readonly commandService: ICommandService,
|
||||
@ICommandService commandService: ICommandService,
|
||||
@IAdsTelemetryService private _telemetryService: IAdsTelemetryService,
|
||||
) {
|
||||
|
||||
super(options, fileService, editorService, codeEditorService, progressService, notificationService, dialogService, contextViewService, instantiationService, viewDescriptorService, configurationService, contextService, searchWorkbenchService, contextKeyService, replaceService, textFileService, preferencesService, themeService, searchHistoryService, contextMenuService, menuService, accessibilityService, keybindingService, storageService, openerService, telemetryService);
|
||||
super(options, fileService, editorService, codeEditorService, progressService, notificationService, dialogService, commandService, contextViewService, instantiationService, viewDescriptorService, configurationService, contextService, searchWorkbenchService, contextKeyService, replaceService, textFileService, preferencesService, themeService, searchHistoryService, contextMenuService, menuService, accessibilityService, keybindingService, storageService, openerService, telemetryService);
|
||||
|
||||
this.memento = new Memento(this.id, storageService);
|
||||
this.viewletState = this.memento.getMemento(StorageScope.WORKSPACE, StorageTarget.MACHINE);
|
||||
@@ -164,7 +164,7 @@ export class NotebookSearchView extends SearchView {
|
||||
}
|
||||
|
||||
const actionsPosition = this.searchConfig.actionsPosition;
|
||||
dom.toggleClass(this.getContainer(), SearchView.ACTIONS_RIGHT_CLASS_NAME, actionsPosition === 'right');
|
||||
this.getContainer().classList.toggle(SearchView.ACTIONS_RIGHT_CLASS_NAME, actionsPosition === 'right');
|
||||
|
||||
const messagesSize = this.messagesElement.style.display === 'none' ?
|
||||
0 :
|
||||
|
||||
@@ -85,7 +85,7 @@ export class NotebookViewsCellModel extends CellModel {
|
||||
*/
|
||||
public override get outputs(): Array<nb.ICellOutput> {
|
||||
return super.outputs
|
||||
.filter((output: nb.IDisplayResult) => output.data === undefined || output?.data['text/plain'] !== '<IPython.core.display.HTML object>')
|
||||
.filter((output: nb.ICellOutput) => (output as nb.IDisplayResult)?.data === undefined || (output as nb.IDisplayResult)?.data['text/plain'] !== '<IPython.core.display.HTML object>')
|
||||
.map((output: nb.ICellOutput) => ({ ...output }))
|
||||
.map((output: nb.ICellOutput) => { output.metadata = { ...output.metadata }; return output; });
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ import { Component, OnInit, ViewChildren, QueryList, Input, Inject, forwardRef,
|
||||
import { NotebookViewsCardComponent } from 'sql/workbench/contrib/notebook/browser/notebookViews/notebookViewsCard.component';
|
||||
import { ICellModel } from 'sql/workbench/services/notebook/browser/models/modelInterfaces';
|
||||
import { NotebookModel } from 'sql/workbench/services/notebook/browser/models/notebookModel';
|
||||
import { GridStack, GridStackEvent, GridStackNode } from 'gridstack';
|
||||
import { GridItemHTMLElement, GridStack, GridStackEvent, GridStackNode } from 'gridstack';
|
||||
import { localize } from 'vs/nls';
|
||||
import { NotebookViewsExtension } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViewsExtension';
|
||||
import { CellChangeEvent, INotebookView, INotebookViewCell } from 'sql/workbench/services/notebook/browser/notebookViews/notebookViews';
|
||||
@@ -72,9 +72,13 @@ export class NotebookViewsGridComponent extends AngularDisposable implements OnI
|
||||
this._loaded = true;
|
||||
this.detectChanges();
|
||||
|
||||
self._grid.on('added', function (e: Event, items: GridStackNode[]) { if (self._gridEnabled) { self.persist('added', items, self._grid, self._items); } });
|
||||
self._grid.on('removed', function (e: Event, items: GridStackNode[]) { if (self._gridEnabled) { self.persist('removed', items, self._grid, self._items); } });
|
||||
self._grid.on('change', function (e: Event, items: GridStackNode[]) { if (self._gridEnabled) { self.persist('change', items, self._grid, self._items); } });
|
||||
let getGridStackItems = (items: GridStackNode[] | GridItemHTMLElement): GridStackNode[] => {
|
||||
return Array.isArray(items) ? items : (items?.gridstackNode ? [items.gridstackNode] : []);
|
||||
};
|
||||
|
||||
self._grid.on('added', function (e: Event, items: GridStackNode[] | GridItemHTMLElement) { if (self._gridEnabled) { self.persist('added', getGridStackItems(items), self._grid, self._items); } });
|
||||
self._grid.on('removed', function (e: Event, items: GridStackNode[] | GridItemHTMLElement) { if (self._gridEnabled) { self.persist('removed', getGridStackItems(items), self._grid, self._items); } });
|
||||
self._grid.on('change', function (e: Event, items: GridStackNode[] | GridItemHTMLElement) { if (self._gridEnabled) { self.persist('change', getGridStackItems(items), self._grid, self._items); } });
|
||||
}
|
||||
|
||||
ngAfterContentChecked() {
|
||||
|
||||
@@ -40,7 +40,6 @@ import { IQueryModelService } from 'sql/workbench/services/query/common/queryMod
|
||||
import { ActionsOrientation } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { QueryResultId } from 'sql/workbench/services/notebook/browser/models/cell';
|
||||
import { equals } from 'vs/base/common/arrays';
|
||||
import { IDisposableDataProvider } from 'sql/base/common/dataProvider';
|
||||
@@ -481,7 +480,7 @@ export class DataResourceDataProvider implements IGridDataProvider {
|
||||
return result;
|
||||
};
|
||||
|
||||
let serializeRequestParams: SerializeDataParams = <SerializeDataParams>assign(serializer.getBasicSaveParameters(format), <Partial<SerializeDataParams>>{
|
||||
let serializeRequestParams: SerializeDataParams = <SerializeDataParams>Object.assign(serializer.getBasicSaveParameters(format), <Partial<SerializeDataParams>>{
|
||||
saveFormat: format,
|
||||
columns: columns,
|
||||
filePath: filePath.fsPath,
|
||||
|
||||
@@ -15,7 +15,7 @@ import { DataResourceDataProvider } from '../../browser/outputs/gridOutput.compo
|
||||
import { IDataResource } from 'sql/workbench/services/notebook/browser/sql/sqlSessionManager';
|
||||
import { ResultSetSummary } from 'sql/workbench/services/query/common/query';
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { TestFileDialogService, TestEditorService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestFileDialogService, TestEditorService, TestPathService } from 'vs/workbench/test/browser/workbenchTestServices';
|
||||
import { TestContextService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { SerializationService } from 'sql/platform/serialization/common/serializationService';
|
||||
import { SaveFormat, ResultSerializer } from 'sql/workbench/services/query/common/resultSerializer';
|
||||
@@ -47,7 +47,7 @@ export class TestSerializationProvider implements azdata.SerializationProvider {
|
||||
}
|
||||
|
||||
suite('Data Resource Data Provider', function () {
|
||||
let fileDialogService: TypeMoq.Mock<TestFileDialogService>;
|
||||
let fileDialogService: TestFileDialogService;
|
||||
let serializer: ResultSerializer;
|
||||
let notificationService: TestNotificationService;
|
||||
let serializationService: SerializationService;
|
||||
@@ -75,7 +75,8 @@ suite('Data Resource Data Provider', function () {
|
||||
let editorService = TypeMoq.Mock.ofType(TestEditorService, TypeMoq.MockBehavior.Strict);
|
||||
editorService.setup(x => x.openEditor(TypeMoq.It.isAny())).returns(() => Promise.resolve(undefined));
|
||||
let contextService = new TestContextService();
|
||||
fileDialogService = TypeMoq.Mock.ofType(TestFileDialogService, TypeMoq.MockBehavior.Strict);
|
||||
let pathService = new TestPathService();
|
||||
fileDialogService = new TestFileDialogService(pathService);
|
||||
notificationService = new TestNotificationService();
|
||||
serializationService = new SerializationService(undefined, undefined); //_connectionService _capabilitiesService
|
||||
serializationService.registerProvider('testProviderId', new TestSerializationProvider());
|
||||
@@ -84,7 +85,7 @@ suite('Data Resource Data Provider', function () {
|
||||
undefined, // IConfigurationService
|
||||
editorService.object,
|
||||
contextService,
|
||||
fileDialogService.object,
|
||||
fileDialogService,
|
||||
notificationService,
|
||||
undefined // IOpenerService
|
||||
);
|
||||
@@ -108,15 +109,15 @@ suite('Data Resource Data Provider', function () {
|
||||
instantiationService.object
|
||||
);
|
||||
let noHeadersFile = URI.file(path.join(tempFolderPath, 'result_noHeaders.csv'));
|
||||
let fileDialogServiceStub = sinon.stub(fileDialogService.object, 'showSaveDialog').returns(Promise.resolve(noHeadersFile));
|
||||
let serializerStub = sinon.stub(serializer, 'getBasicSaveParameters').returns({ resultFormat: SaveFormat.CSV as string, includeHeaders: false });
|
||||
let fileDialogServiceStub = sinon.stub(fileDialogService, 'showSaveDialog').returns(Promise.resolve(noHeadersFile));
|
||||
let serializerStub = sinon.stub(serializer, 'getBasicSaveParameters').returns(<azdata.SaveResultsRequestParams>{ resultFormat: SaveFormat.CSV as string, includeHeaders: false });
|
||||
await dataResourceDataProvider.serializeResults(SaveFormat.CSV, undefined);
|
||||
fileDialogServiceStub.restore();
|
||||
serializerStub.restore();
|
||||
|
||||
let withHeadersFile = URI.file(path.join(tempFolderPath, 'result_withHeaders.csv'));
|
||||
fileDialogServiceStub = sinon.stub(fileDialogService.object, 'showSaveDialog').returns(Promise.resolve(withHeadersFile));
|
||||
serializerStub = sinon.stub(serializer, 'getBasicSaveParameters').returns({ resultFormat: SaveFormat.CSV as string, includeHeaders: true });
|
||||
fileDialogServiceStub = sinon.stub(fileDialogService, 'showSaveDialog').returns(Promise.resolve(withHeadersFile));
|
||||
serializerStub = sinon.stub(serializer, 'getBasicSaveParameters').returns(<azdata.SaveResultsRequestParams>{ resultFormat: SaveFormat.CSV as string, includeHeaders: true });
|
||||
await dataResourceDataProvider.serializeResults(SaveFormat.CSV, undefined);
|
||||
fileDialogServiceStub.restore();
|
||||
serializerStub.restore();
|
||||
|
||||
@@ -73,7 +73,7 @@ suite('MarkdownTextTransformer', () => {
|
||||
undefined,
|
||||
undefined,
|
||||
);
|
||||
mockNotebookService = TypeMoq.Mock.ofInstance(notebookService);
|
||||
mockNotebookService = TypeMoq.Mock.ofInstance<INotebookService>(notebookService);
|
||||
|
||||
cellModel = new CellModel(undefined, undefined, mockNotebookService.object);
|
||||
notebookEditor = new NotebookEditorStub({ cellGuid: cellModel.cellGuid, instantiationService: instantiationService });
|
||||
|
||||
@@ -577,7 +577,7 @@ suite('Notebook Actions', function (): void {
|
||||
let setOptionsSpy: sinon.SinonSpy;
|
||||
|
||||
setup(async () => {
|
||||
sandbox = sinon.sandbox.create();
|
||||
sandbox = sinon.createSandbox();
|
||||
container = document.createElement('div');
|
||||
contextViewProvider = new ContextViewProviderStub();
|
||||
const instantiationService = <TestInstantiationService>workbenchInstantiationService();
|
||||
|
||||
@@ -44,7 +44,6 @@ import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ICell } from 'vs/workbench/contrib/notebook/common/notebookCommon';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
@@ -58,6 +57,7 @@ import { workbenchInstantiationService } from 'vs/workbench/test/browser/workben
|
||||
import { IProductService } from 'vs/platform/product/common/productService';
|
||||
import { IHostColorSchemeService } from 'vs/workbench/services/themes/common/hostColorSchemeService';
|
||||
import { CellModel } from 'sql/workbench/services/notebook/browser/models/cell';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
class NotebookModelStub extends stubs.NotebookModelStub {
|
||||
public contentChangedEmitter = new Emitter<NotebookContentChange>();
|
||||
@@ -132,7 +132,7 @@ suite('Test class NotebookEditor:', () => {
|
||||
const testNotebookEditor = new NotebookEditorStub({ cellGuid: cellTextEditorGuid, editor: queryTextEditor, model: notebookModel, notebookParams: <INotebookParams>{ notebookUri: untitledNotebookInput.notebookUri } });
|
||||
notebookService.addNotebookEditor(testNotebookEditor);
|
||||
notebookEditor.clearInput();
|
||||
await notebookEditor.setInput(untitledNotebookInput, EditorOptions.create({ pinned: true }), undefined);
|
||||
await notebookEditor.setInput(untitledNotebookInput, { pinned: true }, undefined);
|
||||
untitledNotebookInput.notebookFindModel.notebookModel = undefined; // clear preexisting notebookModel
|
||||
const result = await notebookEditor.getNotebookModel();
|
||||
assert.strictEqual(result, notebookModel, `getNotebookModel() should return the model set in the INotebookEditor object`);
|
||||
@@ -215,7 +215,7 @@ suite('Test class NotebookEditor:', () => {
|
||||
|
||||
test('Tests setInput call with various states of input on a notebookEditor object', async () => {
|
||||
createEditor(notebookEditor);
|
||||
const editorOptions = EditorOptions.create({ pinned: true });
|
||||
const editorOptions: IEditorOptions = { pinned: true };
|
||||
for (const input of [
|
||||
untitledNotebookInput /* set to a known input */,
|
||||
untitledNotebookInput /* tries to set the same input that was previously set */
|
||||
@@ -227,7 +227,7 @@ suite('Test class NotebookEditor:', () => {
|
||||
|
||||
test('Tests setInput call with various states of findState.isRevealed on a notebookEditor object', async () => {
|
||||
createEditor(notebookEditor);
|
||||
const editorOptions = EditorOptions.create({ pinned: true });
|
||||
const editorOptions: IEditorOptions = { pinned: true };
|
||||
for (const isRevealed of [true, false]) {
|
||||
notebookEditor['_findState']['_isRevealed'] = isRevealed;
|
||||
notebookEditor.clearInput();
|
||||
@@ -754,7 +754,7 @@ async function setupNotebookEditor(notebookEditor: NotebookEditor, untitledNoteb
|
||||
}
|
||||
|
||||
async function setInputDocument(notebookEditor: NotebookEditor, untitledNotebookInput: UntitledNotebookInput): Promise<void> {
|
||||
const editorOptions = EditorOptions.create({ pinned: true });
|
||||
const editorOptions: IEditorOptions = { pinned: true };
|
||||
await notebookEditor.setInput(untitledNotebookInput, editorOptions, undefined);
|
||||
assert.strictEqual(notebookEditor.options, editorOptions, 'NotebookEditor options must be the ones that we set');
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import { IExtensionService, NullExtensionService } from 'vs/workbench/services/e
|
||||
import { INotebookService, IProviderInfo } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IUntitledTextEditorService } from 'vs/workbench/services/untitled/common/untitledTextEditorService';
|
||||
import { EditorInputCapabilities } from 'vs/workbench/common/editor';
|
||||
|
||||
suite('Notebook Input', function (): void {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
@@ -64,13 +65,13 @@ suite('Notebook Input', function (): void {
|
||||
|
||||
let inputId = fileNotebookInput.typeId;
|
||||
assert.strictEqual(inputId, FileNotebookInput.ID);
|
||||
assert.strictEqual(fileNotebookInput.isUntitled(), false, 'File Input should not be untitled');
|
||||
assert.strictEqual(fileNotebookInput.hasCapability(EditorInputCapabilities.Untitled), false, 'File Input should not be untitled');
|
||||
});
|
||||
|
||||
test('Untitled Notebook Input', async function (): Promise<void> {
|
||||
let inputId = untitledNotebookInput.typeId;
|
||||
assert.strictEqual(inputId, UntitledNotebookInput.ID);
|
||||
assert.ok(untitledNotebookInput.isUntitled(), 'Untitled Input should be untitled');
|
||||
assert.ok(untitledNotebookInput.hasCapability(EditorInputCapabilities.Untitled), 'Untitled Input should be untitled');
|
||||
});
|
||||
|
||||
test('Getters and Setters', async function (): Promise<void> {
|
||||
|
||||
@@ -164,7 +164,7 @@ suite.skip('NotebookService:', function (): void {
|
||||
notebookService = new NotebookService(lifecycleService, storageService, extensionServiceMock.object, extensionManagementService,
|
||||
instantiationService, fileService, logServiceMock.object, queryManagementService, contextService, productService,
|
||||
editorService, untitledTextEditorService, editorGroupsService, configurationService);
|
||||
sandbox = sinon.sandbox.create();
|
||||
sandbox = sinon.createSandbox();
|
||||
});
|
||||
|
||||
teardown(() => {
|
||||
@@ -412,7 +412,7 @@ suite.skip('NotebookService:', function (): void {
|
||||
id: 'id1'
|
||||
}
|
||||
});
|
||||
const targetMethodSpy = sandbox.spy(notebookService, methodName);
|
||||
const targetMethodSpy = sandbox.spy(notebookService, methodName as keyof NotebookService);
|
||||
didUninstallExtensionEmitter.fire(extensionIdentifier);
|
||||
assert.ok(targetMethodSpy.calledWithExactly(extensionIdentifier.identifier, extensionServiceMock.object), `call arguments to ${methodName} should be ${extensionIdentifier.identifier} & ${extensionServiceMock.object}`);
|
||||
assert.ok(targetMethodSpy.calledOnce, `${methodName} should be called exactly once`);
|
||||
@@ -432,7 +432,7 @@ suite.skip('NotebookService:', function (): void {
|
||||
id: 'id1'
|
||||
}
|
||||
});
|
||||
const targetMethodSpy = sandbox.spy(notebookService, methodName);
|
||||
const targetMethodSpy = sandbox.spy(notebookService, methodName as keyof NotebookService);
|
||||
// the following call will encounter an exception internally with extensionService.getExtensions() returning undefined.
|
||||
didUninstallExtensionEmitter.fire(extensionIdentifier);
|
||||
assert.ok(targetMethodSpy.calledWithExactly(extensionIdentifier.identifier, extensionServiceMock.object), `call arguments to ${methodName} should be ${extensionIdentifier.identifier} & ${extensionServiceMock.object}`);
|
||||
|
||||
@@ -240,8 +240,8 @@ suite('NotebookViewModel', function (): void {
|
||||
function setupServices() {
|
||||
mockSessionManager = TypeMoq.Mock.ofType(SessionManager);
|
||||
notebookManagers[0].sessionManager = mockSessionManager.object;
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType(TestCapabilitiesService);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType<ICapabilitiesService>(TestCapabilitiesService);
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
|
||||
queryConnectionService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
|
||||
|
||||
@@ -73,7 +73,7 @@ suite('Notebook Views Actions', function (): void {
|
||||
let sandbox: sinon.SinonSandbox;
|
||||
|
||||
setup(() => {
|
||||
sandbox = sinon.sandbox.create();
|
||||
sandbox = sinon.createSandbox();
|
||||
setupServices();
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ suite('Notebook Views Actions', function (): void {
|
||||
assert.deepStrictEqual(notebookViews.getActiveView(), newView, 'Active view not set properly');
|
||||
|
||||
const deleteAction = new DeleteViewAction(notebookViews, dialogService, notificationService);
|
||||
sandbox.stub(deleteAction, 'confirmDelete').withArgs(newView).returns(Promise.resolve(true));
|
||||
sandbox.stub(deleteAction, 'confirmDelete' as keyof DeleteViewAction).withArgs(newView).returns(Promise.resolve(true));
|
||||
await deleteAction.run();
|
||||
|
||||
assert.strictEqual(notebookViews.getViews().length, 0, 'View not deleted');
|
||||
@@ -116,7 +116,7 @@ suite('Notebook Views Actions', function (): void {
|
||||
assert.strictEqual(notebookViews.getActiveView(), newView, 'Active view not set properly');
|
||||
|
||||
const deleteAction = new DeleteViewAction(notebookViews, dialogService, notificationService);
|
||||
sandbox.stub(deleteAction, 'confirmDelete').withArgs(newView).returns(Promise.resolve(false));
|
||||
sandbox.stub(deleteAction, 'confirmDelete' as keyof DeleteViewAction).withArgs(newView).returns(Promise.resolve(false));
|
||||
await deleteAction.run();
|
||||
|
||||
assert.strictEqual(notebookViews.getViews().length, 1, 'View should not have deleted');
|
||||
@@ -165,8 +165,8 @@ suite('Notebook Views Actions', function (): void {
|
||||
function setupServices() {
|
||||
mockSessionManager = TypeMoq.Mock.ofType(SessionManager);
|
||||
notebookManagers[0].sessionManager = mockSessionManager.object;
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType(TestCapabilitiesService);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType<ICapabilitiesService>(TestCapabilitiesService);
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
|
||||
queryConnectionService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
|
||||
|
||||
@@ -132,8 +132,8 @@ suite('NotebookViews', function (): void {
|
||||
function setupServices() {
|
||||
mockSessionManager = TypeMoq.Mock.ofType(SessionManager);
|
||||
notebookManagers[0].sessionManager = mockSessionManager.object;
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType(TestCapabilitiesService);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType<ICapabilitiesService>(TestCapabilitiesService);
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
|
||||
queryConnectionService = TypeMoq.Mock.ofType(TestConnectionManagementService, TypeMoq.MockBehavior.Loose, memento.object, undefined, new TestStorageService());
|
||||
|
||||
@@ -19,7 +19,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { InstantiationService } from 'vs/platform/instantiation/common/instantiationService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
|
||||
@@ -741,15 +740,15 @@ suite('Cell Model', function (): void {
|
||||
let content = JSON.stringify(cell.toJSON(), undefined, ' ');
|
||||
let contentSplit = content.split('\n');
|
||||
assert.equal(contentSplit.length, 9);
|
||||
assert(startsWith(contentSplit[0].trim(), '{'));
|
||||
assert(startsWith(contentSplit[1].trim(), '"cell_type": "code",'));
|
||||
assert(startsWith(contentSplit[2].trim(), '"source": ""'));
|
||||
assert(startsWith(contentSplit[3].trim(), '"metadata": {'));
|
||||
assert(startsWith(contentSplit[4].trim(), '"azdata_cell_guid": "'));
|
||||
assert(startsWith(contentSplit[5].trim(), '}'));
|
||||
assert(startsWith(contentSplit[6].trim(), '"outputs": []'));
|
||||
assert(startsWith(contentSplit[7].trim(), '"execution_count": null'));
|
||||
assert(startsWith(contentSplit[8].trim(), '}'));
|
||||
assert(contentSplit[0].trim().startsWith('{'));
|
||||
assert(contentSplit[1].trim().startsWith('"cell_type": "code",'));
|
||||
assert(contentSplit[2].trim().startsWith('"source": ""'));
|
||||
assert(contentSplit[3].trim().startsWith('"metadata": {'));
|
||||
assert(contentSplit[4].trim().startsWith('"azdata_cell_guid": "'));
|
||||
assert(contentSplit[5].trim().startsWith('}'));
|
||||
assert(contentSplit[6].trim().startsWith('"outputs": []'));
|
||||
assert(contentSplit[7].trim().startsWith('"execution_count": null'));
|
||||
assert(contentSplit[8].trim().startsWith('}'));
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ suite('Client Session', function (): void {
|
||||
notebookManager = new NotebookManagerStub();
|
||||
notebookManager.serverManager = serverManager;
|
||||
notebookManager.sessionManager = mockSessionManager.object;
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
|
||||
session = new ClientSession({
|
||||
notebookManager: notebookManager,
|
||||
|
||||
@@ -58,11 +58,11 @@ suite('Local Content Manager', function (): void {
|
||||
override async readFile(resource: URI, options?: IReadFileOptions | undefined): Promise<IFileContent> {
|
||||
const content = await promisify(fs.readFile)(resource.fsPath);
|
||||
|
||||
return { name: ',', size: 0, etag: '', mtime: 0, value: VSBuffer.fromString(content.toString()), resource, ctime: 0 };
|
||||
return { name: ',', size: 0, etag: '', mtime: 0, value: VSBuffer.fromString(content.toString()), resource, ctime: 0, readonly: false };
|
||||
}
|
||||
override async writeFile(resource: URI, bufferOrReadable: VSBuffer | VSBufferReadable, options?: IWriteFileOptions): Promise<IFileStatWithMetadata> {
|
||||
await pfs.writeFile(resource.fsPath, bufferOrReadable.toString());
|
||||
return { resource: resource, mtime: 0, etag: '', size: 0, name: '', isDirectory: false, ctime: 0, isFile: true, isSymbolicLink: false };
|
||||
await pfs.Promises.writeFile(resource.fsPath, bufferOrReadable.toString());
|
||||
return { resource: resource, mtime: 0, etag: '', size: 0, name: '', isDirectory: false, ctime: 0, isFile: true, isSymbolicLink: false, readonly: false };
|
||||
}
|
||||
};
|
||||
instantiationService.set(IFileService, fileService);
|
||||
|
||||
@@ -34,8 +34,6 @@ import { nb } from 'azdata';
|
||||
import { Emitter } from 'vs/base/common/event';
|
||||
import { INotebookEditor, INotebookManager } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { TestInstantiationService } from 'vs/platform/instantiation/test/common/instantiationServiceMock';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { TestStorageService, TestTextResourcePropertiesService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
@@ -172,7 +170,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
|
||||
teardown(() => {
|
||||
if (accessor && accessor.textFileService && accessor.textFileService.files) {
|
||||
(<TextFileEditorModelManager>accessor.textFileService.files).clear();
|
||||
(<TextFileEditorModelManager>accessor.textFileService.files).dispose();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -663,7 +661,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(10 + i * 21), ' ],');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(14 + i * 21), ' "outputs": [');
|
||||
assert.equal(notebookEditorModel.editorModel.textEditorModel.getLineContent(25 + i * 21), ' "execution_count": null');
|
||||
assert(startsWith(notebookEditorModel.editorModel.textEditorModel.getLineContent(26 + i * 21), ' }'));
|
||||
assert(notebookEditorModel.editorModel.textEditorModel.getLineContent(26 + i * 21).startsWith(' }'));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -971,7 +969,7 @@ suite('Notebook Editor Model', function (): void {
|
||||
});
|
||||
|
||||
async function createNewNotebookModel() {
|
||||
let options: INotebookModelOptions = assign({}, defaultModelOptions, <Partial<INotebookModelOptions>><unknown>{
|
||||
let options: INotebookModelOptions = Object.assign({}, defaultModelOptions, <Partial<INotebookModelOptions>><unknown>{
|
||||
factory: mockModelFactory.object
|
||||
});
|
||||
notebookModel = new NotebookModel(options, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService);
|
||||
|
||||
@@ -79,8 +79,8 @@ suite('Notebook Find Model', function (): void {
|
||||
|
||||
setup(async () => {
|
||||
sessionReady = new Deferred<void>();
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType(TestCapabilitiesService);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = TypeMoq.Mock.ofType<ICapabilitiesService>(TestCapabilitiesService);
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny(), TypeMoq.It.isAny()
|
||||
)).returns(() => void 0);
|
||||
@@ -102,7 +102,7 @@ suite('Notebook Find Model', function (): void {
|
||||
layoutChanged: undefined,
|
||||
capabilitiesService: capabilitiesService.object
|
||||
};
|
||||
mockClientSession = TypeMoq.Mock.ofType(ClientSession, undefined, defaultModelOptions);
|
||||
mockClientSession = TypeMoq.Mock.ofType<IClientSession>(ClientSession, undefined, defaultModelOptions);
|
||||
mockClientSession.setup(c => c.initialize()).returns(() => {
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
@@ -29,7 +29,6 @@ import { ServiceCollection } from 'vs/platform/instantiation/common/serviceColle
|
||||
import { NullLogService } from 'vs/platform/log/common/log';
|
||||
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
|
||||
import { isUndefinedOrNull } from 'vs/base/common/types';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { NotebookEditorContentManager } from 'sql/workbench/contrib/notebook/browser/models/notebookInput';
|
||||
import { SessionManager } from 'sql/workbench/contrib/notebook/test/emptySessionClasses';
|
||||
import { mssqlProviderName } from 'sql/platform/connection/common/constants';
|
||||
@@ -38,7 +37,6 @@ import { uriPrefixes } from 'sql/platform/connection/common/utils';
|
||||
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
|
||||
import { TestConfigurationService } from 'sql/platform/connection/test/common/testConfigurationService';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IConnectionProfile } from 'sql/platform/connection/common/interfaces';
|
||||
|
||||
let expectedNotebookContent: nb.INotebookContents = {
|
||||
cells: [{
|
||||
@@ -150,7 +148,7 @@ suite('notebook model', function (): void {
|
||||
mockSessionManager = TypeMoq.Mock.ofType(SessionManager);
|
||||
notebookManagers[0].sessionManager = mockSessionManager.object;
|
||||
sessionReady = new Deferred<void>();
|
||||
notificationService = TypeMoq.Mock.ofType(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
notificationService = TypeMoq.Mock.ofType<INotificationService>(TestNotificationService, TypeMoq.MockBehavior.Loose);
|
||||
capabilitiesService = new TestCapabilitiesService();
|
||||
memento = TypeMoq.Mock.ofType(Memento, TypeMoq.MockBehavior.Loose, '');
|
||||
memento.setup(x => x.getMemento(TypeMoq.It.isAny(), TypeMoq.It.isAny())).returns(() => void 0);
|
||||
@@ -747,13 +745,13 @@ suite('notebook model', function (): void {
|
||||
assert(!isUndefinedOrNull(model.context), 'context should exist after call to change context');
|
||||
|
||||
let notebookKernelAlias = model.context.serverCapabilities.notebookKernelAlias;
|
||||
let doChangeKernelStub = sinon.spy(model, 'doChangeKernel').withArgs(model.kernelAliases[0]);
|
||||
let doChangeKernelStub = sinon.spy(model, 'doChangeKernel' as keyof NotebookModel);
|
||||
|
||||
model.changeKernel(notebookKernelAlias);
|
||||
assert.equal(model.selectedKernelDisplayName, notebookKernelAlias);
|
||||
assert.equal(model.currentKernelAlias, notebookKernelAlias);
|
||||
sinon.assert.called(doChangeKernelStub);
|
||||
sinon.restore(doChangeKernelStub);
|
||||
sinon.assert.calledWith(doChangeKernelStub, model.kernelAliases[0]);
|
||||
doChangeKernelStub.restore();
|
||||
|
||||
// After closing the notebook
|
||||
await model.handleClosed();
|
||||
@@ -774,14 +772,14 @@ suite('notebook model', function (): void {
|
||||
assert(!isUndefinedOrNull(model.context), 'context should exist after call to change context');
|
||||
|
||||
let notebookKernelAlias = model.context.serverCapabilities.notebookKernelAlias;
|
||||
let doChangeKernelStub = sinon.spy(model, 'doChangeKernel');
|
||||
let doChangeKernelStub = sinon.spy(model, 'doChangeKernel' as keyof NotebookModel);
|
||||
|
||||
// Change kernel first to alias kernel and then connect to SQL connection
|
||||
model.changeKernel(notebookKernelAlias);
|
||||
assert.equal(model.selectedKernelDisplayName, notebookKernelAlias);
|
||||
assert.equal(model.currentKernelAlias, notebookKernelAlias);
|
||||
sinon.assert.called(doChangeKernelStub);
|
||||
sinon.restore(doChangeKernelStub);
|
||||
doChangeKernelStub.restore();
|
||||
|
||||
// Change to SQL connection from Fake connection
|
||||
await changeContextWithConnectionProfile(model);
|
||||
@@ -790,7 +788,7 @@ suite('notebook model', function (): void {
|
||||
assert.equal(model.selectedKernelDisplayName, expectedKernel);
|
||||
assert.equal(model.currentKernelAlias, undefined);
|
||||
sinon.assert.called(doChangeKernelStub);
|
||||
sinon.restore(doChangeKernelStub);
|
||||
doChangeKernelStub.restore();
|
||||
|
||||
// After closing the notebook
|
||||
await model.handleClosed();
|
||||
@@ -815,7 +813,7 @@ suite('notebook model', function (): void {
|
||||
defaultModelOptions.contentManager = mockContentManager.object;
|
||||
|
||||
// And a matching connection profile
|
||||
let expectedConnectionProfile: IConnectionProfile = {
|
||||
let expectedConnectionProfile = <ConnectionProfile>{
|
||||
connectionName: connectionName,
|
||||
serverName: '',
|
||||
databaseName: '',
|
||||
@@ -915,7 +913,7 @@ suite('notebook model', function (): void {
|
||||
sessionReady.resolve();
|
||||
let actualSession: IClientSession = undefined;
|
||||
|
||||
let options: INotebookModelOptions = assign({}, defaultModelOptions, <Partial<INotebookModelOptions>>{
|
||||
let options: INotebookModelOptions = Object.assign({}, defaultModelOptions, <Partial<INotebookModelOptions>>{
|
||||
factory: mockModelFactory.object
|
||||
});
|
||||
let model = new NotebookModel(options, undefined, logService, undefined, new NullAdsTelemetryService(), queryConnectionService.object, configurationService, capabilitiesService);
|
||||
|
||||
@@ -39,7 +39,7 @@ suite('ServerTreeView onAddConnectionProfile handler tests', () => {
|
||||
mockConnectionManagementService.setup(x => x.getConnectionGroups()).returns(x => []);
|
||||
mockConnectionManagementService.setup(x => x.hasRegisteredServers()).returns(() => true);
|
||||
serverTreeView = new ServerTreeView(mockConnectionManagementService.object, instantiationService, undefined, new TestThemeService(), undefined, undefined, capabilitiesService, undefined, undefined, new MockContextKeyService());
|
||||
mockTree = TypeMoq.Mock.ofType(TestTree);
|
||||
mockTree = TypeMoq.Mock.ofType<ITree>(TestTree);
|
||||
(serverTreeView as any)._tree = mockTree.object;
|
||||
mockRefreshTreeMethod = TypeMoq.Mock.ofType(Function);
|
||||
mockRefreshTreeMethod.setup(x => x()).returns(() => Promise.resolve());
|
||||
|
||||
@@ -24,7 +24,7 @@ import { URI } from 'vs/base/common/uri';
|
||||
import { Schemas } from 'vs/base/common/network';
|
||||
import * as nls from 'vs/nls';
|
||||
import { IModelService } from 'vs/editor/common/services/modelService';
|
||||
import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { DisposableStore, IDisposable } from 'vs/base/common/lifecycle';
|
||||
import { Command } from 'vs/editor/browser/editorExtensions';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { KeyMod, KeyCode } from 'vs/base/common/keyCodes';
|
||||
@@ -39,7 +39,6 @@ import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { IView, SplitView, Sizing } from 'vs/base/browser/ui/splitview/splitview';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { EditorPane } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { EditorOptions } from 'vs/workbench/common/editor';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IWorkbenchThemeService, VS_DARK_THEME, VS_HC_THEME } from 'vs/workbench/services/themes/common/workbenchThemeService';
|
||||
import { IInstantiationService, ServicesAccessor } from 'vs/platform/instantiation/common/instantiation';
|
||||
@@ -53,6 +52,8 @@ import { ITextResourcePropertiesService } from 'vs/editor/common/services/textRe
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { attachTabbedPanelStyler } from 'sql/workbench/common/styler';
|
||||
import { UntitledTextEditorModel } from 'vs/workbench/services/untitled/common/untitledTextEditorModel';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
import { IEditorGroup, IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
|
||||
class BasicView implements IView {
|
||||
public get element(): HTMLElement {
|
||||
@@ -155,6 +156,7 @@ export class ProfilerEditor extends EditorPane {
|
||||
|
||||
private _savedTableViewStates = new Map<ProfilerInput, ProfilerTableViewState>();
|
||||
|
||||
private readonly _disposables = new DisposableStore();
|
||||
constructor(
|
||||
@ITelemetryService telemetryService: ITelemetryService,
|
||||
@IWorkbenchThemeService themeService: IWorkbenchThemeService,
|
||||
@@ -166,23 +168,34 @@ export class ProfilerEditor extends EditorPane {
|
||||
@IEditorService editorService: IEditorService,
|
||||
@IStorageService storageService: IStorageService,
|
||||
@IClipboardService private _clipboardService: IClipboardService,
|
||||
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService
|
||||
@ITextResourcePropertiesService private readonly textResourcePropertiesService: ITextResourcePropertiesService,
|
||||
@IEditorGroupsService editorGroupsService: IEditorGroupsService
|
||||
) {
|
||||
super(ProfilerEditor.ID, telemetryService, themeService, storageService);
|
||||
this._profilerEditorContextKey = CONTEXT_PROFILER_EDITOR.bindTo(this._contextKeyService);
|
||||
|
||||
if (editorService) {
|
||||
editorService.overrideOpenEditor({
|
||||
open: (editor, options, group) => {
|
||||
if (this.isVisible() && (editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
return {};
|
||||
}
|
||||
});
|
||||
if (editorGroupsService) {
|
||||
// Add all the initial groups to be listened to
|
||||
editorGroupsService.whenReady.then(() => editorGroupsService.groups.forEach(group => {
|
||||
this.registerGroupListener(group);
|
||||
}));
|
||||
|
||||
// Additional groups added should also be listened to
|
||||
this._register(editorGroupsService.onDidAddGroup((group) => this.registerGroupListener(group)));
|
||||
|
||||
this._register(this._disposables);
|
||||
}
|
||||
}
|
||||
|
||||
private registerGroupListener(group: IEditorGroup): void {
|
||||
const listener = group.onWillOpenEditor(e => {
|
||||
if (this.isVisible() && (e.editor !== this.input || group !== this.group)) {
|
||||
this.saveEditorViewState();
|
||||
}
|
||||
});
|
||||
this._disposables.add(listener);
|
||||
}
|
||||
|
||||
protected createEditor(parent: HTMLElement): void {
|
||||
this._container = document.createElement('div');
|
||||
this._container.className = 'carbon-profiler';
|
||||
@@ -307,7 +320,7 @@ export class ProfilerEditor extends EditorPane {
|
||||
profilerTableContainer.classList.add(VS_HC_THEME);
|
||||
}
|
||||
this.themeService.onDidColorThemeChange(e => {
|
||||
DOM.removeClasses(profilerTableContainer, VS_DARK_THEME, VS_HC_THEME);
|
||||
profilerTableContainer.classList.remove(VS_DARK_THEME, VS_HC_THEME);
|
||||
if (e.type === ColorScheme.DARK) {
|
||||
profilerTableContainer.classList.add(VS_DARK_THEME);
|
||||
} else if (e.type === ColorScheme.HIGH_CONTRAST) {
|
||||
@@ -447,7 +460,7 @@ export class ProfilerEditor extends EditorPane {
|
||||
return this._input as ProfilerInput;
|
||||
}
|
||||
|
||||
public override setInput(input: ProfilerInput, options?: EditorOptions): Promise<void> {
|
||||
public override setInput(input: ProfilerInput, options?: IEditorOptions): Promise<void> {
|
||||
let savedViewState = this._savedTableViewStates.get(input);
|
||||
|
||||
this._profilerEditorContextKey.set(true);
|
||||
|
||||
@@ -127,9 +127,9 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
|
||||
if (FIND_WIDGET_INITIAL_WIDTH + 28 - MAX_MATCHES_COUNT_WIDTH >= editorWidth + 50) {
|
||||
collapsedFindWidget = true;
|
||||
}
|
||||
dom.toggleClass(this._domNode, 'collapsed-find-widget', collapsedFindWidget);
|
||||
dom.toggleClass(this._domNode, 'narrow-find-widget', narrowFindWidget);
|
||||
dom.toggleClass(this._domNode, 'reduced-find-widget', reducedFindWidget);
|
||||
this._domNode.classList.toggle('collapsed-find-widget', collapsedFindWidget);
|
||||
this._domNode.classList.toggle('narrow-find-widget', narrowFindWidget);
|
||||
this._domNode.classList.toggle('reduced-find-widget', reducedFindWidget);
|
||||
|
||||
if (!narrowFindWidget && !collapsedFindWidget) {
|
||||
// the minimal left offset of findwidget is 15px.
|
||||
@@ -204,7 +204,7 @@ export class FindWidget extends Widget implements IOverlayWidget, IVerticalSashL
|
||||
}
|
||||
if (e.searchString || e.matchesCount || e.matchesPosition) {
|
||||
let showRedOutline = (this._state.searchString.length > 0 && this._state.matchesCount === 0);
|
||||
dom.toggleClass(this._domNode, 'no-results', showRedOutline);
|
||||
this._domNode.classList.toggle('no-results', showRedOutline);
|
||||
|
||||
this._updateMatchesCount();
|
||||
}
|
||||
@@ -552,7 +552,7 @@ class SimpleButton extends Widget {
|
||||
}
|
||||
|
||||
public setEnabled(enabled: boolean): void {
|
||||
dom.toggleClass(this._domNode, 'disabled', !enabled);
|
||||
this._domNode.classList.toggle('disabled', !enabled);
|
||||
this._domNode.setAttribute('aria-disabled', String(!enabled));
|
||||
this._domNode.tabIndex = enabled ? 0 : -1;
|
||||
}
|
||||
@@ -562,6 +562,6 @@ class SimpleButton extends Widget {
|
||||
}
|
||||
|
||||
public toggleClass(className: string, shouldHaveIt: boolean): void {
|
||||
dom.toggleClass(this._domNode, className, shouldHaveIt);
|
||||
this._domNode.classList.toggle(className, shouldHaveIt);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import { IEditorOptions } from 'vs/editor/common/config/editorOptions';
|
||||
import * as nls from 'vs/nls';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import { ResourceEditorModel } from 'vs/workbench/common/editor/resourceEditorModel';
|
||||
import { TextResourceEditorModel } from 'vs/workbench/common/editor/textResourceEditorModel';
|
||||
import * as editorCommon from 'vs/editor/common/editorCommon';
|
||||
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
@@ -15,12 +15,13 @@ import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { IStorageService } from 'vs/platform/storage/common/storage';
|
||||
import { ITextResourceConfigurationService } from 'vs/editor/common/services/textResourceConfigurationService';
|
||||
import { EditorOptions, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { CancellationToken } from 'vs/base/common/cancellation';
|
||||
import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { CodeEditorWidget } from 'vs/editor/browser/widget/codeEditorWidget';
|
||||
import { ITextEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
class ProfilerResourceCodeEditor extends CodeEditorWidget {
|
||||
|
||||
@@ -75,9 +76,9 @@ export class ProfilerResourceEditor extends BaseTextEditor {
|
||||
return options;
|
||||
}
|
||||
|
||||
override async setInput(input: UntitledTextEditorInput, options: EditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
override async setInput(input: UntitledTextEditorInput, options: ITextEditorOptions, context: IEditorOpenContext): Promise<void> {
|
||||
await super.setInput(input, options, context, CancellationToken.None);
|
||||
const editorModel = await this.input.resolve() as ResourceEditorModel;
|
||||
const editorModel = await this.input.resolve() as TextResourceEditorModel;
|
||||
await editorModel.resolve();
|
||||
this.getControl().setModel(editorModel.textEditorModel);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ export class ProfilerTableEditor extends EditorPane implements IProfilerControll
|
||||
: localize('ProfilerTableEditor.eventCount', "Events: {0}", this._input.data.getLength());
|
||||
|
||||
this._disposeStatusbarItem();
|
||||
this._statusbarItem = this._statusbarService.addEntry({ text: message, ariaLabel: message }, 'status.eventCount', localize('status.eventCount', "Event Count"), StatusbarAlignment.RIGHT);
|
||||
this._statusbarItem = this._statusbarService.addEntry({ name: localize('status.eventCount', "Event Count"), text: message, ariaLabel: message }, 'status.eventCount', StatusbarAlignment.RIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResult
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
import { IQueryModelService } from 'sql/workbench/services/query/common/queryModel';
|
||||
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IMoveResult, GroupIdentifier } from 'vs/workbench/common/editor';
|
||||
import { BinaryEditorModel } from 'vs/workbench/common/editor/binaryEditorModel';
|
||||
@@ -62,6 +62,7 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
private statusItem: IStatusbarEntryAccessor;
|
||||
|
||||
private _sqlStatusEditors: { [editorUri: string]: SqlProviderEntry };
|
||||
private readonly name = nls.localize('status.query.flavor', "SQL Language Flavor");
|
||||
|
||||
constructor(
|
||||
@IStatusbarService private readonly statusbarService: IStatusbarService,
|
||||
@@ -73,12 +74,12 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
|
||||
this.statusItem = this._register(
|
||||
this.statusbarService.addEntry({
|
||||
name: this.name,
|
||||
text: nls.localize('changeProvider', "Change SQL language provider"),
|
||||
ariaLabel: nls.localize('changeProvider', "Change SQL language provider"),
|
||||
command: 'sql.action.editor.changeProvider'
|
||||
},
|
||||
SqlFlavorStatusbarItem.ID,
|
||||
nls.localize('status.query.flavor', "SQL Language Flavor"),
|
||||
StatusbarAlignment.RIGHT, 100)
|
||||
);
|
||||
|
||||
@@ -160,7 +161,8 @@ export class SqlFlavorStatusbarItem extends Disposable implements IWorkbenchCont
|
||||
|
||||
private updateFlavorElement(text: string): void {
|
||||
const props: IStatusbarEntry = {
|
||||
text,
|
||||
name: this.name,
|
||||
text: text,
|
||||
ariaLabel: text,
|
||||
command: 'sql.action.editor.changeProvider'
|
||||
};
|
||||
|
||||
@@ -15,7 +15,7 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { WorkbenchDataTree } from 'vs/platform/list/browser/listService';
|
||||
import { isArray, isString } from 'vs/base/common/types';
|
||||
import { Disposable, DisposableStore, dispose } from 'vs/base/common/lifecycle';
|
||||
import { $, Dimension, createStyleSheet, addStandardDisposableGenericMouseDownListner, toggleClass } from 'vs/base/browser/dom';
|
||||
import { $, Dimension, createStyleSheet, addStandardDisposableGenericMouseDownListner } from 'vs/base/browser/dom';
|
||||
import { resultsErrorColor } from 'sql/platform/theme/common/colors';
|
||||
import { CachedListVirtualDelegate, IIdentityProvider } from 'vs/base/browser/ui/list/list';
|
||||
import { FuzzyScore } from 'vs/base/common/filters';
|
||||
@@ -34,7 +34,6 @@ import { IDataTreeViewState } from 'vs/base/browser/ui/tree/dataTree';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
|
||||
import { push } from 'vs/base/common/arrays';
|
||||
|
||||
export interface IResultMessageIntern {
|
||||
id?: string;
|
||||
@@ -109,7 +108,7 @@ export class MessagePanel extends Disposable {
|
||||
) {
|
||||
super();
|
||||
const wordWrap = this.configurationService.getValue<IQueryEditorConfiguration>('queryEditor').messages.wordwrap;
|
||||
toggleClass(this.container, 'word-wrap', wordWrap);
|
||||
this.container.classList.toggle('word-wrap', wordWrap);
|
||||
this.tree = <WorkbenchDataTree<Model, IResultMessageIntern, FuzzyScore>>instantiationService.createInstance(
|
||||
WorkbenchDataTree,
|
||||
'MessagePanel',
|
||||
@@ -202,7 +201,7 @@ export class MessagePanel extends Disposable {
|
||||
|
||||
private onMessage(message: IQueryMessage | IQueryMessage[], setInput: boolean = false) {
|
||||
if (isArray(message)) {
|
||||
push(this.model.messages, message);
|
||||
this.model.messages.push(...message);
|
||||
} else {
|
||||
this.model.messages.push(message);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ import { LifecyclePhase } from 'vs/workbench/services/lifecycle/common/lifecycle
|
||||
import { TimeElapsedStatusBarContributions, RowCountStatusBarContributions, QueryStatusStatusBarContributions, QueryResultSelectionSummaryStatusBarContribution } from 'sql/workbench/contrib/query/browser/statusBarItems';
|
||||
import { SqlFlavorStatusbarItem, ChangeFlavorAction } from 'sql/workbench/contrib/query/browser/flavorStatus';
|
||||
import { EditorExtensions, IEditorInputFactoryRegistry } from 'vs/workbench/common/editor';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileQueryEditorInputSerializer, QueryEditorLanguageAssociation, UntitledQueryEditorInputSerializer } from 'sql/workbench/contrib/query/browser/queryInputFactory';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { ILanguageAssociationRegistry, Extensions as LanguageAssociationExtensions } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
@@ -43,7 +43,7 @@ import { ItemContextKey } from 'sql/workbench/contrib/dashboard/browser/widgets/
|
||||
import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { Disposable, DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IModeService } from 'vs/editor/common/services/modeService';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { IEditorOverrideService, ContributedEditorPriority } from 'vs/workbench/services/editor/common/editorOverrideService';
|
||||
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
@@ -523,7 +523,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
// Create the selector from the list of all the language extensions we want to associate with the
|
||||
// query editor (filtering out any languages which didn't have any extensions registered yet)
|
||||
const selector = `*{${langExtensions.join(',')}}`;
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerContributionPoint(
|
||||
this._registeredOverrides.add(this._editorOverrideService.registerEditor(
|
||||
selector,
|
||||
{
|
||||
id: QueryEditor.ID,
|
||||
@@ -537,7 +537,7 @@ export class QueryEditorOverrideContribution extends Disposable implements IWork
|
||||
resource: resource
|
||||
}) as FileEditorInput;
|
||||
const langAssociation = languageAssociationRegistry.getAssociationForLanguage(lang);
|
||||
const queryEditorInput = langAssociation?.syncConvertinput?.(fileInput);
|
||||
const queryEditorInput = langAssociation?.syncConvertInput?.(fileInput);
|
||||
if (!queryEditorInput) {
|
||||
this._logService.warn('Unable to create input for overriding editor ', resource);
|
||||
return undefined;
|
||||
|
||||
@@ -8,7 +8,7 @@ import 'vs/css!./media/queryEditor';
|
||||
import { localize } from 'vs/nls';
|
||||
import * as DOM from 'vs/base/browser/dom';
|
||||
import * as path from 'vs/base/common/path';
|
||||
import { EditorOptions, IEditorControl, IEditorMemento, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { IEditorControl, IEditorMemento, IEditorOpenContext } from 'vs/workbench/common/editor';
|
||||
import { EditorPane, EditorMemento } from 'vs/workbench/browser/parts/editor/editorPane';
|
||||
import { Orientation } from 'vs/base/browser/ui/sash/sash';
|
||||
import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry';
|
||||
@@ -28,7 +28,7 @@ import { DisposableStore } from 'vs/base/common/lifecycle';
|
||||
import { IAction } from 'vs/base/common/actions';
|
||||
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
|
||||
import { BaseTextEditor } from 'vs/workbench/browser/parts/editor/textEditor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { IFileService, FileChangesEvent } from 'vs/platform/files/common/files';
|
||||
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
|
||||
@@ -41,6 +41,7 @@ import * as actions from 'sql/workbench/contrib/query/browser/queryActions';
|
||||
import { IRange } from 'vs/editor/common/core/range';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { IActionViewItem } from 'vs/base/browser/ui/actionbar/actionbar';
|
||||
import { IEditorOptions } from 'vs/platform/editor/common/editor';
|
||||
|
||||
const QUERY_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'queryEditorViewState';
|
||||
|
||||
@@ -337,7 +338,7 @@ export class QueryEditor extends EditorPane {
|
||||
this.taskbar.setContent(content);
|
||||
}
|
||||
|
||||
public override async setInput(newInput: QueryEditorInput, options: EditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
public override async setInput(newInput: QueryEditorInput, options: IEditorOptions, context: IEditorOpenContext, token: CancellationToken): Promise<void> {
|
||||
const oldInput = this.input;
|
||||
|
||||
if (newInput.matches(oldInput)) {
|
||||
@@ -513,7 +514,7 @@ export class QueryEditor extends EditorPane {
|
||||
return this.currentTextEditor.getControl();
|
||||
}
|
||||
|
||||
public override setOptions(options: EditorOptions): void {
|
||||
public override setOptions(options: IEditorOptions): void {
|
||||
this.currentTextEditor.setOptions(options);
|
||||
}
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ import { IInstantiationService } from 'vs/platform/instantiation/common/instanti
|
||||
import { QueryResultsInput } from 'sql/workbench/common/editor/query/queryResultsInput';
|
||||
import { FILE_EDITOR_INPUT_ID } from 'vs/workbench/contrib/files/common/files';
|
||||
import { UntitledQueryEditorInput } from 'sql/workbench/common/editor/query/untitledQueryEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/common/fileQueryEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { FileQueryEditorInput } from 'sql/workbench/contrib/query/browser/fileQueryEditorInput';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/browser/editors/fileEditorInput';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
import { ILanguageAssociation } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { QueryEditorInput } from 'sql/workbench/common/editor/query/queryEditorInput';
|
||||
@@ -71,7 +71,7 @@ export class QueryEditorLanguageAssociation implements ILanguageAssociation {
|
||||
return queryEditorInput;
|
||||
}
|
||||
|
||||
syncConvertinput(activeEditor: IEditorInput): QueryEditorInput | undefined {
|
||||
syncConvertInput(activeEditor: IEditorInput): QueryEditorInput | undefined {
|
||||
const queryResultsInput = this.instantiationService.createInstance(QueryResultsInput, activeEditor.resource.toString(true));
|
||||
let queryEditorInput: QueryEditorInput;
|
||||
if (activeEditor instanceof FileEditorInput) {
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user