Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3 (#12295)

* Merge from vscode fcf3346a8e9f5ee1e00674461d9e2c2292a14ee3

* Fix test build break

* Update distro

* Fix build errors

* Update distro

* Update REH build file

* Update build task names for REL

* Fix product build yaml

* Fix product REH task name

* Fix type in task name

* Update linux build step

* Update windows build tasks

* Turn off server publish

* Disable REH

* Fix typo

* Bump distro

* Update vscode tests

* Bump distro

* Fix type in disto

* Bump distro

* Turn off docker build

* Remove docker step from release

Co-authored-by: ADS Merger <andresse@microsoft.com>
Co-authored-by: Karl Burtram <karlb@microsoft.com>
This commit is contained in:
Christopher Suh
2020-10-03 14:42:05 -04:00
committed by GitHub
parent 58d02b76db
commit 6ff1e3866b
687 changed files with 10507 additions and 9104 deletions

View File

@@ -20,7 +20,6 @@ import { Deferred } from 'sql/base/common/promise';
import { localize } from 'vs/nls';
import { IOpenerService } from 'vs/platform/opener/common/opener';
import { URI } from 'vs/base/common/uri';
import { firstIndex } from 'vs/base/common/arrays';
import { values } from 'vs/base/common/collections';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
@@ -185,7 +184,7 @@ export class AccountManagementService implements IAccountManagementService {
}
if (result.accountModified) {
// Find the updated account and splice the updated on in
let indexToRemove: number = firstIndex(provider.accounts, account => {
let indexToRemove: number = provider.accounts.findIndex(account => {
return account.key.accountId === result.changedAccount!.key.accountId;
});
if (indexToRemove >= 0) {
@@ -275,7 +274,7 @@ export class AccountManagementService implements IAccountManagementService {
return result;
}
let indexToRemove: number = firstIndex(provider.accounts, account => {
let indexToRemove: number = provider.accounts.findIndex(account => {
return account.key.accountId === accountKey.accountId;
});
@@ -473,7 +472,7 @@ export class AccountManagementService implements IAccountManagementService {
private spliceModifiedAccount(provider: AccountProviderWithMetadata, modifiedAccount: azdata.Account) {
// Find the updated account and splice the updated one in
let indexToRemove: number = firstIndex(provider.accounts, account => {
let indexToRemove: number = provider.accounts.findIndex(account => {
return account.key.accountId === modifiedAccount.key.accountId;
});
if (indexToRemove >= 0) {

View File

@@ -24,7 +24,6 @@ import { attachDropdownStyler } from 'sql/platform/theme/common/styler';
import { AddAccountAction, RefreshAccountAction } from 'sql/platform/accounts/common/accountActions';
import { AccountPickerListRenderer, AccountListDelegate } from 'sql/workbench/services/accountManagement/browser/accountListRenderer';
import { AccountPickerViewModel } from 'sql/platform/accounts/common/accountPickerViewModel';
import { firstIndex } from 'vs/base/common/arrays';
import { Tenant, TenantListDelegate, TenantPickerListRenderer } from 'sql/workbench/services/accountManagement/browser/tenantListRenderer';
export class AccountPicker extends Disposable {
@@ -304,7 +303,7 @@ export class AccountPicker extends Disposable {
// find selected index
let selectedIndex: number | undefined;
if (selectedElements.length > 0 && accounts.length > 0) {
selectedIndex = firstIndex(accounts, (account) => {
selectedIndex = accounts.findIndex(account => {
return (account.key.accountId === selectedElements[0].key.accountId);
});
}

View File

@@ -17,7 +17,6 @@ import { EditDataInput } from 'sql/workbench/browser/editData/editDataInput';
import { DashboardInput } from 'sql/workbench/browser/editor/profiler/dashboardInput';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IQuickInputService } from 'vs/platform/quickinput/common/quickInput';
import { find } from 'vs/base/common/arrays';
/**
* Workbench action to clear the recent connnections list
@@ -83,7 +82,7 @@ export class ClearRecentConnectionsAction extends Action {
];
self._quickInputService.pick(choices.map(x => x.key), { placeHolder: nls.localize('ClearRecentlyUsedLabel', "Clear List"), ignoreFocusLost: true }).then((choice) => {
let confirm = find(choices, x => x.key === choice);
let confirm = choices.find(x => x.key === choice);
resolve(confirm && confirm.value);
});
});

View File

@@ -18,7 +18,6 @@ import { IServerGroupController } from 'sql/platform/serverGroup/common/serverGr
import { ILogService } from 'vs/platform/log/common/log';
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
import { assign } from 'vs/base/common/objects';
import { find } from 'vs/base/common/arrays';
export class ConnectionController implements IConnectionComponentController {
private _advancedController: AdvancedPropertiesController;
@@ -166,7 +165,7 @@ export class ConnectionController implements IConnectionComponentController {
this._connectionWidget.updateServerGroup(this.getAllServerGroups(providers));
this._model = connectionInfo;
this._model.providerName = this._providerName;
let appNameOption = find(this._providerOptions, option => option.specialValueType === ConnectionOptionSpecialType.appName);
let appNameOption = this._providerOptions.find(option => option.specialValueType === ConnectionOptionSpecialType.appName);
if (appNameOption) {
let appNameKey = appNameOption.name;
this._model.options[appNameKey] = Constants.applicationName;

View File

@@ -29,7 +29,6 @@ import { localize } from 'vs/nls';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { CmsConnectionController } from 'sql/workbench/services/connection/browser/cmsConnectionController';
import { entries } from 'sql/base/common/collections';
import { find } from 'vs/base/common/arrays';
import { onUnexpectedError } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
@@ -316,7 +315,7 @@ export class ConnectionDialogService implements IConnectionDialogService {
}
if (!isProviderInParams) {
let uniqueProvidersMap = this._connectionManagementService.getUniqueConnectionProvidersByNameMap(this._providerNameToDisplayNameMap);
this._currentProviderType = find(Object.keys(uniqueProvidersMap), (key) => uniqueProvidersMap[key] === input.selectedProviderDisplayName);
this._currentProviderType = Object.keys(uniqueProvidersMap).find((key) => uniqueProvidersMap[key] === input.selectedProviderDisplayName);
}
}
this._model.providerName = this._currentProviderType;

View File

@@ -45,7 +45,6 @@ import { Memento } from 'vs/workbench/common/memento';
import { IEnvironmentService } from 'vs/platform/environment/common/environment';
import { INotificationService } from 'vs/platform/notification/common/notification';
import { entries } from 'sql/base/common/collections';
import { find } from 'vs/base/common/arrays';
import { values } from 'vs/base/common/collections';
import { assign } from 'vs/base/common/objects';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
@@ -795,7 +794,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
return AzureResource.Sql;
}
let result = find(ConnectionManagementService._azureResources, r => AzureResource[r] === provider.properties.azureResource);
let result = ConnectionManagementService._azureResources.find(r => AzureResource[r] === provider.properties.azureResource);
return result ? result : AzureResource.Sql;
}
@@ -814,7 +813,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
const azureAccounts = accounts.filter(a => a.key.providerId.startsWith('azure'));
if (azureAccounts && azureAccounts.length > 0) {
let accountId = (connection.authenticationType === Constants.azureMFA || connection.authenticationType === Constants.azureMFAAndUser) ? connection.azureAccount : connection.userName;
let account = find(azureAccounts, account => account.key.accountId === accountId);
let account = azureAccounts.find(account => account.key.accountId === accountId);
if (account) {
this._logService.debug(`Getting security token for Azure account ${account.key.accountId}`);
if (account.isStale) {
@@ -1094,7 +1093,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
];
return this._quickInputService.pick(choices.map(x => x.key), { placeHolder: nls.localize('cancelConnectionConfirmation', "Are you sure you want to cancel this connection?"), ignoreFocusLost: true }).then((choice) => {
let confirm = find(choices, x => x.key === choice);
let confirm = choices.find(x => x.key === choice);
return confirm && confirm.value;
});
}
@@ -1350,10 +1349,10 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
public async getConnectionCredentials(profileId: string): Promise<{ [name: string]: string }> {
let profile = find(this.getActiveConnections(), connectionProfile => connectionProfile.id === profileId);
let profile = this.getActiveConnections().find(connectionProfile => connectionProfile.id === profileId);
if (!profile) {
// Couldn't find an active profile so try all profiles now - fetching the password if we found one
profile = find(this.getConnections(), connectionProfile => connectionProfile.id === profileId);
profile = this.getConnections().find(connectionProfile => connectionProfile.id === profileId);
if (!profile) {
return undefined;
}
@@ -1361,7 +1360,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
}
// Find the password option for the connection provider
let passwordOption = find(this._capabilitiesService.getCapabilities(profile.providerName).connection.connectionOptions,
let passwordOption = this._capabilitiesService.getCapabilities(profile.providerName).connection.connectionOptions.find(
option => option.specialValueType === ConnectionOptionSpecialType.password);
if (!passwordOption) {
return undefined;
@@ -1449,7 +1448,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
const connections = this.getActiveConnections();
const connectionExists: (conn: ConnectionProfile) => boolean = (conn) => {
return find(connections, existingConnection => existingConnection.id === conn.id) !== undefined;
return connections.find(existingConnection => existingConnection.id === conn.id) !== undefined;
};
if (!activeConnectionsOnly) {

View File

@@ -35,7 +35,6 @@ import { endsWith, startsWith } from 'vs/base/common/strings';
import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService';
import { IConfigurationService } from 'vs/platform/configuration/common/configuration';
import { ILogService } from 'vs/platform/log/common/log';
import { find } from 'vs/base/common/arrays';
export enum AuthenticationType {
SqlLogin = 'SqlLogin',
@@ -136,7 +135,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
protected getAuthTypeDefault(option: azdata.ConnectionOption, os: OperatingSystem): string {
// Check for OS-specific default value
if (option.defaultValueOsOverrides) {
let result = find(option.defaultValueOsOverrides, d => ConnectionWidget._osByName[d.os] === os);
let result = option.defaultValueOsOverrides.find(d => ConnectionWidget._osByName[d.os] === os);
if (result) {
return result.defaultValueOverride;
}
@@ -413,7 +412,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
if (this._refreshCredentialsLink) {
this._register(DOM.addDisposableListener(this._refreshCredentialsLink, DOM.EventType.CLICK, async () => {
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
if (account) {
await this._accountManagementService.refreshAccount(account);
await this.fillInAzureAccountOptions();
@@ -537,7 +536,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
}
private updateRefreshCredentialsLink(): void {
let chosenAccount = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
let chosenAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
if (chosenAccount && chosenAccount.isStale) {
DOM.removeClass(this._tableContainer, 'hide-refresh-link');
} else {
@@ -558,7 +557,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
await this.fillInAzureAccountOptions();
// If a new account was added find it and select it, otherwise select the first account
let newAccount = find(this._azureAccountList, option => !oldAccountIds.some(oldId => oldId === option.key.accountId));
let newAccount = this._azureAccountList.find(option => !oldAccountIds.some(oldId => oldId === option.key.accountId));
if (newAccount) {
this._azureAccountDropdown.selectWithOptionName(newAccount.key.accountId);
} else {
@@ -570,7 +569,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
// Display the tenant select box if needed
const hideTenantsClassName = 'hide-azure-tenants';
let selectedAccount = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
let selectedAccount = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
if (selectedAccount && selectedAccount.properties.tenants && selectedAccount.properties.tenants.length > 1) {
// There are multiple tenants available so let the user select one
let options = selectedAccount.properties.tenants.map(tenant => tenant.displayName);
@@ -589,7 +588,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
private onAzureTenantSelected(tenantIndex: number): void {
this._azureTenantId = undefined;
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
if (account && account.properties.tenants) {
let tenant = account.properties.tenants[tenantIndex];
if (tenant) {
@@ -708,7 +707,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
this._azureAccountDropdown.selectWithOptionName(this.getModelValue(accountName));
await this.onAzureAccountSelected();
let tenantId = connectionInfo.azureTenantId;
let account = find(this._azureAccountList, account => account.key.accountId === this._azureAccountDropdown.value);
let account = this._azureAccountList.find(account => account.key.accountId === this._azureAccountDropdown.value);
if (account && account.properties.tenants.length > 1) {
let tenant = account.properties.tenants.find(tenant => tenant.id === tenantId);
if (tenant) {
@@ -912,12 +911,12 @@ export class ConnectionWidget extends lifecycle.Disposable {
private findGroupId(groupFullName: string): string {
let group: IConnectionProfileGroup;
if (ConnectionProfileGroup.isRoot(groupFullName)) {
group = find(this._serverGroupOptions, g => ConnectionProfileGroup.isRoot(g.name));
group = this._serverGroupOptions.find(g => ConnectionProfileGroup.isRoot(g.name));
if (group === undefined) {
group = find(this._serverGroupOptions, g => g.name === this.DefaultServerGroup.name);
group = this._serverGroupOptions.find(g => g.name === this.DefaultServerGroup.name);
}
} else {
group = find(this._serverGroupOptions, g => g.name === groupFullName);
group = this._serverGroupOptions.find(g => g.name === groupFullName);
}
return group ? group.id : undefined;
}
@@ -926,7 +925,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
if (!displayName) {
return undefined;
}
return find(ConnectionWidget._authTypes, authType => this.getAuthTypeDisplayName(authType) === displayName);
return ConnectionWidget._authTypes.find(authType => this.getAuthTypeDisplayName(authType) === displayName);
}
public closeDatabaseDropdown(): void {

View File

@@ -24,7 +24,8 @@ import { ResourceLabels, IResourceLabel } from 'vs/workbench/browser/labels';
import { ActionBar } from 'vs/base/browser/ui/actionbar/actionbar';
import { URI } from 'vs/base/common/uri';
import { dirname, basename } from 'vs/base/common/resources';
import { LIGHT, FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
import { FileThemeIcon, FolderThemeIcon, registerThemingParticipant, ThemeIcon, IThemeService } from 'vs/platform/theme/common/themeService';
import { ColorScheme } from 'vs/platform/theme/common/theme';
import { FileKind } from 'vs/platform/files/common/files';
import { WorkbenchAsyncDataTree } from 'vs/platform/list/browser/listService';
import { localize } from 'vs/nls';
@@ -754,7 +755,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
}
return ({ start, end });
}) : undefined;
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
const iconUrl = icon ? URI.revive(icon) : null;
// reset
@@ -922,7 +923,7 @@ class Aligner extends Disposable {
}
private hasIcon(node: ITreeItem): boolean {
const icon = this.themeService.getColorTheme().type === LIGHT ? node.icon : node.iconDark;
const icon = this.themeService.getColorTheme().type === ColorScheme.LIGHT ? node.icon : node.iconDark;
if (icon) {
return true;
}

View File

@@ -6,7 +6,6 @@
import { Event, Emitter } from 'vs/base/common/event';
import { IDashboardTab } from 'sql/workbench/services/dashboard/browser/common/interfaces';
import { find } from 'vs/base/common/arrays';
export interface IDashboardUITab {
@@ -35,7 +34,7 @@ export class NewDashboardTabViewModel {
tabList.push({ tabConfig: tab });
});
openedTabs.forEach(tab => {
let uiTab = find(tabList, i => i.tabConfig === tab);
let uiTab = tabList.find(i => i.tabConfig === tab);
if (uiTab) {
uiTab.isOpened = true;
}

View File

@@ -22,13 +22,13 @@ import * as pfs from 'vs/base/node/pfs';
import { getRandomTestPath } from 'vs/base/test/node/testUtils';
import { IProcessEnvironment } from 'vs/base/common/platform';
import { NativeWorkbenchEnvironmentService } from 'vs/workbench/services/environment/electron-browser/environmentService';
import { TestWindowConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices';
import { isEqual } from 'vs/base/common/resources';
import { TestWorkbenchConfiguration } from 'vs/workbench/test/electron-browser/workbenchTestServices';
class MockWorkbenchEnvironmentService extends NativeWorkbenchEnvironmentService {
constructor(public userEnv: IProcessEnvironment) {
super({ ...TestWindowConfiguration, userEnv }, TestWindowConfiguration.execPath);
super({ ...TestWorkbenchConfiguration, userEnv });
}
}

View File

@@ -4,7 +4,6 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { find } from 'vs/base/common/arrays';
export class JobManagementUtilities {
@@ -42,7 +41,9 @@ export class JobManagementUtilities {
}
public static convertToNextRun(date: string) {
if (find(date, x => x === '1/1/0001')) {
let newDate = date as unknown;
let dateArr = newDate as [];
if (dateArr.find(x => x === '1/1/0001')) {
return nls.localize('agentUtilities.notScheduled', "Not Scheduled");
} else {
return date;
@@ -50,7 +51,9 @@ export class JobManagementUtilities {
}
public static convertToLastRun(date: string) {
if (find(date, x => x === '1/1/0001')) {
let newDate = date as unknown;
let dateArr = newDate as [];
if (dateArr.find(x => x === '1/1/0001')) {
return nls.localize('agentUtilities.neverRun', "Never Run");
} else {
return date;
@@ -58,7 +61,9 @@ export class JobManagementUtilities {
}
public static setRunnable(icon: HTMLElement, index: number) {
if (find(icon.className, x => x === 'non-runnable')) {
let temp = icon.className as unknown;
let classNameArr = temp as [];
if (classNameArr.find(x => x === 'non-runnable')) {
icon.className = icon.className.slice(0, index);
}
}

View File

@@ -22,7 +22,6 @@ import { optional } from 'vs/platform/instantiation/common/instantiation';
import { getErrorMessage, onUnexpectedError } from 'vs/base/common/errors';
import { generateUuid } from 'vs/base/common/uuid';
import { IModelContentChangedEvent } from 'vs/editor/common/model/textModelEvents';
import { firstIndex, find } from 'vs/base/common/arrays';
import { HideInputTag } from 'sql/platform/notebooks/common/outputRegistry';
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
import { ICommandService } from 'vs/platform/commands/common/commands';
@@ -136,7 +135,7 @@ export class CellModel extends Disposable implements ICellModel {
let tagIndex = -1;
if (this._metadata.tags) {
tagIndex = firstIndex(this._metadata.tags, tag => tag === HideInputTag);
tagIndex = this._metadata.tags.findIndex(tag => tag === HideInputTag);
}
if (this._isCollapsed) {
@@ -786,7 +785,7 @@ export class CellModel extends Disposable implements ICellModel {
if (serverInfo) {
let endpoints: notebookUtils.IEndpoint[] = notebookUtils.getClusterEndpoints(serverInfo);
if (endpoints && endpoints.length > 0) {
endpoint = find(endpoints, ep => ep.serviceName.toLowerCase() === notebookUtils.hadoopEndpointNameGateway);
endpoint = endpoints.find(ep => ep.serviceName.toLowerCase() === notebookUtils.hadoopEndpointNameGateway);
}
}
}

View File

@@ -24,7 +24,6 @@ import { ConnectionProfile } from 'sql/platform/connection/common/connectionProf
import { uriPrefixes } from 'sql/platform/connection/common/utils';
import { ILogService } from 'vs/platform/log/common/log';
import { getErrorMessage } from 'vs/base/common/errors';
import { find, firstIndex } from 'vs/base/common/arrays';
import { startsWith } from 'vs/base/common/strings';
import { notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
@@ -119,18 +118,18 @@ export class NotebookModel extends Disposable implements INotebookModel {
}
public get notebookManager(): INotebookManager {
let manager = find(this.notebookManagers, manager => manager.providerId === this._providerId);
let manager = this.notebookManagers.find(manager => manager.providerId === this._providerId);
if (!manager) {
// Note: this seems like a less than ideal scenario. We should ideally pass in the "correct" provider ID and allow there to be a default,
// instead of assuming in the NotebookModel constructor that the option is either SQL or Jupyter
manager = find(this.notebookManagers, manager => manager.providerId === DEFAULT_NOTEBOOK_PROVIDER);
manager = this.notebookManagers.find(manager => manager.providerId === DEFAULT_NOTEBOOK_PROVIDER);
}
return manager;
}
public getNotebookManager(providerId: string): INotebookManager {
if (providerId) {
return find(this.notebookManagers, manager => manager.providerId === providerId);
return this.notebookManagers.find(manager => manager.providerId === providerId);
}
return undefined;
}
@@ -397,7 +396,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
}
public findCellIndex(cellModel: ICellModel): number {
return firstIndex(this._cells, (cell) => cell.equals(cellModel));
return this._cells.findIndex(cell => cell.equals(cellModel));
}
public addCell(cellType: CellType, index?: number): ICellModel {
@@ -498,7 +497,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
if (this.inErrorState || !this._cells) {
return;
}
let index = firstIndex(this._cells, (cell) => cell.equals(cellModel));
let index = this._cells.findIndex(cell => cell.equals(cellModel));
if (index > -1) {
this._cells.splice(index, 1);
if (this._activeCell === cellModel) {
@@ -548,7 +547,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
public async startSession(manager: INotebookManager, displayName?: string, setErrorStateOnFail?: boolean, kernelAlias?: string): Promise<void> {
if (displayName && this._standardKernels) {
let standardKernel = find(this._standardKernels, kernel => kernel.displayName === displayName);
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName);
if (standardKernel) {
this._defaultKernel = { name: standardKernel.name, display_name: standardKernel.displayName };
}
@@ -653,7 +652,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
private isValidConnection(profile: IConnectionProfile | connection.Connection) {
if (this._standardKernels) {
let standardKernels = find(this._standardKernels, kernel => this._defaultKernel && kernel.displayName === this._defaultKernel.display_name);
let standardKernels = this._standardKernels.find(kernel => this._defaultKernel && kernel.displayName === this._defaultKernel.display_name);
let connectionProviderIds = standardKernels ? standardKernels.connectionProviderIds : undefined;
let providerFeatures = this._capabilitiesService.getCapabilities(profile.providerName);
if (connectionProviderIds?.length) {
@@ -666,14 +665,14 @@ export class NotebookModel extends Disposable implements INotebookModel {
this._kernelDisplayNameToConnectionProviderIds.set(this._currentKernelAlias, [profile.providerName]);
}
}
return this._currentKernelAlias || profile && connectionProviderIds && find(connectionProviderIds, provider => provider === profile.providerName) !== undefined;
return this._currentKernelAlias || profile && connectionProviderIds && connectionProviderIds.find(provider => provider === profile.providerName) !== undefined;
}
return false;
}
public getStandardKernelFromName(name: string): notebookUtils.IStandardKernelWithProvider {
if (name && this._standardKernels) {
let kernel = find(this._standardKernels, kernel => kernel.name.toLowerCase() === name.toLowerCase());
let kernel = this._standardKernels.find(kernel => kernel.name.toLowerCase() === name.toLowerCase());
return kernel;
}
return undefined;
@@ -681,7 +680,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
public getStandardKernelFromDisplayName(displayName: string): notebookUtils.IStandardKernelWithProvider {
if (displayName && this._standardKernels) {
let kernel = find(this._standardKernels, kernel => kernel.displayName.toLowerCase() === displayName.toLowerCase());
let kernel = this._standardKernels.find(kernel => kernel.displayName.toLowerCase() === displayName.toLowerCase());
return kernel;
}
return undefined;
@@ -827,8 +826,8 @@ export class NotebookModel extends Disposable implements INotebookModel {
if (spec) {
// Ensure that the kernel we try to switch to is a valid kernel; if not, use the default
let kernelSpecs = this.getKernelSpecs();
if (kernelSpecs && kernelSpecs.length > 0 && firstIndex(kernelSpecs, k => k.display_name === spec.display_name) < 0) {
spec = find(kernelSpecs, spec => spec.name === this.notebookManager.sessionManager.specs.defaultKernel);
if (kernelSpecs && kernelSpecs.length > 0 && kernelSpecs.findIndex(k => k.display_name === spec.display_name) < 0) {
spec = kernelSpecs.find(spec => spec.name === this.notebookManager.sessionManager.specs.defaultKernel);
}
}
else {
@@ -889,7 +888,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
}
private getKernelSpecFromDisplayName(displayName: string): nb.IKernelSpec {
let kernel: nb.IKernelSpec = find(this.specs.kernels, k => k.display_name.toLowerCase() === displayName.toLowerCase());
let kernel: nb.IKernelSpec = this.specs.kernels.find(k => k.display_name.toLowerCase() === displayName.toLowerCase());
if (!kernel) {
return undefined; // undefined is handled gracefully in the session to default to the default kernel
} else if (!kernel.name) {
@@ -906,7 +905,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
this._savedKernelInfo.display_name = displayName;
}
if (this._standardKernels) {
let standardKernel = find(this._standardKernels, kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
if (standardKernel && this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
this._savedKernelInfo.name = standardKernel.name;
this._savedKernelInfo.display_name = standardKernel.displayName;
@@ -920,7 +919,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
if (!specs || !specs.kernels) {
return kernel.name;
}
let newKernel = find(this.notebookManager.sessionManager.specs.kernels, k => k.name === kernel.name);
let newKernel = this.notebookManager.sessionManager.specs.kernels.find(k => k.name === kernel.name);
let newKernelDisplayName;
if (newKernel) {
newKernelDisplayName = newKernel.display_name;

View File

@@ -24,7 +24,6 @@ import { ILanguageMagic } from 'sql/workbench/services/notebook/browser/notebook
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { URI } from 'vs/base/common/uri';
import { getUriPrefix, uriPrefixes } from 'sql/platform/connection/common/utils';
import { firstIndex } from 'vs/base/common/arrays';
import { startsWith } from 'vs/base/common/strings';
import { onUnexpectedError } from 'vs/base/common/errors';
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
@@ -75,7 +74,7 @@ export class SqlSessionManager implements nb.SessionManager {
startNew(options: nb.ISessionOptions): Thenable<nb.ISession> {
let sqlSession = new SqlSession(options, this._instantiationService);
let index = firstIndex(SqlSessionManager._sessions, session => session.path === options.path);
let index = SqlSessionManager._sessions.findIndex(session => session.path === options.path);
if (index > -1) {
SqlSessionManager._sessions.splice(index);
}
@@ -84,7 +83,7 @@ export class SqlSessionManager implements nb.SessionManager {
}
shutdown(id: string): Thenable<void> {
let index = firstIndex(SqlSessionManager._sessions, session => session.id === id);
let index = SqlSessionManager._sessions.findIndex(session => session.id === id);
if (index > -1) {
let sessionManager = SqlSessionManager._sessions[index];
SqlSessionManager._sessions.splice(index);

View File

@@ -24,7 +24,6 @@ import { TreeNodeContextKey } from 'sql/workbench/services/objectExplorer/common
import { IQueryManagementService } from 'sql/workbench/services/query/common/queryManagement';
import { ServerInfoContextKey } from 'sql/workbench/services/connection/common/serverInfoContextKey';
import { fillInActions } from 'vs/platform/actions/browser/menuEntryActionViewItem';
import { firstIndex, find } from 'vs/base/common/arrays';
import { AsyncServerTree, ServerTreeElement } from 'sql/workbench/services/objectExplorer/browser/asyncServerTree';
/**
@@ -87,7 +86,7 @@ export class ServerTreeActionProvider {
const options = { arg: undefined, shouldForwardArgs: true };
const groups = menu.getActions(options);
let insertIndex: number | undefined = 0;
const queryIndex = firstIndex(groups, v => {
const queryIndex = groups.findIndex(v => {
if (v[0] === '0_query') {
return true;
} else {
@@ -193,7 +192,7 @@ export class ServerTreeActionProvider {
private isScriptableObject(context: ObjectExplorerContext): boolean {
if (context.treeNode) {
if (find(NodeType.SCRIPTABLE_OBJECTS, x => x === context?.treeNode?.nodeTypeId)) {
if (NodeType.SCRIPTABLE_OBJECTS.find(x => x === context?.treeNode?.nodeTypeId)) {
return true;
}
}

View File

@@ -18,7 +18,6 @@ import { NullLogService } from 'vs/platform/log/common/log';
import { TestObjectExplorerProvider } from 'sql/workbench/services/objectExplorer/test/common/testObjectExplorerProvider';
import { TestConnectionManagementService } from 'sql/platform/connection/test/common/testConnectionManagementService';
import { TestCapabilitiesService } from 'sql/platform/capabilities/test/common/testCapabilitiesService';
import { find } from 'vs/base/common/arrays';
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
import { ConnectionOptionSpecialType, ServiceOptionType } from 'sql/platform/connection/common/interfaces';
@@ -495,7 +494,7 @@ suite('SQL Object Explorer Service tests', () => {
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.isAny())).callback(() => {
objectExplorerService.onNodeExpanded(tableExpandInfo);
}).returns(() => Promise.resolve(true));
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, tableNode);
const isExpanded = await tableNode.isExpanded();
assert.equal(isExpanded, true, 'Table node was not expanded');
@@ -511,7 +510,7 @@ suite('SQL Object Explorer Service tests', () => {
objectExplorerService.onSessionCreated(1, objectExplorerSession);
const childNodes = await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, objectExplorerService.getObjectExplorerNode(connection));
// If I check whether the table is expanded, the answer should be no because only its parent node is expanded
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
const isExpanded = await tableNode.isExpanded();
assert.equal(isExpanded, false);
});
@@ -535,9 +534,9 @@ suite('SQL Object Explorer Service tests', () => {
sqlOEProvider.setup(x => x.expandNode(TypeMoq.It.isAny())).callback(() => {
objectExplorerService.onNodeExpanded(tableExpandInfo);
}).returns(() => Promise.resolve(true));
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, find(childNodes, node => node.nodePath === table1NodePath));
await objectExplorerService.resolveTreeNodeChildren(objectExplorerSession, childNodes.find(node => node.nodePath === table1NodePath));
// If I check whether the table is expanded, the answer should be yes
const tableNode = find(childNodes, node => node.nodePath === table1NodePath);
const tableNode = childNodes.find(node => node.nodePath === table1NodePath);
const isExpanded = await tableNode.isExpanded();
assert.equal(isExpanded, false);
});

View File

@@ -24,7 +24,6 @@ import { StandardKeyboardEvent } from 'vs/base/browser/keyboardEvent';
import { ProfilerFilter, ProfilerFilterClause, ProfilerFilterClauseOperator, IProfilerService } from 'sql/workbench/services/profiler/browser/interfaces';
import { ILogService } from 'vs/platform/log/common/log';
import { ITextResourcePropertiesService } from 'vs/editor/common/services/textResourceConfigurationService';
import { find, firstIndex } from 'vs/base/common/arrays';
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
import { onUnexpectedError } from 'vs/base/common/errors';
import { attachModalDialogStyler } from 'sql/workbench/common/styler';
@@ -223,7 +222,7 @@ export class ProfilerFilterDialog extends Modal {
private addClauseRow(setInitialValue: boolean, field?: string, operator?: string, value?: string): void {
const columns = this._input!.columns.map(column => column.name);
if (field && !find(columns, x => x === field)) {
if (field && !columns.find(x => x === field)) {
return;
}
@@ -272,7 +271,7 @@ export class ProfilerFilterDialog extends Modal {
}
private removeRow(clauseId: string) {
const idx = firstIndex(this._clauseRows, (entry) => { return entry.id === clauseId; });
const idx = this._clauseRows.findIndex(entry => { return entry.id === clauseId; });
if (idx !== -1) {
this._clauseRows[idx].row.remove();
this._clauseRows.splice(idx, 1);

View File

@@ -23,7 +23,6 @@ import { mssqlProviderName } from 'sql/platform/connection/common/constants';
import { IGridDataProvider, getResultsString } from 'sql/workbench/services/query/common/gridDataProvider';
import { getErrorMessage } from 'vs/base/common/errors';
import { ILogService } from 'vs/platform/log/common/log';
import { find } from 'vs/base/common/arrays';
import { IRange, Range } from 'vs/editor/common/core/range';
import { BatchSummary, IQueryMessage, ResultSetSummary, QueryExecuteSubsetParams, CompleteBatchSummary, IResultMessage, ResultSetSubset, BatchStartSummary } from './query';
import { IQueryEditorConfiguration } from 'sql/platform/query/common/query';
@@ -323,7 +322,7 @@ export default class QueryRunner extends Disposable {
}
// handle getting queryPlanxml if we need too
// check if this result has show plan, this needs work, it won't work for any other provider
let hasShowPlan = !!find(resultSet.columnInfo, e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan');
let hasShowPlan = !!resultSet.columnInfo.find(e => e.columnName === 'Microsoft SQL Server 2005 XML Showplan');
if (hasShowPlan && resultSet.rowCount > 0) {
this._isQueryPlan = true;

View File

@@ -14,7 +14,6 @@ import { IConnectionManagementService } from 'sql/platform/connection/common/con
import { Event, Emitter } from 'vs/base/common/event';
import { Disposable } from 'vs/base/common/lifecycle';
import { IConfigurationService, IConfigurationChangeEvent } from 'vs/platform/configuration/common/configuration';
import { find } from 'vs/base/common/arrays';
/**
* Service that collects the results of executed queries
@@ -42,7 +41,7 @@ export class QueryHistoryService extends Disposable implements IQueryHistoryServ
this._captureEnabled = !!this._configurationService.getValue<boolean>('queryHistory.captureEnabled');
this._register(this._configurationService.onDidChangeConfiguration((e: IConfigurationChangeEvent) => {
if (find(e.affectedKeys, x => x === 'queryHistory.captureEnabled')) {
if (e.affectedKeys.find(x => x === 'queryHistory.captureEnabled')) {
this.updateCaptureEnabled();
}
}));

View File

@@ -13,7 +13,6 @@ import { localize } from 'vs/nls';
import Severity from 'vs/base/common/severity';
import { IDialogService } from 'vs/platform/dialogs/common/dialogs';
import { IConnectionManagementService } from 'sql/platform/connection/common/connectionManagement';
import { find } from 'vs/base/common/arrays';
export const SERVICE_ID = 'taskHistoryService';
export const ITaskService = createDecorator<ITaskService>(SERVICE_ID);
@@ -227,7 +226,7 @@ export class TaskService implements ITaskService {
private getTaskInQueue(taskId: string): TaskNode | undefined {
if (this._taskQueue.hasChildren) {
return find(this._taskQueue.children!, x => x.id === taskId);
return this._taskQueue.children!.find(x => x.id === taskId);
}
return undefined;
}