Formatting conflict [message #1868439] |
Fri, 19 July 2024 13:07  |
Eclipse User |
|
|
|
I'm a bit puzzled by a ConflictingFormattingException while implementing formatting using Xtext 2.34.0:
!MESSAGE org.eclipse.xtext.util.ExceptionAcceptor - Conflicting Regions.
{{{}}}: newLine=2 at offset=286 length=1
[[[]]]: newLine=1-1-2 at offset=286 length=1
My interpretation is that the first region requires 2 new lines while the following region requires at least 1 new line but 2 new lines is the maximum. In this sense, placing 2 new lines between these regions would be the solution, right? Indeed, this is my intention.
So why is this exception thrown?
As can be seen, the first region has while the following region has prepend[setNewLines(1, 1, 2)]
Regards,
Ralph
|
|
|
|
Re: Formatting conflict [message #1868445 is a reply to message #1868442] |
Fri, 19 July 2024 13:41   |
Eclipse User |
|
|
|
(org.eclipse.xtext.formatting2.ConflictingFormattingException) org.eclipse.xtext.formatting2.ConflictingFormattingException: Conflicting values for 'newLineMin': '2' and '1'.
cannot tell you what the design considerations are for that
|
|
|
Re: Formatting conflict [message #1868448 is a reply to message #1868445] |
Fri, 19 July 2024 15:04   |
Eclipse User |
|
|
|
I can reproduce the issue in the Entities example from Bettini' book.
In the EntitiesFormatter.xtend file, just add a to the attribute at line 44:
attribute.prepend[newLine].append[setNewLines(1, 1, 2)]
Three following sample.entities code will reproduce the exception:
entity MyFirstEntity {
string s;
int a;
}
[Updated on: Fri, 19 July 2024 15:10] by Moderator Report message to a moderator
|
|
|
|
Re: Formatting conflict [message #1868457 is a reply to message #1868451] |
Fri, 19 July 2024 18:16   |
Eclipse User |
|
|
|
You're right, of course I can find a workaround but in this case I think it might be a bug that needs to be reported.
I didn't look at the source code yet because I don't have time at the moment... unfortunately.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03594 seconds