Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Import and content assist
icon5.gif  Import and content assist [message #1227102] Fri, 03 January 2014 14:54 Go to next message
Jeff MAURY is currently offline Jeff MAURYFriend
Messages: 44
Registered: July 2009
Member
I am working on a XType based grammar for a JVM based language called Golo.

This language has import statements that are slightly different from the one provided by Xtype as it allows only JVM type or JVM package imports.

Once you've specified your imports, you can extend a JVM type with the augment statement.

My idea is to override the XImportDeclaration with:

XImportDeclaration:
'import' (
importedType=[JvmDeclaredType|QualifiedName]
| importedNamespace=QualifiedName)
;

So, I'm facing an issue: both item have a QualifiedName syntax so I could keep a single item but I could not find something like JvmDeclaredNamespace. If I keed only the first item, then the content assist will propose only JVM declared types and not JVM declared packages. How can I achieve such functionality ?
Re: Import and content assist [message #1228307 is a reply to message #1227102] Mon, 06 January 2014 23:18 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3108
Registered: July 2009
Senior Member
Am 03.01.14 15:54, schrieb Jeff MAURY:
> I am working on a XType based grammar for a JVM based language called Golo.
>
> This language has import statements that are slightly different from the
> one provided by Xtype as it allows only JVM type or JVM package imports.
>
> Once you've specified your imports, you can extend a JVM type with the
> augment statement.
>
> My idea is to override the XImportDeclaration with:
>
> XImportDeclaration: 'import' (
> importedType=[JvmDeclaredType|QualifiedName] |
> importedNamespace=QualifiedName)
> ;
>
> So, I'm facing an issue: both item have a QualifiedName syntax so I
> could keep a single item but I could not find something like
> JvmDeclaredNamespace. If I keed only the first item, then the content
> assist will propose only JVM declared types and not JVM declared
> packages. How can I achieve such functionality ?

Hi Jeff,

that is not possible. There is no way to destinguish between the cross
reference and a plaing value.

You could tweak the linking such that it ignores the unresolvable
reference if you try to load a jvmDeclaredType with the name of a
package. See ILinkingDiagnosticMessageProvider.

Regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: Import and content assist [message #1228450 is a reply to message #1228307] Tue, 07 January 2014 09:02 Go to previous message
Jeff MAURY is currently offline Jeff MAURYFriend
Messages: 44
Registered: July 2009
Member
Thanks for the tip.
I have another question regarding the content assist. If I keep the declaration as a jvmDeclaredType, then the content assist will propose only Java types and not Java packages, right ? So I should complete the content assist with Java packages, no ?
Previous Topic:Is the ext. point "org.eclipse.xtext.ui.shared.sharedStateContributingModule" public API?
Next Topic:DSL with mixed form/text sintax - selecting different start rules for EmbeddedEditor instances
Goto Forum:
  


Current Time: Sat Jul 04 18:44:09 GMT 2020

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

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

Back to the top