private CodeAction fixDocumentlessSchema(EventCodeActionContext context, Diagnostic diagnostic) {
        if (!(context.document instanceof SchemaDocument)) return null; // basically unreachable
        SchemaDocument document = (SchemaDocument)context.document;
        if (document.getSchemaIdentifier() == null) return null; // quickfix impossible
        String schemaName = document.getSchemaIdentifier();
        CodeAction action = basicQuickFix("Insert document definition '" + schemaName + "'", diagnostic);

        Node rootSchemaNode = document.getRootNode().get(0);
        Position insertPosition = firstPositionInBlock(rootSchemaNode);

        if (insertPosition == null) {
            insertPosition = CSTUtils.addPositions(diagnostic.getRange().getStart(), new Position(1, 0)); // one line below
            insertPosition.setCharacter(0);
        }
        Node offendingNode = CSTUtils.getNodeAtPosition(context.document.getRootNode(), diagnostic.getRange().getStart());
        String indentString = StringUtils.getIndentString(context.document.getCurrentContent(), offendingNode);
        int indent = StringUtils.countSpaceIndents(indentString) + StringUtils.TAB_SIZE;
        action.setEdit(CodeActionUtils.simpleEditList(context, List.of(
                new TextEdit(new Range(insertPosition, insertPosition),  
                    "\n" + StringUtils.spaceIndent(indent) + "document " + schemaName + " {\n"
                         + StringUtils.spaceIndent(indent + StringUtils.TAB_SIZE) + "\n" + 
                    StringUtils.spaceIndent(indent) + "}")
        )));

        action.setIsPreferred(true);

        return action;
    }
Provides quick fix for trying to do dot syntax on a reference field. 
@param context
@param diagnostic
@return A CodeAction which will provide an import field statement and rename the field access.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/lsp/schema/codeaction/provider/QuickFixProvider.java