fix(codeSnapshot): preserve line structure for line numbers
This commit is contained in:
1 parent
726f86e24c
commit
38664e6aea
4 files changed
+63
-3
No files matched your search
@@ -14,7 +14,7 @@ const { createCodeHighlighter, highlightCode, toPng, isTauriRuntime, save, write
|
||||
});
|
||||
|
||||
vi.mock("@/lib/ai/aiCodeHighlighter", () => ({
|
||||
createAiShikiCodeHighlighter: createCodeHighlighter,
|
||||
createAiShikiBlockCodeHighlighter: createCodeHighlighter,
|
||||
}));
|
||||
|
||||
vi.mock("dom-to-image-more", () => ({
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
* clones the node into a foreignObject.
|
||||
*/
|
||||
import type { AppThemeAppearance } from "@/lib/app/appTheme";
|
||||
import { createAiShikiCodeHighlighter, type AiCodeHighlighter } from "@/lib/ai/aiCodeHighlighter";
|
||||
import { createAiShikiBlockCodeHighlighter, type AiCodeHighlighter } from "@/lib/ai/aiCodeHighlighter";
|
||||
import { isTauriRuntime } from "@/lib/backend/tauriRuntime";
|
||||
|
||||
export interface CodeSnapshotSource {
|
||||
@@ -135,7 +135,7 @@ let highlighterPromise: Promise<AiCodeHighlighter> | undefined;
|
||||
|
||||
/** Lazy singleton reusing the AI assistant's shiki highlighter instance. */
|
||||
export function getCodeSnapshotHighlighter(): Promise<AiCodeHighlighter> {
|
||||
highlighterPromise ??= createAiShikiCodeHighlighter({
|
||||
highlighterPromise ??= createAiShikiBlockCodeHighlighter({
|
||||
appearance: () => "dark",
|
||||
}).catch((err: unknown) => {
|
||||
// Reset so a transient highlighter failure can be retried on the next
|
||||
|
||||
Reference in new issue
Block a user