mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-17 01:25:36 -05:00
Merge from vscode e3c4990c67c40213af168300d1cfeb71d680f877 (#16569)
This commit is contained in:
@@ -674,9 +674,9 @@ class TreeItemRenderer extends Disposable implements ITreeRenderer<ITreeItemFrom
|
||||
if (iconUrl || sqlIcon) {
|
||||
templateData.icon.className = 'custom-view-tree-node-item-icon';
|
||||
if (sqlIcon) {
|
||||
DOM.toggleClass(templateData.icon, sqlIcon, !!sqlIcon); // tracked change
|
||||
templateData.icon.classList.toggle(sqlIcon, !!sqlIcon); // tracked change
|
||||
}
|
||||
DOM.toggleClass(templateData.icon, 'icon', !!sqlIcon);
|
||||
templateData.icon.classList.toggle('icon', !!sqlIcon);
|
||||
templateData.icon.style.backgroundImage = iconUrl ? DOM.asCSSUrl(iconUrl) : '';
|
||||
} else {
|
||||
let iconClass: string | undefined;
|
||||
|
||||
@@ -17,7 +17,6 @@ import { ConnectionWidget } from 'sql/workbench/services/connection/browser/conn
|
||||
import { IServerGroupController } from 'sql/platform/serverGroup/common/serverGroupController';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { ConnectionProviderProperties } from 'sql/platform/capabilities/common/capabilitiesService';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
export class ConnectionController implements IConnectionComponentController {
|
||||
private _advancedController: AdvancedPropertiesController;
|
||||
@@ -153,7 +152,7 @@ export class ConnectionController implements IConnectionComponentController {
|
||||
} else {
|
||||
defaultGroupId = Utils.defaultGroupId;
|
||||
}
|
||||
allGroups.push(assign({}, this._connectionWidget.DefaultServerGroup, { id: defaultGroupId }));
|
||||
allGroups.push(Object.assign({}, this._connectionWidget.DefaultServerGroup, { id: defaultGroupId }));
|
||||
allGroups.push(this._connectionWidget.NoneServerGroup);
|
||||
if (connectionGroupRoot && connectionGroupRoot.length > 0) {
|
||||
this.flattenGroups(connectionGroupRoot[0], allGroups);
|
||||
|
||||
@@ -45,7 +45,6 @@ import { Memento, MementoObject } from 'vs/workbench/common/memento';
|
||||
import { INotificationService } from 'vs/platform/notification/common/notification';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
import { toErrorMessage } from 'vs/base/common/errorMessage';
|
||||
@@ -877,7 +876,7 @@ export class ConnectionManagementService extends Disposable implements IConnecti
|
||||
|
||||
// Request Senders
|
||||
private async sendConnectRequest(connection: interfaces.IConnectionProfile, uri: string): Promise<boolean> {
|
||||
let connectionInfo = assign({}, {
|
||||
let connectionInfo = Object.assign({}, {
|
||||
options: connection.options
|
||||
});
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@ import * as DOM from 'vs/base/browser/dom';
|
||||
import { IThemeService } from 'vs/platform/theme/common/themeService';
|
||||
import { OS, OperatingSystem } from 'vs/base/common/platform';
|
||||
import { MessageType } from 'vs/base/browser/ui/inputbox/inputBox';
|
||||
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';
|
||||
@@ -229,7 +228,7 @@ export class ConnectionWidget extends lifecycle.Disposable {
|
||||
validation: (value: string) => {
|
||||
if (!value) {
|
||||
return ({ type: MessageType.ERROR, content: localize('connectionWidget.missingRequireField', "{0} is required.", serverNameOption.displayName) });
|
||||
} else if (startsWith(value, ' ') || endsWith(value, ' ')) {
|
||||
} else if (value.startsWith(' ') || value.endsWith(' ')) {
|
||||
return ({ type: MessageType.WARNING, content: localize('connectionWidget.fieldWillBeTrimmed', "{0} will be trimmed.", serverNameOption.displayName) });
|
||||
}
|
||||
return undefined;
|
||||
|
||||
@@ -33,7 +33,6 @@ import { TestEnvironmentService, TestEditorService } from 'vs/workbench/test/bro
|
||||
import { TestNotificationService } from 'vs/platform/notification/test/common/testNotificationService';
|
||||
import { TestConfigurationService } from 'vs/platform/configuration/test/common/testConfigurationService';
|
||||
import { ILogService, NullLogService } from 'vs/platform/log/common/log';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { NullAdsTelemetryService } from 'sql/platform/telemetry/common/adsTelemetryService';
|
||||
import { TestStorageService } from 'vs/workbench/test/common/workbenchTestServices';
|
||||
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
|
||||
@@ -74,9 +73,9 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
id: undefined
|
||||
};
|
||||
let connectionProfileWithEmptySavedPassword: IConnectionProfile =
|
||||
assign({}, connectionProfile, { password: '', serverName: connectionProfile.serverName + 1 });
|
||||
Object.assign({}, connectionProfile, { password: '', serverName: connectionProfile.serverName + 1 });
|
||||
let connectionProfileWithEmptyUnsavedPassword: IConnectionProfile =
|
||||
assign({}, connectionProfile, { password: '', serverName: connectionProfile.serverName + 2, savePassword: false });
|
||||
Object.assign({}, connectionProfile, { password: '', serverName: connectionProfile.serverName + 2, savePassword: false });
|
||||
|
||||
let connectionManagementService: ConnectionManagementService;
|
||||
let configResult: { [key: string]: any } = {};
|
||||
@@ -482,7 +481,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('changeGroupIdForconnection should change the groupId for a connection profile', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
profile.options = { password: profile.password };
|
||||
profile.id = 'test_id';
|
||||
let newGroupId = 'new_group_id';
|
||||
@@ -504,7 +503,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('findExistingConnection should find connection for connectionProfile with same info', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri1 = 'connection:connectionId';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -535,7 +534,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('deleteConnection should delete the connection properly', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri1 = 'connection:connectionId';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -566,7 +565,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('deleteConnectionGroup should delete connections in connection group', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let profileGroup = createConnectionGroup('original_id');
|
||||
profileGroup.addConnections([profile]);
|
||||
let uri1 = 'connection:connectionId';
|
||||
@@ -601,13 +600,13 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
connectionStore.setup(x => x.canChangeConnectionConfig(TypeMoq.It.isAny(), TypeMoq.It.isAnyString())).returns(() => {
|
||||
return true;
|
||||
});
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let newGroupId = 'test_group_id';
|
||||
assert(connectionManagementService.canChangeConnectionConfig(profile, newGroupId));
|
||||
});
|
||||
|
||||
test('isProfileConnecting should return false for already connected profile', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'Editor Uri';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -635,7 +634,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('disconnect should disconnect the profile when given ConnectionProfile', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -664,7 +663,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('disconnect should disconnect the profile when given uri string', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -693,7 +692,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('cancelConnection should disconnect the profile', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -751,7 +750,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConnection should grab connection that is connected', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let badString = 'bad_string';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -784,7 +783,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('connectIfNotConnected should not try to connect with already connected profile', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -818,7 +817,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConnectionString should get connection string of connectionId', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let badString = 'bad_string';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -858,7 +857,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
|
||||
|
||||
test('rebuildIntellisenseCache should call rebuildIntelliSenseCache on provider', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -893,7 +892,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('buildConnectionInfo should get connection string of connectionId', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -928,9 +927,9 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('removeConnectionProfileCredentials should return connection profile without password', () => {
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
connectionStore.setup(x => x.getProfileWithoutPassword(TypeMoq.It.isAny())).returns(() => {
|
||||
let profileWithoutPass = assign({}, connectionProfile);
|
||||
let profileWithoutPass = Object.assign({}, connectionProfile);
|
||||
profileWithoutPass.password = undefined;
|
||||
return <ConnectionProfile>profileWithoutPass;
|
||||
});
|
||||
@@ -939,7 +938,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConnectionProfileById should return profile when given profileId', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let uri = 'connection:connectionId'; // must use default connection uri for test to work.
|
||||
let badString = 'bad_string';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -973,7 +972,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('Edit Connection - Changing connection profile name for same URI should persist after edit', async () => {
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
let uri1 = 'test_uri1';
|
||||
let newname = 'connection renamed';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
@@ -998,7 +997,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
};
|
||||
|
||||
await connect(uri1, options, true, profile);
|
||||
let newProfile = assign({}, connectionProfile);
|
||||
let newProfile = Object.assign({}, connectionProfile);
|
||||
newProfile.connectionName = newname;
|
||||
options.params.isEditConnection = true;
|
||||
await connect(uri1, options, true, newProfile);
|
||||
@@ -1008,7 +1007,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
test('Edit Connection - Connecting a different URI with same profile via edit should not change profile ID.', async () => {
|
||||
let uri1 = 'test_uri1';
|
||||
let uri2 = 'test_uri2';
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
profile.id = '0451';
|
||||
let options: IConnectionCompletionOptions = {
|
||||
params: {
|
||||
@@ -1320,7 +1319,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('registerIconProvider should register icon provider for connectionManagementService', async () => {
|
||||
let profile = <ConnectionProfile>assign({}, connectionProfile);
|
||||
let profile = <ConnectionProfile>Object.assign({}, connectionProfile);
|
||||
let serverInfo: azdata.ServerInfo = {
|
||||
serverMajorVersion: 0,
|
||||
serverMinorVersion: 0,
|
||||
@@ -1464,9 +1463,9 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
let dbName = 'master';
|
||||
let serverName = 'test_server';
|
||||
let userName = 'test_user';
|
||||
let connectionProfileWithoutDb: IConnectionProfile = assign(connectionProfile,
|
||||
let connectionProfileWithoutDb: IConnectionProfile = Object.assign(connectionProfile,
|
||||
{ serverName: serverName, databaseName: '', userName: userName, getOptionsKey: () => undefined });
|
||||
let connectionProfileWithDb: IConnectionProfile = assign(connectionProfileWithoutDb, { databaseName: dbName });
|
||||
let connectionProfileWithDb: IConnectionProfile = Object.assign(connectionProfileWithoutDb, { databaseName: dbName });
|
||||
// Save the database with a URI that has the database name filled in, to mirror Carbon's behavior
|
||||
let ownerUri = Utils.generateUri(connectionProfileWithDb);
|
||||
await connect(ownerUri, undefined, false, connectionProfileWithoutDb);
|
||||
@@ -1486,9 +1485,9 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
let newDbName = 'renamed_master';
|
||||
let serverName = 'test_server';
|
||||
let userName = 'test_user';
|
||||
let connectionProfileWithoutDb: IConnectionProfile = assign(connectionProfile,
|
||||
let connectionProfileWithoutDb: IConnectionProfile = Object.assign(connectionProfile,
|
||||
{ serverName: serverName, databaseName: '', userName: userName, getOptionsKey: () => undefined });
|
||||
let connectionProfileWithDb: IConnectionProfile = assign(connectionProfileWithoutDb, { databaseName: dbName });
|
||||
let connectionProfileWithDb: IConnectionProfile = Object.assign(connectionProfileWithoutDb, { databaseName: dbName });
|
||||
// Save the database with a URI that has the database name filled in, to mirror Carbon's behavior
|
||||
let ownerUri = Utils.generateUri(connectionProfileWithDb);
|
||||
let listDatabasesThenable = (connectionUri: string) => {
|
||||
@@ -1545,7 +1544,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConnectionCredentials returns the credentials dictionary for an active connection profile', async () => {
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
profile.options = { password: profile.password };
|
||||
profile.id = 'test_id';
|
||||
connectionStatusManager.addConnection(profile, 'test_uri');
|
||||
@@ -1607,7 +1606,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConnectionUriFromId returns a URI of an active connection with the given id', () => {
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
profile.options = { password: profile.password };
|
||||
profile.id = 'test_id';
|
||||
let uri = 'test_initial_uri';
|
||||
@@ -1626,7 +1625,7 @@ suite('SQL ConnectionManagementService tests', () => {
|
||||
});
|
||||
|
||||
test('getConectionUriFromId returns undefined if the given connection is not active', () => {
|
||||
let profile = assign({}, connectionProfile);
|
||||
let profile = Object.assign({}, connectionProfile);
|
||||
profile.options = { password: profile.password };
|
||||
profile.id = 'test_id';
|
||||
connectionStatusManager.addConnection(profile, Utils.generateUri(profile));
|
||||
|
||||
@@ -871,7 +871,7 @@ class TreeRenderer extends Disposable implements ITreeRenderer<ITreeItem, FuzzyS
|
||||
}
|
||||
|
||||
private setAlignment(container: HTMLElement, treeItem: ITreeItem) {
|
||||
DOM.toggleClass(container.parentElement!, 'align-icon-with-twisty', this.aligner.alignIconWithTwisty(treeItem));
|
||||
container.parentElement!.classList.toggle('align-icon-with-twisty', this.aligner.alignIconWithTwisty(treeItem));
|
||||
}
|
||||
|
||||
private isFileKindThemeIcon(icon: ThemeIcon | undefined): boolean {
|
||||
|
||||
@@ -50,7 +50,7 @@ suite('Insights Utils tests', function () {
|
||||
await fs.promises.mkdir(queryFileDir, { recursive: true });
|
||||
|
||||
queryFilePath = path.join(queryFileDir, 'test.sql');
|
||||
await pfs.writeFile(queryFilePath, '');
|
||||
await pfs.Promises.writeFile(queryFilePath, '');
|
||||
});
|
||||
|
||||
test('resolveQueryFilePath resolves path correctly with fully qualified path', async () => {
|
||||
@@ -60,11 +60,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
new TestContextService(),
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -92,11 +93,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
contextService,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -124,11 +126,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
contextService,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -158,11 +161,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
contextService,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -193,11 +197,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -223,11 +228,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -248,11 +254,12 @@ suite('Insights Utils tests', function () {
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined,
|
||||
undefined);
|
||||
|
||||
const fileService = new class extends TestFileService {
|
||||
override exists(uri: URI): Promise<boolean> {
|
||||
return pfs.exists(uri.fsPath);
|
||||
return pfs.Promises.exists(uri.fsPath);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorInput } from 'vs/workbench/common/editor';
|
||||
import { FileEditorInput } from 'vs/workbench/contrib/files/common/editors/fileEditorInput';
|
||||
import { Extensions as ILanguageAssociationExtensions, ILanguageAssociationRegistry } from 'sql/workbench/services/languageAssociation/common/languageAssociation';
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { UntitledTextEditorInput } from 'vs/workbench/services/untitled/common/untitledTextEditorInput';
|
||||
|
||||
const languageRegistry = Registry.as<ILanguageAssociationRegistry>(ILanguageAssociationExtensions.LanguageAssociations);
|
||||
|
||||
export function doHandleUpgrade(editor?: EditorInput): EditorInput | undefined {
|
||||
if (editor instanceof UntitledTextEditorInput || editor instanceof FileEditorInput) {
|
||||
let language: string | undefined;
|
||||
if (editor instanceof UntitledTextEditorInput) {
|
||||
language = editor.getMode();
|
||||
} else {
|
||||
language = editor.getPreferredMode();
|
||||
}
|
||||
if (language) {
|
||||
const association = languageRegistry.getAssociationForLanguage(language);
|
||||
if (association && association.syncConvertinput) {
|
||||
return association.syncConvertinput(editor);
|
||||
}
|
||||
}
|
||||
}
|
||||
return editor;
|
||||
}
|
||||
@@ -4,7 +4,8 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
import { IEditorInput, EditorInput } from 'vs/workbench/common/editor';
|
||||
import { IEditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { ServicesAccessor, IInstantiationService, BrandedService } from 'vs/platform/instantiation/common/instantiation';
|
||||
import { IDisposable, toDisposable } from 'vs/base/common/lifecycle';
|
||||
|
||||
@@ -13,11 +14,7 @@ export type BaseInputCreator = (activeEditor: IEditorInput) => IEditorInput;
|
||||
|
||||
export interface ILanguageAssociation {
|
||||
convertInput(activeEditor: IEditorInput): Promise<EditorInput | undefined> | EditorInput | undefined;
|
||||
/**
|
||||
* Used for scenarios when we need to synchrounly create inputs, currently only for handling upgrades
|
||||
* and planned to be removed eventually
|
||||
*/
|
||||
syncConvertinput?(activeEditor: IEditorInput): EditorInput | undefined;
|
||||
syncConvertInput?(activeEditor: IEditorInput): EditorInput | undefined;
|
||||
createBase(activeEditor: IEditorInput): IEditorInput;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 { startsWith } from 'vs/base/common/strings';
|
||||
import { notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { Deferred } from 'sql/base/common/promise';
|
||||
@@ -1085,7 +1084,7 @@ export class NotebookModel extends Disposable implements INotebookModel {
|
||||
if (this._savedKernelInfo.display_name !== displayName) {
|
||||
this._savedKernelInfo.display_name = displayName;
|
||||
}
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || startsWith(displayName, kernel.displayName));
|
||||
let standardKernel = this._standardKernels.find(kernel => kernel.displayName === displayName || displayName.startsWith(kernel.displayName));
|
||||
if (standardKernel && this._savedKernelInfo.name && this._savedKernelInfo.name !== standardKernel.name) {
|
||||
this._savedKernelInfo.name = standardKernel.name;
|
||||
this._savedKernelInfo.display_name = standardKernel.displayName;
|
||||
|
||||
@@ -7,8 +7,6 @@ import * as path from 'vs/base/common/path';
|
||||
import { nb, ServerInfo } from 'azdata';
|
||||
import { DEFAULT_NOTEBOOK_PROVIDER, DEFAULT_NOTEBOOK_FILETYPE, INotebookService } from 'sql/workbench/services/notebook/browser/notebookService';
|
||||
import { URI } from 'vs/base/common/uri';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
|
||||
export const clusterEndpointsProperty = 'clusterEndpoints';
|
||||
export const hadoopEndpointNameGateway = 'gateway';
|
||||
@@ -23,7 +21,7 @@ export function getProvidersForFileName(fileName: string, notebookService: INote
|
||||
let fileExt = path.extname(fileName);
|
||||
let providers: string[];
|
||||
// First try to get provider for actual file type
|
||||
if (fileExt && startsWith(fileExt, '.')) {
|
||||
if (fileExt && fileExt.startsWith('.')) {
|
||||
fileExt = fileExt.slice(1, fileExt.length);
|
||||
providers = notebookService.getProvidersForFileType(fileExt);
|
||||
}
|
||||
@@ -44,7 +42,7 @@ export function getStandardKernelsForProvider(providerId: string, notebookServic
|
||||
}
|
||||
let standardKernels = notebookService.getStandardKernelsForProvider(providerId);
|
||||
standardKernels.forEach(kernel => {
|
||||
assign(<IStandardKernelWithProvider>kernel, {
|
||||
Object.assign(<IStandardKernelWithProvider>kernel, {
|
||||
name: kernel.name,
|
||||
connectionProviderIds: kernel.connectionProviderIds,
|
||||
notebookProvider: providerId
|
||||
|
||||
@@ -87,11 +87,11 @@ class CellDisplayGroup extends DisplayGroup<ICellModel> {
|
||||
}
|
||||
|
||||
hasGraph(cell: ICellModel): boolean {
|
||||
return !!cell.outputs.find((o: nb.IDisplayResult) => o?.output_type === 'display_data' && o?.data.hasOwnProperty('application/vnd.plotly.v1+json'));
|
||||
return !!cell.outputs.find((o: nb.ICellOutput) => o?.output_type === 'display_data' && (o as nb.IDisplayResult)?.data.hasOwnProperty('application/vnd.plotly.v1+json'));
|
||||
}
|
||||
|
||||
hasTable(cell: ICellModel): boolean {
|
||||
return !!cell.outputs.find((o: nb.IDisplayResult) => o?.output_type === 'display_data' && o?.data.hasOwnProperty('application/vnd.dataresource+json'));
|
||||
return !!cell.outputs.find((o: nb.ICellOutput) => o?.output_type === 'display_data' && (o as nb.IDisplayResult)?.data.hasOwnProperty('application/vnd.dataresource+json'));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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 { startsWith } from 'vs/base/common/strings';
|
||||
import { onUnexpectedError } from 'vs/base/common/errors';
|
||||
import { FutureInternal, notebookConstants } from 'sql/workbench/services/notebook/browser/interfaces';
|
||||
import { tryMatchCellMagic } from 'sql/workbench/services/notebook/browser/utils';
|
||||
@@ -357,7 +356,7 @@ class SqlKernel extends Disposable implements nb.IKernel {
|
||||
let code = Array.isArray(content.code) ? content.code.join('') : content.code;
|
||||
let firstLineEnd = code.indexOf(this.textResourcePropertiesService.getEOL(URI.file(this._path)));
|
||||
let firstLine = code.substring(0, (firstLineEnd >= 0) ? firstLineEnd : 0).trimLeft();
|
||||
if (startsWith(firstLine, '%%')) {
|
||||
if (firstLine.startsWith('%%')) {
|
||||
// Strip out the line
|
||||
code = code.substring(firstLineEnd, code.length);
|
||||
// Try and match to an external script magic. If we add more magics later, should handle transforms better
|
||||
|
||||
@@ -42,7 +42,7 @@ export class OEAction extends ExecuteCommandAction {
|
||||
super(id, label, commandService);
|
||||
}
|
||||
|
||||
public override async run(actionContext: any): Promise<boolean> {
|
||||
public override async run(actionContext: any): Promise<void> {
|
||||
const treeSelectionHandler = this._instantiationService.createInstance(TreeSelectionHandler);
|
||||
|
||||
let profile: IConnectionProfile | undefined = undefined;
|
||||
@@ -61,9 +61,7 @@ export class OEAction extends ExecuteCommandAction {
|
||||
if (profile) {
|
||||
return super.run(profile).then(() => {
|
||||
treeSelectionHandler.onTreeActionStateChange(false);
|
||||
return true;
|
||||
});
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@ import * as Utils from 'sql/platform/connection/common/utils';
|
||||
import { ILogService } from 'vs/platform/log/common/log';
|
||||
import { entries } from 'sql/base/common/collections';
|
||||
import { values } from 'vs/base/common/collections';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
import { IAdsTelemetryService } from 'sql/platform/telemetry/common/telemetry';
|
||||
import { ServerTreeActionProvider } from 'sql/workbench/services/objectExplorer/browser/serverTreeActionProvider';
|
||||
import { ITree } from 'vs/base/parts/tree/browser/tree';
|
||||
@@ -842,7 +841,7 @@ export class ObjectExplorerService implements IObjectExplorerService {
|
||||
}
|
||||
if (currentNode.children) {
|
||||
// Look at the next node in the path, which is the child object with the longest path where the desired path starts with the child path
|
||||
let children = currentNode.children.filter(child => startsWith(nodePath, child.nodePath));
|
||||
let children = currentNode.children.filter(child => nodePath.startsWith(child.nodePath));
|
||||
if (children.length > 0) {
|
||||
nextNode = children.reduce((currentMax, candidate) => currentMax.nodePath.length < candidate.nodePath.length ? candidate : currentMax);
|
||||
}
|
||||
|
||||
@@ -4,8 +4,6 @@
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { ProfilerFilterClause, ProfilerFilter, ProfilerFilterClauseOperator } from 'sql/workbench/services/profiler/browser/interfaces';
|
||||
import { startsWith } from 'vs/base/common/strings';
|
||||
|
||||
|
||||
export function FilterData(filter: ProfilerFilter, data: any[]): any[] {
|
||||
if (!data || !filter) {
|
||||
@@ -74,10 +72,10 @@ function matches(item: any, clauses: ProfilerFilterClause[]): boolean {
|
||||
match = !actualValueString || !(actualValueString.indexOf(expectedValueString) > -1);
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.StartsWith:
|
||||
match = startsWith(actualValueString, expectedValueString);
|
||||
match = actualValueString.startsWith(expectedValueString);
|
||||
break;
|
||||
case ProfilerFilterClauseOperator.NotStartsWith:
|
||||
match = !actualValueString || !startsWith(actualValueString, expectedValueString);
|
||||
match = !actualValueString || !actualValueString.startsWith(expectedValueString);
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Not a valid operator: ${clause.operator}`);
|
||||
|
||||
@@ -10,7 +10,6 @@ import { IDisposable } from 'vs/base/common/lifecycle';
|
||||
import * as azdata from 'azdata';
|
||||
import * as TelemetryKeys from 'sql/platform/telemetry/common/telemetryKeys';
|
||||
import { Event, Emitter } from 'vs/base/common/event';
|
||||
import { assign } from 'vs/base/common/objects';
|
||||
import { IAdsTelemetryService, ITelemetryEventProperties } from 'sql/platform/telemetry/common/telemetry';
|
||||
import EditQueryRunner from 'sql/workbench/services/editData/common/editQueryRunner';
|
||||
import { IRange, Range } from 'vs/editor/common/core/range';
|
||||
@@ -188,7 +187,7 @@ export class QueryManagementService implements IQueryManagementService {
|
||||
provider: providerId,
|
||||
};
|
||||
if (runOptions) {
|
||||
assign(data, {
|
||||
Object.assign(data, {
|
||||
displayEstimatedQueryPlan: runOptions.displayEstimatedQueryPlan,
|
||||
displayActualQueryPlan: runOptions.displayActualQueryPlan
|
||||
});
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
import { EditorExtensions, EditorInput } from 'vs/workbench/common/editor';
|
||||
import { EditorExtensions } from 'vs/workbench/common/editor';
|
||||
import { EditorInput } from 'vs/workbench/common/editor/editorInput';
|
||||
import { IEditorDescriptor, IEditorRegistry } from 'vs/workbench/browser/editor';
|
||||
|
||||
import { Registry } from 'vs/platform/registry/common/platform';
|
||||
|
||||
@@ -16,8 +16,8 @@ suite('Query Editor Service', () => {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
const editorService = instantiationService.invokeFunction(accessor => accessor.get(IEditorService));
|
||||
const untitledService = instantiationService.invokeFunction(accessor => accessor.get(IUntitledTextEditorService));
|
||||
const openStub = sinon.stub(editorService, 'openEditor', () => Promise.resolve());
|
||||
sinon.stub(editorService, 'createEditorInput', () => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const openStub = sinon.stub(editorService, 'openEditor').callsFake(() => Promise.resolve(undefined));
|
||||
sinon.stub(editorService, 'createEditorInput').callsFake(() => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const queryEditorService = instantiationService.createInstance(QueryEditorService);
|
||||
|
||||
await queryEditorService.newSqlEditor({ open: true });
|
||||
@@ -29,8 +29,8 @@ suite('Query Editor Service', () => {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
const editorService = instantiationService.invokeFunction(accessor => accessor.get(IEditorService));
|
||||
const untitledService = instantiationService.invokeFunction(accessor => accessor.get(IUntitledTextEditorService));
|
||||
const openStub = sinon.stub(editorService, 'openEditor', () => Promise.resolve());
|
||||
sinon.stub(editorService, 'createEditorInput', () => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const openStub = sinon.stub(editorService, 'openEditor').callsFake(() => Promise.resolve(undefined));
|
||||
sinon.stub(editorService, 'createEditorInput').callsFake(() => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const queryEditorService = instantiationService.createInstance(QueryEditorService);
|
||||
|
||||
await queryEditorService.newSqlEditor();
|
||||
@@ -42,8 +42,8 @@ suite('Query Editor Service', () => {
|
||||
const instantiationService = workbenchInstantiationService();
|
||||
const editorService = instantiationService.invokeFunction(accessor => accessor.get(IEditorService));
|
||||
const untitledService = instantiationService.invokeFunction(accessor => accessor.get(IUntitledTextEditorService));
|
||||
const openStub = sinon.stub(editorService, 'openEditor', () => Promise.resolve());
|
||||
sinon.stub(editorService, 'createEditorInput', () => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const openStub = sinon.stub(editorService, 'openEditor').callsFake(() => Promise.resolve(undefined));
|
||||
sinon.stub(editorService, 'createEditorInput').callsFake(() => instantiationService.createInstance(UntitledTextEditorInput, untitledService.create()));
|
||||
const queryEditorService = instantiationService.createInstance(QueryEditorService);
|
||||
|
||||
await queryEditorService.newSqlEditor({ open: false });
|
||||
|
||||
Reference in New Issue
Block a user