Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 315624

Summary: [ContentAssist] Provide CA for terminal rules
Product: [Modeling] TMF Reporter: Moritz Eysholdt <moritz.eysholdt>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED DUPLICATE QA Contact:
Severity: enhancement    
Priority: P3 CC: mirko, sebastian.zarnekow
Version: 1.0.0   
Target Milestone: ---   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Moritz Eysholdt CLA 2010-06-03 12:33:54 EDT
Currently, there is no content assist for terminal/datatype rules. However, people sometimes use them to group keywords or allow a particular ambiguity of keywords.

Examples1:
   "foo" | "bar";


terminal Examples2:
   "." | (" " | "\n");


It can be analyzed statically how many possible values for a datatype/terminal rule there are. How about providing content assist if there are... let's say... less then a hundred?
Comment 1 Sebastian Zarnekow CLA 2010-10-05 08:44:18 EDT
100's of synthetic proposals do not seem to be helpful.
Comment 2 Sebastian Zarnekow CLA 2010-10-05 08:46:40 EDT
See also 309303

*** This bug has been marked as a duplicate of bug 309303 ***
Comment 3 Mirko Raner CLA 2011-07-18 01:13:50 EDT
I am not sure whether this is really a duplicate of 309303.
There is a difference in the content assist support between inlined keywords and terminal rules.
For example,

grammar ws.raner.xtext.Fish with org.eclipse.xtext.common.Terminals
generate fish "http://raner.ws/xtext/Fish"
Fish: I LIKE fish=QualifiedFish;
QualifiedFish: qualifier=Qualifier 'fish';
enum Qualifier: one|two|red|blue;
terminal I: 'I';
terminal LIKE: 'like';

will provide no content assist support, but when the terminal rules are replaced by keywords content assist will work:

grammar ws.raner.xtext.Fish with org.eclipse.xtext.common.Terminals
generate fish "http://raner.ws/xtext/Fish"
Fish: 'I' 'like' fish=QualifiedFish;
QualifiedFish: qualifier=Qualifier 'fish';
enum Qualifier: one|two|red|blue;

See http://www.eclipse.org/forums/index.php/mv/msg/220809/ for further discussion of this topic.
Comment 4 Mirko Raner CLA 2011-07-18 01:18:49 EDT
My findings were based on Xtext 2.0.0, so this is still an ongoing problem.