2

I've got the following Xtext grammar:

Model:
    'model' name = ID imports += Import* items += Item* rules += Rule*;

Import:
    'import' importURI = STRING;

Rule:
    'rule' name = ID '(' items += [Item]* ')';

Item:
    'item' name = ID;

When opening the editor, all Item references in Rules are hilighted correctly if they are in the same file, and I can jump to the declaration using F3. However, that doesn't work if I try to import them from other files. For example:

File first.mydsl

model first
import "second.mydsl"
rule myRule (second) 

File second.mydsl

model second
item second

Assuming these two files are in the same folder, it still won't find the 'second' reference from the imported file. It also doesn't work if I include the file extension for the imported file, or the full path. How do I get Xtext to recognize the imported file?

(crossposted to http://www.eclipse.org/forums/index.php/m/805182/#msg_805182)

Jorn
  • 20,612
  • 18
  • 79
  • 126

1 Answers1

0

please make sure you configure your workflow as follows

        // scoping and exporting API
        fragment = scoping.ImportURIScopingFragment {}
        fragment = exporting.SimpleNamesFragment {}

        // scoping and exporting API
        // fragment = scoping.ImportNamespacesScopingFragment {}
        // fragment = exporting.QualifiedNamesFragment {}
        // fragment = builder.BuilderIntegrationFragment {}
        ....
        // fragment = types.TypesGeneratorFragment {}
Christian Dietrich
  • 11,778
  • 4
  • 24
  • 32
  • I changed my config as you suggested. Now it's throwing `java.lang.IllegalStateException: Cannot override final binding 'final org.eclipse.xtext.naming.IQualifiedNameProvider -> org.eclipse.xtext.naming.SimpleNameProvider (contributed by org.eclipse.xtext.generator.exporting.SimpleNamesFragment)'` whenever I generate the artifacts. – Jorn Aug 27 '12 at 11:23
  • have you added something else to your workflow? can you post the complete stacktrace? – Christian Dietrich Sep 04 '12 at 19:30