reducing cross reference to current DSL file [message #1229358] |
Thu, 09 January 2014 09:25 |
Uli Merkel Messages: 250 Registered: June 2013 |
Senior Member |
|
|
I have a grammar with a cross reference.
This runs fine when I test it. But when I have in my workspace another DSL file with the same extension, the content assist offers me the items defined in my current DSL file as well as the items of the other file as well.
So how can I limit the cross reference to items defined in the current DSL file only?
As a XTEXT/JAVA/... novice, some sample code would be nice.
TIA, Uli
My Grammar is:
grammar de.ulrichmerkel.Narrowcross1 with org.eclipse.xtext.common.Terminals
generate narrowcross1 "http://www.ulrichmerkel.de/Narrowcross1"
Model:
greetings+=Greeting*
sendto+=Areference*;
Greeting:
'Hello' name=ID '!';
Areference:
"sendto" target=[Greeting]
;
And for the Test I have
A1.narrowcross1 as:
Hello Paul !
Hello Peter !
and A2.narrowcross1 as:
Hello Mary !
adding a "sendto", the content assist offers me Peter, Paul and Mary for A1 and A2
But I want to restrict it to "Peter and Paul" for A1 and "Mary" for A2
[Updated on: Thu, 09 January 2014 09:36] Report message to a moderator
|
|
|
|
|
Re: reducing cross reference to current DSL file [message #1229368 is a reply to message #1229365] |
Thu, 09 January 2014 09:52 |
|
Hi,
yes and no.
the delegatiion hierarchy is
AbstractDeclarativeScopeProvider -> ImportedNamespaceAwareLocalScopeProvider -> DefaultGlobalScopeProvider
if you add a scope method to your AbstractDeclarativeScopeProvider you have to explicitely collect all candidate.
if you customize IGlobalScopeProvider (returning IScope::NULLScope)
or use SimpleLocalScopeProvider instead of ImportedNamespaceAwareLocalScopeProvider
you can keep the default behaviour for local files anyway respectively change it
to be local only
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 1.07422 seconds