diff --git a/src/sql/platform/connection/common/connectionProfile.ts b/src/sql/platform/connection/common/connectionProfile.ts index 13751a91b8..4ad2a59ea1 100644 --- a/src/sql/platform/connection/common/connectionProfile.ts +++ b/src/sql/platform/connection/common/connectionProfile.ts @@ -7,7 +7,6 @@ import { ConnectionProfileGroup } from 'sql/platform/connection/common/connectio import * as azdata from 'azdata'; import { ProviderConnectionInfo } from 'sql/platform/connection/common/providerConnectionInfo'; import * as interfaces from 'sql/platform/connection/common/interfaces'; -import { equalsIgnoreCase } from 'vs/base/common/strings'; import { generateUuid } from 'vs/base/common/uuid'; import { ICapabilitiesService } from 'sql/platform/capabilities/common/capabilitiesService'; import { isString } from 'vs/base/common/types'; @@ -83,15 +82,8 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa this.options['databaseDisplayName'] = this.databaseName; } - public static matchesProfile(a: interfaces.IConnectionProfile, b: interfaces.IConnectionProfile): boolean { - return a && b - && a.providerName === b.providerName - && ConnectionProfile.nullCheckEqualsIgnoreCase(a.serverName, b.serverName) - && ConnectionProfile.nullCheckEqualsIgnoreCase(a.databaseName, b.databaseName) - && ConnectionProfile.nullCheckEqualsIgnoreCase(a.userName, b.userName) - && ConnectionProfile.nullCheckEqualsIgnoreCase(a.options['databaseDisplayName'], b.options['databaseDisplayName']) - && a.authenticationType === b.authenticationType - && a.groupId === b.groupId; + public static matchesProfile(a: interfaces.IConnectionProfile | undefined, b: interfaces.IConnectionProfile | undefined): boolean { + return a && b && a.getOptionsKey() === b.getOptionsKey(); } public matches(other: interfaces.IConnectionProfile): boolean { @@ -99,15 +91,6 @@ export class ConnectionProfile extends ProviderConnectionInfo implements interfa } - private static nullCheckEqualsIgnoreCase(a?: string, b?: string) { - if (a && !b || b && !a) { - return false; - } else { - let bothNull: boolean = !a && !b; - return bothNull ? bothNull : equalsIgnoreCase(a!, b!); - } - } - public generateNewId() { this._id = generateUuid(); } diff --git a/src/sql/platform/connection/test/node/connectionStatusManager.test.ts b/src/sql/platform/connection/test/node/connectionStatusManager.test.ts index e0cd0dd81e..6827ea5876 100644 --- a/src/sql/platform/connection/test/node/connectionStatusManager.test.ts +++ b/src/sql/platform/connection/test/node/connectionStatusManager.test.ts @@ -251,6 +251,7 @@ suite('SQL ConnectionStatusManager tests', () => { newConnection.options['databaseDisplayName'] = newConnection.databaseName; connections.addConnection(newConnection, 'test_uri_1'); connections.addConnection(newConnection, 'test_uri_2'); + newConnection = new ConnectionProfile(capabilitiesService, newConnection); // Get the connections and verify that the duplicate is only returned once let activeConnections = connections.getActiveConnectionProfiles();