Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Remove the hierarchy from the name of cross reference
Remove the hierarchy from the name of cross reference [message #1863271] Mon, 22 January 2024 08:29 Go to next message
Loredana Hozan is currently offline Loredana HozanFriend
Messages: 34
Registered: January 2019
I have 2 simple languages. One defines tables with fields, and in the other one i define which tables and fields are being used like this :
Language A:
model hello1-1.0.0 {
	table newTable {
		field field1
		field field11
	table newTable2 {
		field field2

Language B:
model2 hello2-1.0.0 !
import hello1-1.0.0

used-tables { 
	newUsedTable is using hello1-1.0.0.newTable {
		//what works :
		//What i want :

How can I remove the hierarchy from the name when i am using a certain table's fields? i have implemented a ScopeProvider, when i use the eclipse runtime and do a Ctrl+Space i get the right name (field1) but once i select it, it gives me an error with : "Could not resolve reference."

In the grammar i have defined the reference like :

I have tried to remove the FIELD_FQN and leave just the reference, i have also tried to just put ID instead of it, and it still can not find the reference.
I have tried to implement a ValueConverter for the terminal, but it still does not work.

I have also tried to implement a qualifiedNameProvider with teh following code :
List<INode> nodes = NodeModelUtils.findNodesForFeature(((UsedField)obj).getReferenced(), MyDslPackage.Literals.FIELD__NAME);
return QualifiedName.create(nodes.get(0).getText());
//	    return QualifiedName.create((((UsedField)obj).getReferenced().getName());

and the list of nodes is empty.

I have attached a zip with the code.
Re: Remove the hierarchy from the name of cross reference [message #1863281 is a reply to message #1863271] Mon, 22 January 2024 19:58 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14695
Registered: July 2009
Senior Member
Without looking into details

NodeModelUtils.findNodesForFeature(obj, MyDslPackage.Literals.used_field__referenced)

Besides that: how does your ImportedNamspacewareLocalScopeProvider customization look like
There you need to create wildcard normalizers for hello1-1.0.0.*

Twitter : @chrdietrich
Blog :
Previous Topic:Language server seems to trigger build twice during initialization
Next Topic:Different indentation level in the same file
Goto Forum:

Current Time: Fri Jul 19 06:18:41 GMT 2024

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

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

Back to the top