private static Optional<String> resolveDocumentInheritance(SchemaNode inheritanceNode, ParseContext context, List<Diagnostic> diagnostics) {
        String schemaDocumentName = inheritanceNode.getText();
        Optional<Symbol> symbol = context.schemaIndex().getSchemaDefinition(schemaDocumentName);

        if (symbol.isEmpty()) {
            // Handled in resolve symbol references
            return Optional.empty();
        }

        if (!context.schemaIndex().tryRegisterDocumentInheritance(context.fileURI(), symbol.get().getFileURI())) {
            // Inheritance cycle
            diagnostics.add(new SchemaDiagnostic.Builder()
                    .setRange( inheritanceNode.getRange())
                    .setMessage( "Cannot inherit from " + schemaDocumentName + " because " + schemaDocumentName + " inherits from this document.")
                    .setSeverity( DiagnosticSeverity.Error)
                    .build() );
            return Optional.empty();
        }

        inheritanceNode.setSymbolStatus(SymbolStatus.REFERENCE);
        context.schemaIndex().insertSymbolReference(symbol.get(), inheritanceNode.getSymbol());
        return Optional.of(symbol.get().getFileURI());
    }
Assuming first parsing step is done, use the list of unresolved inheritance
declarations to register the inheritance at index.
@return List of diagnostic found during inheritance handling
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/schemadocument/resolvers/InheritanceResolver.java