|
Re: Limit scope provider to few files [message #1745228 is a reply to message #1745208] |
Thu, 06 October 2016 16:36   |
|
Hi
i doubt your assumtions on building the index is wrong. its not building the index (that would be writing resource descriptions) but it is updating resource descriptions which is resolving cross references and validation.
i assume you use xtext >= 2.9.0. Since the Xtext team decided some years ago import uri based scoping no longer beeing a encouraged way there is no support in the workflows to get this done.
in old <=2.8.4 workflows you usually use
fragment = scoping.ImportURIScopingFragment auto-inject {}
fragment = exporting.SimpleNamesFragment auto-inject {}
which provides the following bindings.
public Class<? extends org.eclipse.xtext.scoping.IGlobalScopeProvider> bindIGlobalScopeProvider() {
return org.eclipse.xtext.scoping.impl.ImportUriGlobalScopeProvider.class;
}
// contributed by org.eclipse.xtext.generator.scoping.AbstractScopingFragment
public void configureIgnoreCaseLinking(com.google.inject.Binder binder) {
binder.bindConstant().annotatedWith(org.eclipse.xtext.scoping.IgnoreCaseLinking.class).to(false);
}
public Class<? extends org.eclipse.xtext.naming.IQualifiedNameProvider> bindIQualifiedNameProvider() {
return org.eclipse.xtext.naming.SimpleNameProvider.class;
}
public void configureIScopeProviderDelegate(com.google.inject.Binder binder) {
binder.bind(org.eclipse.xtext.scoping.IScopeProvider.class).annotatedWith(com.google.inject.name.Names.named(org.eclipse.xtext.scoping.impl.AbstractDeclarativeScopeProvider.NAMED_DELEGATE)).to(org.eclipse.xtext.scoping.impl.SimpleLocalScopeProvider.class);
}
so adding these bindings and a grammar like
Model:
imports+=Import*
....
;
Import:
"#include" importURI=STRING
;
should basically do the behaviour in pre 2.9
https://www.eclipse.org/forums/index.php/m/1736385/?srch=SimpleLocalScopeProvider#msg_1736385
you said that you customized some of the impls and use ignore case linking
if you leave off both (by adding explicit imports for default, use case sensitive linking)
how is the performance then?
besides this: you should always measure what the actual performance bottleneck is and not work on assumptions.
you could even use the default namespace based behaviuor by
(1) give the elements a name like "file.extension.elementname"
(2) turn a include into a import "file.extension.*"
(you gave to few infos how your includes work - eg regarding relative imports/paths etc)
Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/it-services/methods-and-tools/xtext
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01489 seconds