Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » QualifiedNameProvider not working with custom Scopes(Default QualifiedNameProvider falling back to SimpleNames when implementing custom Scopes)
QualifiedNameProvider not working with custom Scopes [message #1767397] Wed, 05 July 2017 15:45 Go to next message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 69
Registered: July 2009
Member
Hello everyone

I just realized that my application isnt using the default QualifiedNameProvider once I use a custom ScopeProvider. Well since I didnt specify the SimpleNameProvider it is probably using the QualifiedNameProvider but the result is not showing the FQN.

In order to limit the content-assist I rely on scopes which collect several Elements within a specific context.
...
return Scopes.scopeFor(root.dataRef.data.allValidFields)


According to the documentation, the default QualifiedNameProvider is using the name-attribute to calculate the FQN (after checking for a method). This workes just fine until I use my custom ScopeProvider.

Anyhow, I did find a working solution, by providing a naming-function to the scopeFor method which calculates the segments. But since my grammar is following the conventions (alle elements define a name-attribute) I think the default impl should work without any modifications.

Is there anything I have to be aware of regarding the qualified names and scoping?

btw: Xtext 2.12.0
Re: QualifiedNameProvider not working with custom Scopes [message #1767400 is a reply to message #1767397] Wed, 05 July 2017 15:48 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
thats a feature

have a look at the different variants of Scopes.scopeFor

there is one with a function

there you can pass a iqualfiednameprovider


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: QualifiedNameProvider not working with custom Scopes [message #1767411 is a reply to message #1767400] Wed, 05 July 2017 17:23 Go to previous message
Marc Schlegel is currently offline Marc SchlegelFriend
Messages: 69
Registered: July 2009
Member
Since I already used the functional method you mention, I just delegate the computation to a injected DefaultDeclaredQualifiedNameProvider.

Thanks for the explanation that this is on purpose. I suspect that the ScopeProvider is in charge of calling the appropriate NameProvider...which makes totaly sense now :-)
Previous Topic:Semantic Highlighting Cross-References
Next Topic:Importing Ecore Model
Goto Forum:
  


Current Time: Fri Apr 26 15:02:24 GMT 2024

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

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

Back to the top