[Xtext] Editor doesn't show "import" proposal [message #32766] |
Thu, 19 March 2009 11:39  |
Eclipse User |
|
|
|
Hi,
I created a new Xtext project and used the standard grammar of the wizard
to generate the artifacts. Here is again the standard grammar:
grammar org.xtext.example.ToRef with org.eclipse.xtext.common.Terminals
generate toRef "http://www.xtext.org/example/ToRef"
Model :
(imports+=Import)*
(elements+=Class)*;
Import :
'import' importURI=STRING;
Class :
'class' name=ID ('extends' references=[Class])?;
After generating artifacts, I exported the 3 Xtext projects as plugins and
restarted my eclipse environment. To use the generated editor I opened the
model file in the "...generator" project. The editor doesn't suggest the
'import' proposal. 'class' proposal is shown. If I type the import
statement and a URI there is no error message (as expected). But the
'import' proposal is not shown! Is this behavior of the editor normal?
Thanks
Regards,
ILyas
|
|
|
|
|
|
Re: [Xtext] Editor doesn't show "import" proposal [message #32922 is a reply to message #32887] |
Sat, 21 March 2009 06:00  |
Eclipse User |
|
|
|
Hi Ilyas,
if you want to use automagic imports in your dsl and would like to see
error markers for unresolved imported resources, you have to register
the import validator (see
org.eclipse.xtext.crossref.impl.ImportUriValidator and its usages).
The domain model example shows how to use it
(org.eclipse.xtext.example.DomainModelValidator). Maybe we should
register it in the language, that is generated by the wizard?
Hope that helps.
Regarding your experiences with ContentAssist: It seems that it is
seriously broken in M6 and we are actively working on a fix. Sorry for
inconvenience.
Regards,
Sebastian
Ilyas Keser schrieb:
> Hi @all,
>
> as far as I can remember oAW Xtext shows a warning/error message if you
> try to import a model that doesn't exist. For example:
>
>
> import
> " platform-XYZ:resource/org.xtext.example.dsl.generator/src/mo del/bla/MyModel.toRef "
>
>
>
> I am using TMF Xtext M6 and such a message is not shown. Here the my
> model file:
>
>
>
> import "MyModel.toRef"
> //import
> " platform:resource/org.xtext.example.dsl.generator/src/model/ MyModel.toRef "
>
> class X extends Y
>
> class Y
>
> ref ???
>
>
>
> Additionally, at ??? are no proposals shown. My grammar imports an
> existing metamodel and defines a cross reference to it:
>
>
>
> grammar org.xtext.example.DSL with org.eclipse.xtext.common.Terminals
>
> generate dSL "http://www.xtext.org/example/DSL"
>
> import "classpath:/ToRef.ecore" as refModel
>
> Model :
> (imports+=Import)*
> (elements+=Class)*
> (refs+=Ref)*;
>
> Import :
> 'import' importURI=STRING;
>
> Class :
> 'class' name=ID ('extends' references=[Class])?;
>
> Ref:
> 'ref' ref=[refModel::Class];
>
>
>
> And here is the grammar of the imported metamodel:
>
>
>
> grammar org.xtext.example.ToRef with org.eclipse.xtext.common.Terminals
>
> generate toRef "http://www.xtext.org/example/ToRef"
>
> Model :
> (imports+=Import)*
> (elements+=Class)*;
>
> Import :
> 'import' importURI=STRING;
>
> Class :
> 'class' name=ID ('extends' references=[Class])?;
>
>
>
> What am I missing or doing wrong? Any suggestions?
>
> Regards,
> ILyas
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.04481 seconds