Open MLausberg opened 2 years ago
I can reproduce this in my Oomph development environment, but not from a self-hosted SDK launch. Then I noticed it's because the error comes from the language server as you can see from the Type column:
@akurtakov
These kind of errors are of course super disruptive and then to make Eclipse look bad. How does one go about fixing this where the problem is actually located?
These kind of errors are of course super disruptive and then to make Eclipse look bad. How does one go about fixing this where the problem is actually located?
Why is the language server (most probably lemminx) to blame if eclipse generates documents that don't conform to their declared schemas? See https://www.w3.org/2012/04/XMLSchema.xsd and search for appinfo
and you will see that the validator is correct here.
By the way it would be easier to attach source files instead of screenshots.
The problem is that .exsd does not actually conform to the XML Schema specification. It never has and it never will. You can find countless examples .exsd examples in your SDK workspace. Here we see appInfo
appears thousands of times:
The users did not make mistakes, PDE does this for us. So we enter information here:
And then PDE gives us this:
Just search use="default"
in your SDK workspace for examples of this one.
I don't think the user will care who's to blame, but they will be confused and mislead by all the errors. How to make it stop?
The problem is that *.exsd does not actually conform to the XML Schema specification.
The they should not declare this I have choose a random exsd file that states:
<schema targetNamespace="org.eclipse.equinox.p2.artifact.repository" xmlns="http://www.w3.org/2001/XMLSchema">
and that is a XSD schema definition
Here we see
appInfo
appears thousands of times
Making an error a thousand times do not make it correct.
This obviously is a misuses of PDE, actually XML allows extensions (thus its named Extensible Markup Language) but you can't just declare it conforms to a given schema and then blame the validator that is complains you are actually violation the schema... do not kill the messenger.
How to make it stop?
Fix PDE generating invalid XML files...
Just search
use="default"
The valid values are use = (optional | prohibited | required)
so a schema valid would be to set default = "default value" and use = "required"
I would have never considered such a simple, pragmatic solution without you pointing it out. We can "simply" change all existing .exsd files everywhere in the known universe to use another namespace and then change PDE to work with that instead, or likely work with both for backward compatibility. That won't be totally, prohibitively expensive, but it is the only correct solution, technically. Either that or make the syntax conform, which still requires changing all .exsd resources...
But silly me, I thought maybe when PDE's editor is open it would be possible to disable these unhelpful additional validations because PDE already has its own validation already. We could discuss the XML Schema specification at length though. I'm really an expert on this topic because I implemented the XSD model so the XML Schema specification was like a bible to me way back in the early days of Eclipse, when PDE first decided to reuse/abuse the syntax...
It seems I have to disable all three of these not to get errors in the editor:
That's kind of confusing. (And if you disable this while the editor is open, the errors don't go away when you close the editor). I just don't want these things for *.exsd and I expect I'm not the only one.
I would have never considered such a simple, pragmatic solution without you pointing it out.
You asked whats wrong here, but there no grantee that you like the answer ;-)
But silly me, I thought maybe when PDE's editor is open it would be possible to disable these unhelpful additional validations because PDE already has its own validation already.
Obviously this validation do not really validate anything according to the declared schema but about something else only PDE knows about.
I implemented the XSD model so the XML Schema specification was like a bible to me way back in the early days of Eclipse, when PDE first decided to reuse/abuse the syntax...
And now you pay the price for the abuse of that... PDE could/should have simply defined its own XSD schema to conform with and then we won't be in this situation right here. Again you asked why this error is shown and I can only give you an answer about the technical details.
That's kind of confusing.
The only think I can think of is that one might be able to adjust the content-type associations to somehow force eclipse to ignore the fact that this is XML ... but you might loose code-coloring, formatting and autocompletion then in the source-tab. but as your only requirement is
I just don't want these things for *.exsd
it might be sufficient :-)
Sorry for being sarcastic. But only a little very tiny bit... 👅
PDE does declare a content type for this thing:
Ideally we would be able to opt out based on this. Or the Language Server could be "smarter" about seeing this has .exsd extension and not validating it like a .xsd in that case. I don't know the best solution nor what's possible...
Ideally we would be able to opt out based on this. Or the Language Server could be "smarter" about seeing this has .exsd extension and not validating it like a .xsd in that case. I don't know the best solution nor what's possible...
Extension do not matter AFAIK (that's another discussion though ...) but as you see it has "Associated editors" including XML Editor, its just a guess but that might trigger this... by maybe also the fact that is a sub-type of XML!
Do Eclipse-declared content types matter?
The only explicit content type bindings to editors for this content type are just are these
I expect the rest come from the content type hierarchy (XML and then Text).
The target editor also has such an annoying Language Server thing, though just a warning in this case:
But when you work in a warning free workspace, these things are always annoying. Surely the Language Server could be a little bit more aware of PDE's correct XML-based content and not produce such warnings...
The language server in question is https://github.com/eclipse/lemminx . I'm not a developer there so can't help but any ideas for better interoperability should be either reported and done there or at PDE site.
The error reported by the language server are correct from an XML perspective. The exsd fle are indeed incorrect from an XML perspective. So I don't think there is anything to blame in LemMinX here. Possible remediation to make the exsd files correct:
Even if one wants to implement some specific mechanism allowing Wild Web Developer/LemMinX to ignore the .exsd files , then it shouldn't be something to implement in LemMinX but in Wild Web Developer.
Eclipse IDE for RCP and RAP Developers (includes Incubating components)
Version: 2022-06 (4.24.0) Build id: 20220609-1112
When creating a new Extension-Point "*.exsd" in my own Eclipse Plugin, the "Overview" tab does show no errors. But when selecting the "Source" Tab the XML validation claim different Errors (7 items)
src-annotation: <annotation> elements can only contain <appinfo> and <documentation> elements, but 'appInfo' was found.
Renaming the tag
<appInfo>
to<appinfo>
will solve the Errors, but eeverytime i make a change by using the "overview" Tab the Tag switches back to<appInfo>