Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Autocomplete import statements
Autocomplete import statements [message #642700] Thu, 02 December 2010 12:30 Go to next message
Mark Christiaens is currently offline Mark ChristiaensFriend
Messages: 63
Registered: October 2010
Member
I am using an ImportedNamespaceAwareLocalScopeProvider. It imports namespace based on the presence of importedNamespace attributes in the grammar. It seems to me that an importedNamespace attribute must refer to an object that is a String. Does that mean that there is no way to have autocomplete support for that string?

So what I'd like to do is something like this:

Import: 'import' importedNamespace=QualifiedNameWithWildCard;

QualifiedNameWithWildCard: QualifiedName '.*'?;

QualifiedName:	([NameSpaceSegment|ID] '.')* [DeclaredObject|ID]; 


So I want Xtext to know that NameSpaceSegment and DeclaredObject are references that together constitue a complete import.
Re: Autocomplete import statements [message #642704 is a reply to message #642700] Thu, 02 December 2010 12:47 Go to previous message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Mark,

modeling the qualified name for imports as a cross reference by default
would introduce some limitations. That's why we decided to model it as a
plain string.
To et content assist for imports, I'd try to customize the appropriate
method for the importedNamespace directly. The implemenation could use
the container manager to obtain any visible container for the current
resource and iterate their contents.
It would be even nicer to add imports automatically if an item with a
fully qualified name is choosen from the proposal list for any given
cross ref. Therefore you could implement the
ConfigurableCompletionProposal.IReplacementTextApplier.
See XtextProposalProvider.createOverrideProposal(AbstractRule, Grammar,
ContentAssistContext, ICompletionProposalAcceptor) for an example in the
Xtext 2.0 stream.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 02.12.10 13:30, schrieb Mark Christiaens:
> I am using an ImportedNamespaceAwareLocalScopeProvider. It imports
> namespace based on the presence of importedNamespace attributes in the
> grammar. It seems to me that an importedNamespace attribute must refer
> to an object that is a String. Does that mean that there is no way to
> have autocomplete support for that string?
> So what I'd like to do is something like this:
>
>
> Import: 'import' importedNamespace=QualifiedNameWithWildCard;
>
> QualifiedNameWithWildCard: QualifiedName '.*'?;
>
> QualifiedName: ([NameSpaceSegment|ID] '.')* [DeclaredObject|ID];
>
> So I want Xtext to know that NameSpaceSegment and DeclaredObject are
> references that together constitue a complete import.
Previous Topic:Multiline block
Next Topic:how to eliminate duplicate checking
Goto Forum:
  


Current Time: Thu Apr 25 13:07:46 GMT 2024

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

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

Back to the top