[xtext 2] Some problems with qualified names [message #663041] |
Sat, 02 April 2011 16:42 |
Alex Ruiz Messages: 103 Registered: March 2011 |
Senior Member |
|
|
Greetings,
This is really 2 questions in one shot:
1. In order to override how qualified names are created, I created my own IQualifiedNameProvider that extends DefaultDeclarativeQualifiedNameProvider. It is doing its job, as far as I can tell. The problem is that in the editor, I get errors because elements cannot be resolved (the error message is "could not resolve reference to..") In the editor, I've been trying to use both simple names and qualified names (e.g. "Name" and "mypackage.Person.Name" but it doesn't work. My guess is that I need to do something else to have this recognized, but so far, I haven't found where
2. Once #1 is solved, I wonder if Xtext out of the box will resolve reference when elements in the editor are declared with simple and complex names. For example, if I type "Name" or "myPackage.Person.Name" XText will resolve both to the type Name.
Many thanks in advance,
-Alex
[Updated on: Sun, 03 April 2011 08:14] Report message to a moderator
|
|
|
|
|
Re: Some problems with qualified names [message #663059 is a reply to message #663055] |
Sat, 02 April 2011 21:37 |
|
Hi,
first if you are using Xtext 2.0.0 you should mention this in your posts since Xtext 2.0.0 is still in development and there are some API changes between the versions. The current production release is Xtext 1.0.2.
I tried you reproduce your problem using Xtext 2.0.0 M6 and found following
Since your grammar lacks the actual interesing thing (the reference/the imports) i slightly modified it and ignored the importing topic.
Message:
'message' name=ID '{'
otherMessage=[Message|QualifiedName]
('extensions' extensionsFrom=INT 'to' (extensionsTo=INT | 'max') ';')?
'}';
when binding the QNP in my runtime module
public class MyDslRuntimeModule extends org.xtext.example.mydsl.AbstractMyDslRuntimeModule {
@Override
public Class<? extends IQualifiedNameProvider> bindIQualifiedNameProvider() {
return MyQNP.class;
}
}
it works nice with following sample models
package other;
message b
{
test.a
extensions 1 to 2;
}
package test;
message a
{
other.b
extensions 1 to 2;
}
~Christian
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
Powered by
FUDForum. Page generated in 0.03060 seconds