docs: protected boolean isDocumentHighlightAvailableFor(final EObject selectedElement, final XtextResource resource,
  			final int offset) {
  		if (selectedElement == null || !getSelectedElementFilter().apply(selectedElement)) {
  			return false;
  		}
  
  		// This code handles the special case where your language has constructs that can refer to
  		// themselves. For example "function MyFunction begin ... end MyFunction" defines the function "MyFunction" and
  		// terminates its implementation block with an additional repetition of the word "MyFunction". Normally, when
  		// you are positioned on a selected element, you only want to highlight that selected element when you are
  		// positioned directly on top of the name of the selected element. However, when the selected element can refer
  		// to itself then there are references inside the element that must trigger highlighting.  In the example,
  		// we also want to highlight "MyFunction" when we are positioned on the "end MyFunction".
  		
  		INode crossReferenceNode = offsetHelper.getCrossReferenceNode(resource, new TextRegion(offset, 0));
  		
  		if (crossReferenceNode != null) {
  			EObject crossReferencedElement = offsetHelper.getCrossReferencedElement(crossReferenceNode);
  
  			if (crossReferencedElement != null && crossReferencedElement == selectedElement) {
  				return true;
  			}
  		}
  
  		final EObject containedElement = offsetHelper.resolveContainedElementAt(resource, offset);
  		// When the cursor is positioned in the selected element, then we only want to highlight the selected element
  		// when we are directly on top of the name (the significant text region) of that element.
  		
   		if (selectedElement == containedElement) {
  			final ITextRegion region = locationInFileProvider.getSignificantTextRegion(containedElement);
  			return !isNullOrEmpty(region)
  					// Region is comparable to a selection in an editor,
  					// therefore the end position is exclusive.
  					&& (region.contains(offset) || (region.getOffset() + region.getLength()) == offset);
  		}
  
  		return true;
  	}