public static List<Location> getReferences(EventPositionContext context) {

        List<Location> ret = new ArrayList<>();

        Node node = CSTUtils.getSymbolAtPosition(context.document.getRootNode(), context.position);

        if (node == null) {
            return ret;
        }

        Symbol originalSymbol = node.getSymbol();

        if (originalSymbol.getStatus() == SymbolStatus.INVALID || originalSymbol.getStatus() == SymbolStatus.UNRESOLVED) {
            return ret;
        }

        Symbol search = originalSymbol;
        boolean originalSymbolIsDefinition = originalSymbol.getStatus() == SymbolStatus.DEFINITION;
        if (!originalSymbolIsDefinition) {

            Optional<Symbol> results = context.schemaIndex.getSymbolDefinition(originalSymbol);
            if (results.isEmpty()) {
                return ret;
            }
            search = results.get();
        }

        List<Symbol> symbols = context.schemaIndex.getSymbolReferences(search);

        if (!originalSymbolIsDefinition) {
            symbols.add(search);
        }

        for (Symbol symbol : symbols) {
            if (symbol != originalSymbol) {
                ret.add(symbol.getLocation());
            }
        }

        return ret;
    }
Responsible for LSP textDocument/references requests.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/lsp/schema/references/SchemaReferences.java