Skip to content

Commit 5a4cbb1

Browse files
committed
file associations should be unique by pattern, not system id
Fixes #1053 Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent 18766de commit 5a4cbb1

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/api/xmlExtensionApiImplementation.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ export function getXmlExtensionApiImplementation(languageClient: LanguageClient,
4343
addXMLFileAssociations: (fileAssociations: XMLFileAssociation[]) => {
4444
const externalfileAssociations = externalXmlSettings.xmlFileAssociations;
4545
fileAssociations.forEach(element => {
46-
if (!externalfileAssociations.some(fileAssociation => fileAssociation.systemId === element.systemId)) {
46+
if (!externalfileAssociations.some(fileAssociation => fileAssociation.pattern === element.pattern)) {
4747
externalfileAssociations.push(element);
4848
}
4949
});
@@ -54,7 +54,7 @@ export function getXmlExtensionApiImplementation(languageClient: LanguageClient,
5454
removeXMLFileAssociations: (fileAssociations: XMLFileAssociation[]) => {
5555
const externalfileAssociations = externalXmlSettings.xmlFileAssociations;
5656
fileAssociations.forEach(element => {
57-
const itemIndex = externalfileAssociations.findIndex(fileAssociation => fileAssociation.systemId === element.systemId) //returns -1 if item not found
57+
const itemIndex = externalfileAssociations.findIndex(fileAssociation => fileAssociation.pattern === element.pattern) //returns -1 if item not found
5858
if (itemIndex > -1) {
5959
externalfileAssociations.splice(itemIndex, 1);
6060
}

src/settings/settings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ export function getXMLSettings(javaHome: string | undefined, logfile: string, ex
243243
}
244244
})
245245
externalXmlSettings.xmlFileAssociations.forEach(element => {
246-
if (!xml['xml']['fileAssociations'].some(fileAssociation => fileAssociation.systemId === element.systemId)) {
246+
if (!xml['xml']['fileAssociations'].some(fileAssociation => fileAssociation.pattern === element.pattern)) {
247247
xml['xml']['fileAssociations'].push(element);
248248
}
249249
});

0 commit comments

Comments
 (0)