title: Xtext entity example, primitive type
body: <p>What I'm trying to do, is modify a bit the basic <code>entity</code> DSL example, so that it supports primitives, and something like this can be done:</p>
  
  <pre><code>entity Dog {
     name : String
  }
  
  entity Person {
     name : String
     dog : Dog
  }
  </code></pre>
  
  <p>So that the type of the members can be either a reference to the name of another entity, or a predefined primitive. I'm also looking for a way, so there is content assist in the generated editor for both the primitives, and the entity names.</p>
  
  <p>Here is my <code>.xtext</code> so far:</p>
  
  <pre><code>Model:
      (entites+=Entity)*;
  
  Entity:
      'entity' name=ID '{'
      (members+=Member)*
      '}';
  
  AbstractType:
      Entity | PrimitiveType;
  
  PrimitiveType:
      name='Integer' | name='String';
  
  Member:
      (many?='many')? name=ID ':' (type=[AbstractType]);
  </code></pre>
  
  <p>In this case, <code>Integer</code> and <code>String</code> are recognized by the editor as keywords, but they are marked as error, with the message: </p>
  
  <blockquote>
    <p>mismatched input 'Integer' expecting RULE_ID</p>
  </blockquote>
  
  <p>I tried using the solution for this question:
  <a href="https://stackoverflow.com/questions/19460519/defining-primitives-within-xtext-grammar">Defining Primitives within xtext Grammar</a> ,
  which was half-decent, because the primitives were not marked as error, but there were no content assist for them.</p>
  
  <p><strong>So what is the proper way of doing this?</strong></p>