Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Limiting the scope to elements in the same resource
Limiting the scope to elements in the same resource [message #1142329] Thu, 17 October 2013 14:52 Go to next message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Hello everyone,

in one of my (numerous) Xtext projects I have a fairly straight-forward entity DSL which is compiled and used to populate a database. Usually when creating cross-references, Xtext offers all matching objects from all resources within the project as completion proposals, and normally this is fine. However, in my case, having cross-references between files does not make sense for the use case and may even break the compile process.

So, the question is: what is the simplest way of narrowing down the scope of reference targets to only those objects which are declared in the same file as the reference source object? I tried to use a custom ScopeProvider, but it turned out to be not that easy with all those IEObjectDescription objects involved...


Thanks,


Alan
Re: Limiting the scope to elements in the same resource [message #1142470 is a reply to message #1142329] Thu, 17 October 2013 16:46 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Did you try to change the global scope provider? Or the imported
namespace aware local scope promise I?

--
Need training, onsite consulting or any other kind of help for Xtext?
Go visit http://xtext.itemis.com or send a mail to xtext at itemis dot de


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Limiting the scope to elements in the same resource [message #1143583 is a reply to message #1142470] Fri, 18 October 2013 09:34 Go to previous messageGo to next message
Alan DW is currently offline Alan DWFriend
Messages: 119
Registered: March 2012
Senior Member
Hi Christian,

so far I haven't really changed anything. I tried to implement a custom scope provider by adding code to the auto-generated <LanguageName>ScopeProvider that extends from AbstractDeclarativeScopeProvider, but I must admit that I was unsuccessful in doing so since I don't know all the internals of Xtext. My language does not make use of any kind of "import" statements, does not use Xbase and has no other special features except a custom validator. Where can I find the Global Scope Provider you mentioned?

Thanks,


Alan

[Updated on: Fri, 18 October 2013 09:34]

Report message to a moderator

Re: Limiting the scope to elements in the same resource [message #1143609 is a reply to message #1143583] Fri, 18 October 2013 09:51 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
org.eclipse.xtext.scoping.impl.DefaultGlobalScopeProvider
or ImportedNamespaceAwareLocalScopeProvider.getGlobalScope


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Global vars with "new" GlobalVarExtensions.getGlobalVar
Next Topic:How should an inferrer fail correctly?
Goto Forum:
  


Current Time: Thu Apr 25 09:26:47 GMT 2024

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

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

Back to the top