Skip to content

Commit

Permalink
Fix log
Browse files Browse the repository at this point in the history
  • Loading branch information
emmerich committed Apr 13, 2024
1 parent 3f72e35 commit 210c563
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/DocumentView/CodeBlock/highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,14 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
return plainHighlighting(block);
}

lineCount += block.nodes.length;
if (lineCount > LINE_LIMIT) {
// Too many lines and we risk crashing the worker, fallback to plain highlighting
return plainHighlighting(block);
}
// lineCount += block.nodes.length;
// if (lineCount > LINE_LIMIT) {
// // Too many lines and we risk crashing the worker, fallback to plain highlighting
// return plainHighlighting(block);
// }

return runner.runBlocking(async () => {
console.log(`start ${block.key}`)
const inlines: InlineIndexed[] = [];
const code = getPlainCodeBlock(block, inlines);

Expand Down Expand Up @@ -94,7 +95,6 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
};

while (tokens.length > 0) {
console.log(`tokens.length: ${tokens.length}`)
result.push(...matchTokenAndInlines(eatToken, inlines));
}

Expand All @@ -106,10 +106,10 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
};
});


console.log(
`${block.key} ${duration}ms code len: ${code.length} lineCountBefore: ${lineCount} tokenCount: ${tokenCount} created lines: ${result.length}`,
`end ${block.key} ${duration}ms code len: ${code.length} lineCountBefore: ${lineCount} tokenCount: ${tokenCount} created lines: ${result.length}`,
);

return result;
});
}
Expand Down

0 comments on commit 210c563

Please sign in to comment.