You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Schema binding by file association with variable works only for active file #629
Now, xml validation works fine for each file individually, but problems are systematically reported for other files:
Selecting data1.xml, it shows that everything is ok in that one, which is correct. But at the same time, in the Problems panel, an error is reported for data2.xml
Same behavior - reversed - when selecting data2.xml:
And when another file is selected, e.g. settings.json, then errors are reported in both xml files:
The problem is, that the predefined variable ${fileBasenameNoExtension} points to the current active file. Consequently the validation schema is selected on the basis of the active file, and that schema is applied to all validated files, which produces wrong validation results.
Would there be a way to correctly retrieve the name of the validated file instead of the name of the active file?
Note: at the moment, I'm generating explicit bindings for each individual file (no predefined variable). Not very elegant, but it works fine in all cases. The thing is, my real dataset is much more elaborate than that simple example, and explicit binding of each file generates a pretty large workspace configuration file.
Indeed there is a problem with fileBasenameNoExtension. We update fileBasenameNoExtension file associations on XML Language Server side for the activated file editor. With your usecase it's indeed unusable.
We need to improve it but Idon't knowwhen we could do that.
Activity
angelozerr commentedon Dec 22, 2021
Indeed there is a problem with fileBasenameNoExtension. We update fileBasenameNoExtension file associations on XML Language Server side for the activated file editor. With your usecase it's indeed unusable.
We need to improve it but Idon't knowwhen we could do that.
angelozerr commentedon Oct 16, 2026
Fixed with eclipse-lemminx/lemminx#1878
It should work now https://github.com/redhat-developer/vscode-xml/blob/main/docs/Validation.md#xml-file-association-with-xsd