textEditor scrolling. only rendering the lines that are in the viewport. smooth. better prettyPrinting of match inside lambda

This commit is contained in:
Dustin Swan 2026-02-26 21:03:08 -07:00
parent f54b8ca65e
commit 3267d5bc39
No known key found for this signature in database
GPG key ID: 30D46587E2100467
2 changed files with 159 additions and 132 deletions

View file

@ -252,9 +252,12 @@ export function prettyPrint(ast: AST, indent = 0): string {
case 'match':
const expr = prettyPrint(ast.expr, indent);
const cases = ast.cases
.map(c => `${i}| ${prettyPrintPattern(c.pattern)} \\ ${prettyPrint(c.result, indent + 1)}`)
.join('\n');
return `${expr}\n${cases}`;
.map(c => {
const result = prettyPrint(c.result, indent + 1);
const needsParens = c.result.kind === 'match' || c.result.kind === 'let';
return `${i}| ${prettyPrintPattern(c.pattern)} \\ ${needsParens ? '(' : ''}${result}${needsParens ? ')' : ''}`;
}).join('\n');
return `${i}${expr}\n${cases}`;
case 'rebind':
return `${prettyPrint(ast.target, indent)} := ${prettyPrint(ast.value, indent)}`;