zazuko / xrm

A friendly language for mappings to RDF
MIT License
1 stars 0 forks source link

Auto format messes with multiline comments #94

Closed vhf closed 2 years ago

vhf commented 4 years ago

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? */ }
mchlrch commented 4 years ago

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

mchlrch commented 2 years ago

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.