eclipse-ocl / org.eclipse.ocl

Eclipse Public License 2.0
0 stars 0 forks source link

[editors] AS2CS surrounds navigation operators with whitespace #1432

Open eclipse-ocl-bot opened 2 hours ago

eclipse-ocl-bot commented 2 hours ago

| --- | --- | | Bugzilla Link | 456524 | | Status | NEW | | Importance | P3 normal | | Reported | Jan 02, 2015 09:10 EDT | | Modified | Jan 02, 2015 15:26 EDT | | Reporter | Ed Willink |

Description

No EssentialOCLFormatter rule is provided for binary operators (including navigation operators) so all are surrounded by default whitespace.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Jan 02, 2015 09:37

The Xtext formatting rules have limited capability. With the grammar as it stands the only change that has any effect is no-space-around the name-assignment. A finer-grained config for the different name-assignment-sources is ignored.

Not even changing the grammar to

(name=InfixOperatorName | name=NavigationOperatorName)

so that there two different name assignments to configure differently has any effect. It seems that the non-space setting overrides the other.

Clearly an Xtext bug.

There are other limitations too related to comments.

Need to dig deep into the Xtext serializer so that we can add overrides that work.

For now we must choose:

spaces around navigation\ no spaces around infixes

no-spaces seems the better choice since navigation is more prolific.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Jan 02, 2015 09:50

(In reply to Ed Willink from comment #1)

no-spaces seems the better choice since navigation is more prolific.

Pushed to master for M5:

commit 9a853892d36664784a14def18665f67d63e84788

(Bug stays open since infix operators no longer have surrounding spaces.)

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Jan 02, 2015 10:56

QVTd master tests just failed. No spaces around an "and" infix operator gives illegal source text.

eclipse-ocl-bot commented 2 hours ago

By Ed Willink on Jan 02, 2015 15:26

The serilaization goes through the ValueConverterService so we can add a BinaryOperatorName that wraps spaces around Infix but nort Navigation operators allowing the outer ExpCS formatting to strip spaces.

Pushed to master for M5.

commit 1a36000db8f818bb9afedc09240b4ee7bb12b1c2