Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 346651 - [grammarEditor] Too many blank lines inserted
Summary: [grammarEditor] Too many blank lines inserted
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 minor (vote)
Target Milestone: M4   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-20 07:48 EDT by Sebastian Zarnekow CLA
Modified: 2017-10-31 11:30 EDT (History)
0 users

See Also:
sven.efftinge: kepler+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Zarnekow CLA 2011-05-20 07:48:27 EDT
Grammar (| is cursor position):

grammar org.xtext.example.mydsl1.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl1/MyDsl"

Model:
	greetings+=Greeting*;

Greeting:
	'Hello' name=ID '!' other=[Greeting]?;

|

Choose 'INT' proposal and you'll get:

grammar org.xtext.example.mydsl1.MyDsl with org.eclipse.xtext.common.Terminals

generate myDsl "http://www.xtext.org/example/mydsl1/MyDsl"
import "http://www.eclipse.org/emf/2002/Ecore" as ecore

  <-- this blank line is not necessary
Model:
	greetings+=Greeting*;

Greeting:
	'Hello' name=ID '!' other=[Greeting]?;

terminal INT returns ecore::EInt:
	
;

=================================
Another case with unwanted blank lines:

Model:
	greetings+=Unknown*;

Greeting:
	'Hello' name=ID '!' other=[Greeting]?;

Choose quickfix 'Create rule Unknown' and you'll end up with:

Model:
	greetings+=Unknown*;

Unknown:
	
;

  <-- this blank line is not necessary
Greeting:
	'Hello' name=ID '!' other=[Greeting]?;
Comment 1 Sven Efftinge CLA 2012-11-21 05:47:30 EST
pushed to master
Comment 2 Eclipse Webmaster CLA 2017-10-31 11:30:52 EDT
Requested via bug 522520.

-M.