1:- module(pls_index_references, [
    2  references_for_position/3
    3]).    4
    5:- use_module(documents).    6
    7references_for_position(URI, Position, References) :-
    8  get_document_item(URI, Position, defines(Predicate)),
    9  get_references(Predicate, References).
   10
   11references_for_position(URI, Position, References) :-
   12  get_document_item(URI, Position, references(_Caller, Predicate)),
   13  get_references(Predicate, References).
   14
   15references_for_position(URI, Position, References) :-
   16  get_document_item(URI, Position, exports(Predicate)),
   17  get_references(Predicate, References).
   18
   19get_references(Predicate, References) :-
   20  findall(
   21    _{
   22        uri: RefURI,
   23        range: RefRange
   24        },
   25    get_document_item(RefURI, RefRange, references(_RefCaller, Predicate)),
   26    References
   27  )