textEditor scrolling. only rendering the lines that are in the viewport. smooth. better prettyPrinting of match inside lambda
This commit is contained in:
parent
f54b8ca65e
commit
3267d5bc39
2 changed files with 159 additions and 132 deletions
|
|
@ -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)}`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue