redhat-developer / redhat-developer/vscode-xml

Multiple active schemas lead to inconsistencies in UI

Open
#1,090 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
328
Forks
101
Avg merge
1d 17h
Merged PRs (30d)
7

Description

When multiple schemas are active, the schema shown on hover is inconsistent with the errors displayed in the UI.

We developed a VSCode extension for our users that relies on your XML extensions for error highlighting and autocompletion. In our extension, we specify a schema using the XMLFileAssociations API, which works well. However, users can also set their own schema using the "xsi:noNamespaceSchemaLocation" attribute. When two schemas are active, the UI behaves oddly. It seems that the errors displayed in the UI come from the schema linked via the namespace location, but the error popup references the wrong schema. This causes users to think the error originates from the schema we set using the API.

Unfortunately, there's not much we can do about this, as users can set that value themselves. Before we created this extension, this was the default method for users to set the schema.

To reiterate, in our VS-Code extension we us two different ways on specifing a schema:

  1. Via the "xsi:noNamespaceSchemaLocation" attribute.
  2. Via the "schemaVersion" attribute. This way our VS-Code extension sets the correspondig schema via the XMLFileAssociations API.

The idea is that (1) overrides (2) in the RedHat XML extension.

This works basically, the correct schema is shown when hovering any XML tag. Unfortunately, the red underlining (showing errors in XML file) use schema (2), but should use (1).

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing schema selection through the XMLFileAssociations API and the xsi:noNamespaceSchemaLocation and schemaVersion attributes. Reproduce a document with both schemas active and compare hover results with red-underlined diagnostics. Done means the schema selected by xsi:noNamespaceSchemaLocation consistently supplies both the UI errors and hover information.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, vscode
Domain
developer-experience, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.