Skip to content

Commit 8c0fb8a

Browse files
committed
Simplify
1 parent 339bd41 commit 8c0fb8a

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/components/DocumentView/CodeBlock/highlight.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ type InlineIndexed = { inline: any; start: number; end: number };
2929

3030
type PositionedToken = ThemedToken & { start: number; end: number };
3131

32-
const renderer = asyncMutexFunction();
33-
let blockCount = 0;
3432
let lineCount = 0;
3533

3634
const LINE_LIMIT = 1000;
@@ -46,13 +44,9 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
4644
return plainHighlighting(block);
4745
}
4846

49-
const overLimit = await renderer.runBlocking(async () => {
50-
lineCount += block.nodes.length;
51-
blockCount++;
52-
return lineCount > LINE_LIMIT;
53-
})
54-
55-
if (overLimit) {
47+
lineCount += block.nodes.length;
48+
console.log(`highlight, lineCount ${lineCount}`);
49+
if (lineCount > LINE_LIMIT) {
5650
return plainHighlighting(block);
5751
}
5852

@@ -72,7 +66,7 @@ export async function highlight(block: DocumentBlockCode): Promise<HighlightLine
7266
});
7367

7468
console.log(
75-
`${block.key} ${JSON.stringify({ blockCount, lineCount })} block has ${
69+
`${block.key} lines:${lineCount} block has ${
7670
block.nodes.length
7771
} lines, ${code.length} characters ${inlines.length} inlines`,
7872
);

0 commit comments

Comments
 (0)