Given the following grammar:
grammar org.xtext.example.mydsl.MyDsl with org.eclipse.xtext.common.Terminals
generate myDsl "http://www.xtext.org/example/mydsl/MyDsl"
Module:
(imports+=Import)*
"Module" name=ID "{"
(enitities+=Entity)*
'}'
;
Entity:
'entity' name=ID '{'
(references+=Reference)*
'}';
Reference:
to=[Entity] name=ID ';'
;
Import:
'import' importedNamespace=QualifiedNameWithWildCard;
QualifiedNameWithWildCard :
QualifiedName ('.' '*')?;
QualifiedName:
ValidID (=>'.' ValidID)*;
ValidID:
ID
;
and the following 2 models:
x.mydsl:
Module x {
entity X1 { }
entity X2 {
X1 x1;
}
}
and y.mydsl:
import x.*
Module y {
entity Y {
X1 a;
}
}
There is a 'grey' error in model editor for y.mydsl:
And a 'red' error In Problems view: Couldn't resolve reference to Entity X1.
Auto-Completion feature works as expected: all local and imported references are shown.
The language project was generated by Xtext wizard with default settings and the language runtime has been customized with two Guice bindings:
- IQualifiedNameProvider => DefaultDeclarativeQualifiedNameProvider.
- IScopeProvider => ImportedNamespaceAwareLocalScopeProvider.
The version of Xtext bundle is:
org.eclipse.xtext_2.0.1.v201107070603
What is wrong with resolving references? Do I need to customize ImportedNamespaceAwareLocalScopeProvider?