private CodeAction fixAnnotationReferenceOutsideAnnotation(EventCodeActionContext context, Diagnostic diagnostic) {
        Node offendingNode = CSTUtils.getNodeAtPosition(context.document.getRootNode(), context.position);
        if (offendingNode == null) return null;

        Node fieldElmNode = offendingNode;

        while (fieldElmNode != null && !fieldElmNode.isASTInstance(fieldElm.class)) fieldElmNode = fieldElmNode.getParent();

        if (fieldElmNode == null) return null;

        CodeAction action = basicQuickFix("Enclose field in annotation", diagnostic);

        String fieldBody = fieldElmNode.getText().replace("\n", "\n" + StringUtils.spaceIndent(StringUtils.TAB_SIZE));

        String indentString = StringUtils.getIndentString(context.document.getCurrentContent(), fieldElmNode);
        int indent = StringUtils.countSpaceIndents(indentString);

        action.setEdit(CodeActionUtils.simpleEdit(context, fieldElmNode.getRange(), 
            "annotation myannotation {\n" + 
            StringUtils.spaceIndent(indent + StringUtils.TAB_SIZE) + fieldBody + "\n"
            + StringUtils.spaceIndent(indent) + "}"
        ));

        return action;
    }
Provides quick fix for importing a field that is not an attribute.
@param context
@param diagnostic
@return A CodeAction that will set indexing to attribute for the original field.
integration/schema-language-server/language-server/src/main/java/ai/vespa/schemals/lsp/schema/codeaction/provider/QuickFixProvider.java