Community
Participate
Working Groups
Grammar (important: use Xbase): grammar org.xtext.example.mydsl6.MyDsl with org.eclipse.xtext.xbase.Xbase generate myDsl "http://www.xtext.org/example/mydsl6/MyDsl" Model: greetings+=Greeting*; Greeting: 'Hello' name=ID ('by' other=[Greeting]) '!'; === Sample model: Hello Foo by Foo ! === Find References does not report any results for 'Foo'. === Note: It works fine for this grammar (which does not use Xbase): grammar org.xtext.example.mydsl6.MyDsl with org.eclipse.xtext.common.Terminals generate myDsl "http://www.xtext.org/example/mydsl6/MyDsl" Model: greetings+=Greeting*; Greeting: 'Hello' name=ID ('by' other=[Greeting]) '!';
There is a filter installed that I don't really understand: As soon as you use Xbase, all references will be filtered that point to the instance itself. The sample has a Greeting 'foo' that has a cross ref to itself. This reference will not be reported. The responsable code is here: org.eclipse.xtext.xbase.ui.jvmmodel.refactoring.JvmModelFindRefsQueryDataFactory and here org.eclipse.xtext.xbase.ui.jvmmodel.findrefs.JvmModelReferenceFilter which does not look like this was written 'by accident'. I can only assume that it's there to filter the reference 'this' on the enclosing type in Xbase expressions but I did not dig deeper into the code to verify this assumption. Long story short: The current abstraction don't provide a way to decide reliably whether references to self shouls be filtered or not and I leave the code as is for 2.0.1. This is definitly something that we should have a second look at for 2.1
The suspicious filter is a remnant of the old times when we had a direct reference from the source element to its inferred JVM element. No longer necessary, since we have the IJvmAssociations instead. Removed it and pushed it to master.
Closing all bugs that were set to RESOLVED before Neon.0