Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

externalXmlSettings.xmlFileAssociations not used in getXMLSettings #698

Closed
JuneStepp opened this issue Apr 16, 2022 · 1 comment · Fixed by #699
Closed

externalXmlSettings.xmlFileAssociations not used in getXMLSettings #698

JuneStepp opened this issue Apr 16, 2022 · 1 comment · Fixed by #699
Labels
bug Something isn't working
Milestone

Comments

@JuneStepp
Copy link
Contributor

JuneStepp commented Apr 16, 2022

It looks like getXMLSettings doesn't use external XML file associations, causing that part of the Typescript API to be broken.

Currently, the code is:

//applying externalXmlSettings to the xmlSettings
  externalXmlSettings.xmlCatalogs.forEach(catalog => {
    if (!xml['xml']['catalogs'].includes(catalog)) {
      xml['xml']['catalogs'].push(catalog);
    }
  })

when it probably should be something like:

  //applying externalXmlSettings to the xmlSettings
  externalXmlSettings.xmlCatalogs.forEach(catalog => {
    if (!xml['xml']['catalogs'].includes(catalog)) {
      xml['xml']['catalogs'].push(catalog);
    }
  })
  externalXmlSettings.xmlFileAssociations.forEach(element => {
    if (!xml['xml']['fileAssociations'].some(fileAssociation => fileAssociation.systemId === element.systemId)) {
      xml['xml']['fileAssociations'].push(element);
    }
  });

This was the only way I was able to get the addXMLFileAssociations function of the API to work, but please tell me if I'm just missing something. I have practically no experience with typescript or vscode extensions.

@JuneStepp
Copy link
Contributor Author

Looks like the right code was there in the original pull request but got lost here: https://github.com/redhat-developer/vscode-xml//commit/72cce613494b149fec2d79fe5de81409c5c6db3f when another feature was added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants