Differences

This shows you the differences between two versions of the page.

Link to this comparison view

xtext_node_position [2021/04/05 11:23] (current)
Line 1: Line 1:
 +====== Xtext Node Position ======
 +The model classes don't contain any information about their position in the source code. This can be retrieved with the ''org.eclipse.xtext.nodemodel.util.NodeModelUtils'' class.
  
 +  var node = NodeModelUtils.getNode(modelObject);
 +  System.out.println("Offsets: " + node.offset + " - " + node.endOffset);
 +  System.out.println("Length: " + node.length);
 +  
 +{{tag>java xtext}}