-
Notifications
You must be signed in to change notification settings - Fork 93
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
Suppress validation kinds based on file pattern #1290
Conversation
It starts working. If you add in your "xml.validation.filters": [
{
"pattern": "**.exsd",
"enabled": false
},
{
"pattern": "**{.project,.classpath,plugin.xml,feature.xml}",
"noGrammar": "ignore"
}
] But if you don't set this settings (not validation filter settings), LemMinx will use internally this default settings. It should disable validation for exsd files, and disable the noGrammar hint for plugin.xml, .classpath, .project files. I have not managed severity for error code because we don't need it for the moment. The main idea that I implemented is that you can define all validation settings (xml.validation.enabled, xml.validation.noGrammar, etc) see https://github.com/redhat-developer/vscode-xml/blob/main/docs/Validation.md that we have for a given pattern. For instance by default we have:
For plugin.xml we don't want this "hint", so you can write a filter like this: {
"pattern": "plugin.xml",
"noGrammar": "ignore"
}, Here the result: No I need to define this settings by default on LemMinX side |
7868775
to
0ba0052
Compare
} | ||
|
||
private static XMLValidationFilter[] createDefaultFilters() { | ||
List<XMLValidationFilter> filters = new ArrayList<>(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merks here the default validation filter that LemMinX will use by default. Do you see another filter which should be done for other files?
fbac28c
to
c7657a7
Compare
Thanks for asking. With PDE there are also *.product files (root element ) for defining products, *.target files (root element ) for defining target platforms, and category.xml (root element ) for defining update sites. |
17cc7fa
to
f67c62a
Compare
Oh yes you are right, thanks for your feedback. I add those 3 file patterns. Thanks! |
f67c62a
to
782b6ef
Compare
@datho7561 please see too the vscode-xml PR redhat-developer/vscode-xml#774 which provides this new validation filter setting. |
782b6ef
to
03af362
Compare
@merks I have tested quickly with WWD and my PR and I can confirm that it works: You will benefit with No grammar constraints for other XML files and not for plugin.xml for instance: and you will continue to benefit with XML syntax validation from LemMinX in plugin.xml: |
@angelozerr Thanks! And also thanks from the uncounted users!! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works well. I also tried out the binary using neovim (so the lemminx settings use the defaults), and it works properly there as well. There we a few things I noticed in the code, and once they are addressed I think it should be good to merge.
...rc/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationSettings.java
Show resolved
Hide resolved
.../src/main/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationFilter.java
Show resolved
Hide resolved
...ain/java/org/eclipse/lemminx/extensions/contentmodel/settings/XMLValidationRootSettings.java
Show resolved
Hide resolved
ee5a35e
to
e69d450
Compare
Fixes eclipse-lemminx#1275 Signed-off-by: azerr <azerr@redhat.com>
To be consistent with symbol filter, I add it those XML validation filter classes in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, Angelo!
Suppress validation kinds based on file pattern
Fixes #1275
Signed-off-by: azerr azerr@redhat.com