| Summary: | [Xtext] Grammar formatting rules | ||
|---|---|---|---|
| Product: | [Modeling] TMF | Reporter: | Sebastian Zarnekow <sebastian.zarnekow> |
| Component: | Xtext | Assignee: | Project Inbox <tmf.xtext-inbox> |
| Status: | CLOSED FIXED | QA Contact: | |
| Severity: | major | ||
| Priority: | P3 | CC: | jan, moritz.eysholdt |
| Version: | 1.0.0 | Flags: | sebastian.zarnekow:
helios+
|
| Target Milestone: | RC1 | ||
| Hardware: | PC | ||
| OS: | Mac OS X - Carbon (unsup.) | ||
| Whiteboard: | |||
|
Description
Sebastian Zarnekow
So who needs to adopt? ;) The existing grammars or the formatter? One question for the formatter that can be discussed is, whether semicolons should be at the end of the line (java-style) or on a single line (antlr-style). Yesterday I changed the formatter to antlr-style, since that is what we use in Xtext.xtext. But I don't have a strong opinion on this. I haven't found a way to introduce line breaks in a rule's body in a reasonable way, though. Except for autowrap after a certain length of the line is exceeded, of course. - What I especially request is the grammar declaration to appear on one line if it does not exceed 120 chars: grammar foo with bar hidden(zonk) grammar long.foo with long.bar hidden(zonk) grammar very.long.foo with very.long.bar hidden(zonk) - I like the semicolons in new lines. - I guess line-breaks in rules cannot be implemented reasonable without information about the actual model so if it is possible to keep the line-breaks in the rules as is (if not > 120 chars), that would be helpful. So the answer seems to be "both" :-) Fixed the formatter-side in HEAD. (In reply to comment #2) > - What I especially request is the grammar declaration to appear on one line if > it does not exceed 120 chars. This was intended to be a feature. But anyway, it's in one line now. > - I like the semicolons in new lines. I've changed that back to have the semicolons at the end of the lines. This way grammars consume less lines of code and thereby for example fit better on a demo screen/presentation slide. > - I guess line-breaks in rules cannot be implemented reasonable without > information about the actual model true, semantic formatting would be needed for this. > so if it is possible to keep the line-breaks > in the rules as is (if not > 120 chars), that would be helpful. it is, linbreaks within the body of a rule are now kept by the formatter. The grammar that is created by the new-project-wizard and the grammars of Xtext's example projects are now formatted as the formatter would do it. The ecore2xtext wizard will, however, still create grammars that diverge from the default formatting. Since an Xpand template creates the grammar in this case, the best solution would probably be to run the formatter after a grammar has been created. I'm not sure though whether that's worth the effort. As far as the Ecore2XtextWizard is concerned, I'd prefer not to change the current formatting. It is currently based on semantics, e.g. matching bracket keywords, and kind of optimized in terms of readability. As this was the last remaining issue, I am closing this bug as fixed. Closing bug which were set to RESOLVED before Eclipse Neon.0. |