Closed zabetak closed 6 months ago
I can have a look and see it this can be fixed
This can be implemented in PatchedXMLWriter:
@Override
public void write(Document doc) throws IOException {
writeDeclaration();
if (doc.getDocType() != null) {
indent();
writeDocType(doc.getDocType());
}
for (int i = 0, size = doc.nodeCount(); i < size; i++) {
Node node = doc.node(i);
writeNode(node);
}
// This is the line break at the end
writePrintln();
}
First, I need to ask: Does this issue cause problems for you? And how in that case?
🤦 I just realised that spotless is actually using my plugin to process the pom-files. I'll contact them and ask if there are general settings for endWithNewline that I can support.
Well, it is actually not rolled out yet
Many thanks @Ekryd !
Released version 3.4.0 with support for the new parameter endWithNewline
. Please try it out
Currently the plugin enforces the presence of a new line at the end of file; if the new line is not there it will be added by the sort phase. This may or may not be desirable thus usually formatting plugins leave the decision to the user (e.g., spotless provides
endWithNewline
config).Ideally the presence of new line at the end of file should be configurable. For my use-case it would be also acceptable if the new line is not added at all by this plugin since if necessary I could achieve the same effect with other means (i.e., spotless).