Disable global description inside the local scope #1360
Answered
by
msujew
theogiraudet
asked this question in
Q&A
-
Beta Was this translation helpful? Give feedback.
Answered by
msujew
Jan 29, 2024
Replies: 1 comment 1 reply
-
|
Hey @theogiraudet, Xtext used to have a concept of a protected override getGlobalScope(referenceType: string, _context: ReferenceInfo): Scope {
const globalScope = super.getGlobalScope(referenceType, _context);
const documentUri = getDocument(_context.container).uri;
return new FilterScope(globalScope, astDescription => !UriUtils.equals(astDescription, documentUri));
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
theogiraudet
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


Hey @theogiraudet,
Xtext used to have a concept of a
FilterScopethat accepts a predicate to filter another scope. I think you need something similar here. The main idea would be to override thegetGlobalScopemethod to filter/remove all elements that are local to the element getting scoped. I.e. remove allAstNodeDescriptionobjects from the normal global scope that have the sameurias the currentReferenceInfo. Something similar to this should work: