Extensions get used even if document doesn't match
See original GitHub issueAs mentioned here, Lemminx-Maven’s “participants” (eg. DiagnosticParticipant) seems to be still used even if the document doesn’t match.
Our implementation of IXMLExtension.match() looks like:
public static boolean match(DOMDocument document) {
return document.getDocumentURI().endsWith(pom.xml);
}
As a workaround, I’m going to try adding the following to each “participant” to prevent processing a non-pom.xml file:
if (!MavenPlugin.match(...)) {
return;
}
I haven’t looked into how IXMLExtension.match() is being used, but I imagine it’s used to determine whether or not an extension should be started up or not. Perhaps it should also be used when going through the extension registry to determine if an extension’s “participant” function should be called or not.
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Word cannot open file because file format does not match file ...
The simplest method to resolve this issue is to change the extension for the file manually. To do so, right-click the file and...
Read more >Regex pattern that does not match certain extensions?
I am trying to figure out how to make it not match ANY .jpg files even if the file's name has 2 or...
Read more >[Solved] The File Format Does Not Match the File Extension
Solution 1: Change the File Extension Manually. Changing the file extension manually may work when you encounter the “the file format does not ......
Read more >A file is in a different format than its extension indicates in Excel
When you open a file in Excel, you get an message that the file name extension doesn't match the actual file format. For...
Read more >Chrome Extensions content scripts
In these cases, the URL will not match the content script's pattern (and, in the case of about: and data: , do not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I totally agree that a kind of matcher must be provided because we do that for instance to avoid validating a XML file with the XSD validator which validate syntax of XML Schema (xs:element, etc) and should not be applied for a simple XML file. See https://github.com/eclipse/lemminx/blob/d0a94fd0a9a588450e63f9c2b622c90b0b09b743/org.eclipse.lemminx/src/main/java/org/eclipse/lemminx/extensions/xsd/participants/diagnostics/XSDDiagnosticsParticipant.java#L32
I already thought about and my idea was:
IXMlExtension#startYou’re right, my mistake. We just happen to have it defined in our class which implements the IXMLExtension interface.