Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » extending scoping for Xbase 2.4.0
extending scoping for Xbase 2.4.0 [message #1041653] Mon, 15 April 2013 11:21 Go to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1528
Registered: July 2009
Senior Member
Hi

as far as I understand to provide a custom scoping for Xbase 2.4.0 one
has to extend XbaseBatchScopeProvider and then use this binding

@Override
public Class<? extends XbaseBatchScopeProvider>
bindXbaseBatchScopeProvider() {
return MyScopeProvider.class;
}

however, the content assist seems to rely on IScopeProvider which is
bound to XbaseWithAnnotationsScopeProvider which has no relation with
XbaseBatchScopeProvider and indeed my modifications to scoping are not
used by the content assist...

is it a known feature or a bug?

thanks in advance
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Re: extending scoping for Xbase 2.4.0 [message #1041675 is a reply to message #1041653] Mon, 15 April 2013 12:02 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3057
Registered: July 2009
Senior Member
Hi Lorenzo,

2.4 was primarily an Xtend release. The APIs are not yet fully converted
in Xbase thus there's the inconvenient situation that scoping and
content assist have to be implemented separatly - via the
XbaseBatchScopeProvider and the XbaseScopeProvider.

Best regards,
Sebastian
--
Looking for professional support for Xtext, Xtend or Eclipse Modeling?
Go visit: http://xtext.itemis.com

Am 15.04.13 13:21, schrieb Lorenzo Bettini:
> Hi
>
> as far as I understand to provide a custom scoping for Xbase 2.4.0 one
> has to extend XbaseBatchScopeProvider and then use this binding
>
> @Override
> public Class<? extends XbaseBatchScopeProvider>
> bindXbaseBatchScopeProvider() {
> return MyScopeProvider.class;
> }
>
> however, the content assist seems to rely on IScopeProvider which is
> bound to XbaseWithAnnotationsScopeProvider which has no relation with
> XbaseBatchScopeProvider and indeed my modifications to scoping are not
> used by the content assist...
>
> is it a known feature or a bug?
>
> thanks in advance
> Lorenzo
>
Re: extending scoping for Xbase 2.4.0 [message #1041691 is a reply to message #1041675] Mon, 15 April 2013 12:20 Go to previous messageGo to next message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1528
Registered: July 2009
Senior Member
On 04/15/2013 02:02 PM, Sebastian Zarnekow wrote:
> Hi Lorenzo,
>
> 2.4 was primarily an Xtend release. The APIs are not yet fully converted
> in Xbase thus there's the inconvenient situation that scoping and
> content assist have to be implemented separatly - via the
> XbaseBatchScopeProvider and the XbaseScopeProvider.
>
> Best regards,
> Sebastian

OK, so for the moment it's better to factor out scoping functionalities
in a separate class and use this one both in a custom
XbaseBatchScopeProvider and in a custom XbaseScopeProvider

thanks
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Re: extending scoping for Xbase 2.4.0 [message #1698533 is a reply to message #1041691] Tue, 16 June 2015 09:39 Go to previous messageGo to next message
Andreas Gudell is currently offline Andreas GudellFriend
Messages: 1
Registered: June 2015
Junior Member
Hi Lorenzo,

do you have any idea how this works with xtext 2.8?
I have the following ScopeProvider:

public class MyScopeProvider extends XbaseBatchScopeProvider ...

and bind this ScopeProvider in my Runtime-Module with

@Override
public Class<? extends IScopeProvider> bindIScopeProvider() {
return MyScopeProvider.class;
}

The problem is, that it seems to be called only during ContentAssist, but not during the linking phase.

Best regards,
Andreas




Re: extending scoping for Xbase 2.4.0 [message #1698775 is a reply to message #1698533] Wed, 17 June 2015 17:34 Go to previous message
Lorenzo Bettini is currently offline Lorenzo BettiniFriend
Messages: 1528
Registered: July 2009
Senior Member
On 16/06/2015 16:09, Andreas Gudell wrote:
> Hi Lorenzo,
>
> do you have any idea how this works with xtext 2.8?
> I have the following ScopeProvider:
>
> public class MyScopeProvider extends XbaseBatchScopeProvider ...
>
> and bind this ScopeProvider in my Runtime-Module with
>
> @Override
> public Class<? extends IScopeProvider> bindIScopeProvider() {
> return MyScopeProvider.class;
> }
>
> The problem is, that it seems to be called only during ContentAssist,
> but not during the linking phase.
>
> Best regards,
> Andreas
>

Hi Andreas

you need to bind XbaseBatchScopeProvider:

@Override
public Class<? extends XbaseBatchScopeProvider>
bindXbaseBatchScopeProvider() {
return MyScopeProvider.class;
}

by the way, do you really need to customize the XbaseBatchScopeProvider?
Usually, you can customize scoping directly in the TypeComputer (e.g.,
add some variables to the scope)

cheers
Lorenzo

--
Lorenzo Bettini, PhD in Computer Science, DI, Univ. Torino
HOME: http://www.lorenzobettini.it
Xtext Book:
http://www.packtpub.com/implementing-domain-specific-languages-with-xtext-and-xtend/book
Previous Topic:Class access and injection
Next Topic:Content Assist Context
Goto Forum:
  


Current Time: Sat Jul 04 07:10:36 GMT 2015

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

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