zazuko/xrm

Auto format messes with multiline comments

Closed this issue · 2 comments

vhf commented

When Xtext formats an XRM file, it pulls the next } to the end of the last line with */.

Before (not a diff, just using it to highlight things):

map AuthorRelation from curator51.rel_au_taxonomy_authors {
	subject template "https://repo.docuteam.ch/relations/creation/{0}" with id;

	types
		rico.CreationRelation

	properties
		rico.creationWithRole constant "https://repo.docuteam.ch/vocabularies/roleTypes#Author";
		rico.creationRelationHasSource template "https://repo.docuteam.ch/recordresources/{0}" with au_id;
		rico.creationRelationHasTarget template "https://repo.docuteam.ch/agents/{0}" with taxonomy_id;
		rico.certainty from is_approved;
+ 		example.text from is_direct; /* deprecated? */
}

After formatting:

map AuthorRelation from curator51.rel_au_taxonomy_authors {
	subject template "https://repo.docuteam.ch/relations/creation/{0}" with id;

	types
		rico.CreationRelation

	properties
		rico.creationWithRole constant "https://repo.docuteam.ch/vocabularies/roleTypes#Author";
		rico.creationRelationHasSource template "https://repo.docuteam.ch/recordresources/{0}" with au_id;
		rico.creationRelationHasTarget template "https://repo.docuteam.ch/agents/{0}" with taxonomy_id;
		rico.certainty from is_approved;
+		example.text from is_direct; /* deprecated? */ }

Note-to-self: There's also another issue #79 with formatting related to comments. Maybe related

Unable to reproduce the reported behavior in xrm 1.2.0 (xtext 2.26).

I tried to reproduce with runtime-EclipseXtext/airport-mapping/airport-mapping.xrm in Eclipse and also in vscode and cannot observe the described effect of the next } beeing pulled to the end of the last line.

The following snippet does not get modified in the reported way by the formatter:

output csvw

// based on http://rml.io/spec.html#example-CSV
map AirportMapping from airport {
	subject template "http://airport.example.com/{0}" with id;

	types
		transit.Stop

	properties
		transit.route from stop with datatype xsd.int;
		wgs84_pos.lat from latitude;
		wgs84_pos.long from longitude;
		ex.owner from ownership;
		ex.marker constant "foobar"; /* deprecated? */		
}

map CityMapping from city {
	subject template "http://city.example.com/{0}/{1}/{2}" with continent country city;

	types
		schema.City /* deprecated? */
}

Closing this.