Skip to main content



      Home
Home » Modeling » TMF (Xtext) » [Xtext] Editor doesn't show "import" proposal
[Xtext] Editor doesn't show "import" proposal [message #32766] Thu, 19 March 2009 11:39 Go to next message
Eclipse UserFriend
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 #32812 is a reply to message #32766] Thu, 19 March 2009 11:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi Ilyas,

I'm afraid that the content assist in the last milestone has some
glitches. As this behaviour is not expected, please file a bug.

Regards,
Sebastian

Ilyas Keser schrieb:
> 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 #32828 is a reply to message #32812] Thu, 19 March 2009 12:33 Go to previous messageGo to next message
Eclipse UserFriend
Sebastian Zarnekow wrote:

> Hi Ilyas,

> I'm afraid that the content assist in the last milestone has some
> glitches. As this behaviour is not expected, please file a bug.

> Regards,
> Sebastian

> Ilyas Keser schrieb:
>> 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
>>
>>
Hi Sebastian,

submitted: https://bugs.eclipse.org/bugs/show_bug.cgi?id=269405

Regards,
ILyas
Re: [Xtext] Editor doesn't show "import" proposal [message #32887 is a reply to message #32766] Fri, 20 March 2009 20:59 Go to previous messageGo to next message
Eclipse UserFriend
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
Re: [Xtext] Editor doesn't show "import" proposal [message #32922 is a reply to message #32887] Sat, 21 March 2009 06:00 Go to previous message
Eclipse UserFriend
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
>
>
>
Previous Topic:[Announce] TMF XTEXT 0.7.0M6 is available
Next Topic:Re: External Models with xtext and xpand
Goto Forum:
  


Current Time: Fri May 09 14:05:35 EDT 2025

Powered by FUDForum. Page generated in 0.04481 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top