Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Cross references in multiple files
Cross references in multiple files [message #1728366] Sun, 03 April 2016 18:46 Go to next message
Andrey Petrenko is currently offline Andrey PetrenkoFriend
Messages: 8
Registered: March 2016
Junior Member
Hi,
Here is grammar:
MyModel:
	(imports+=Import)*
	(entities+=Entity)*;

Import:
	'import' importURI=STRING;

Entity:
	'entity' name=ID ('extends' extends=[Entity|ID])?;


[first.dsl]
entity Base


[second.dsl]
import "first.dsl"

entity Entity extends Base

but `Base` highlighted in red with error message: "Couldn't resolve reference to Entity 'Base'"

I've read few topics about this there was an advice to include the following lines to mwe2
 fragment = scoping.ImportURIScopingFragment {}
 fragment = exporting.SimpleNamesFragment {}

if I right understand there is no more ImportURIScopingFragment but only
ImportNamespacesScopingFragment2

what should I do to enable cross reference?
I'm using xtext 2.9.2

Thanks
Re: Cross references in multiple files [message #1728374 is a reply to message #1728366] Mon, 04 April 2016 04:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

you can add the bindings manually

class MyDslRuntimeModule extends AbstractMyDslRuntimeModule {
	
	override bindIGlobalScopeProvider() {
		ImportUriGlobalScopeProvider
	}
	
	override configureIScopeProviderDelegate(Binder binder) {
		binder.bind(IScopeProvider).annotatedWith(Names.named(AbstractDeclarativeScopeProvider.NAMED_DELEGATE))
			.to(SimpleLocalScopeProvider);
	
	}
	
}


please add a bug/enhancement request to support this via fragment as well.

p.s.:

having an import still requires to load all resources to the resourceset in standalone case


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Mon, 04 April 2016 04:34]

Report message to a moderator

Re: Cross references in multiple files [message #1728598 is a reply to message #1728374] Tue, 05 April 2016 17:40 Go to previous message
Andrey Petrenko is currently offline Andrey PetrenkoFriend
Messages: 8
Registered: March 2016
Junior Member
Hi,

thanks for the advice

report https://bugs.eclipse.org/bugs/show_bug.cgi?id=491110

Previous Topic:Using StyledTextXtextAdapter to edit only a segment of the Xtext resource
Next Topic:DSL validation across multiple files
Goto Forum:
  


Current Time: Fri Mar 29 14:44:33 GMT 2024

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

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

Back to the top