Validation error if Import is not present in xtext

138 views Asked by At

In my xtext grammar file to support wildcard import support, i have the following grammar rule.

Import:
   'import' importedNamespace= QualifiedNameWithWildcard  ';'

My requirement is i need to display the validation error if required dependency is not imported. for that i have added following code in grammar but while opening the project the validation error is displayed and disappeared in seconds.

TypeRef:
type=[Type |  QualifiedName ] 

But if i have changed the QualifiedNameWithWildcard with QualifiedName , i am able to show the validation error but wildcard import support is breaking. I have tried the following code it is not working.

Import:
   'import' importedNamespace= QualifiedName ';'

Import:
   'import' importedNamespace= QualifiedName | importedNamespace= QualifiedNameWithWildcard   ';'

Where am i going wrong?

can anyone please explain the following link: Eclipse Xtext Naming where they have mentioned the follwing code is working. Import returns EuclidImport : 'import' ( importedNamespace=QualifiedName | importedNamespace=QualifiedNameWithWildCard) ';'? ;

0

There are 0 answers