Better pretty printing. scrolling in the textEditor

This commit is contained in:
Dustin Swan 2026-02-26 20:29:37 -07:00
parent f1ff6c29d6
commit f54b8ca65e
No known key found for this signature in database
GPG key ID: 30D46587E2100467
3 changed files with 36 additions and 11 deletions

View file

@ -207,7 +207,8 @@ export function prettyPrint(ast: AST, indent = 0): string {
return `(${func} ${args})`
case 'let':
return `${ast.name} = ${prettyPrint(ast.value, indent + 1)};\n${i}${prettyPrint(ast.body, indent)}`
const sep = indent === 0 ? '\n\n' : '\n';
return `${ast.name} = ${prettyPrint(ast.value, indent + 1)};${sep}${i}${prettyPrint(ast.body, indent)}`
case 'list': {
const elems = ast.elements.map(e => prettyPrint(e, indent + 1))