|
1 | 1 | /* eslint-disable @typescript-eslint/no-unnecessary-type-constraint */ |
2 | | -import { _cacheMap, DiffFile, SplitSide, highlighter as buildInHighlighter } from "@git-diff-view/core"; |
| 2 | +import { _cacheMap, DiffFile, SplitSide } from "@git-diff-view/core"; |
3 | 3 | import { diffFontSizeName, DiffModeEnum } from "@git-diff-view/utils"; |
4 | 4 | import { type JSXElement, type JSX, createSignal, createEffect, createMemo, onCleanup, Show } from "solid-js"; |
5 | 5 |
|
@@ -196,16 +196,19 @@ const InternalDiffView = <T extends unknown>(props: DiffViewProps<T>) => { |
196 | 196 | props.diffViewTheme; |
197 | 197 | if (mounted && currentDiffFile) { |
198 | 198 | if (props.diffViewHighlight) { |
199 | | - const finalHighlighter = props.registerHighlighter || buildInHighlighter; |
200 | | - if ( |
201 | | - finalHighlighter.name !== currentDiffFile._getHighlighterName() || |
202 | | - finalHighlighter.type !== currentDiffFile._getHighlighterType() |
203 | | - ) { |
204 | | - currentDiffFile.initSyntax({ registerHighlighter: finalHighlighter }); |
| 199 | + const registerHighlighter = props.registerHighlighter; |
| 200 | + if (registerHighlighter) { |
| 201 | + if ( |
| 202 | + registerHighlighter.name !== currentDiffFile._getHighlighterName() || |
| 203 | + registerHighlighter.type !== currentDiffFile._getHighlighterType() || |
| 204 | + registerHighlighter.type !== "class" |
| 205 | + ) { |
| 206 | + currentDiffFile.initSyntax({ registerHighlighter: registerHighlighter }); |
| 207 | + currentDiffFile.notifyAll(); |
| 208 | + } |
| 209 | + } else if (currentDiffFile._getHighlighterType() !== "class") { |
| 210 | + currentDiffFile.initSyntax(); |
205 | 211 | currentDiffFile.notifyAll(); |
206 | | - } else { |
207 | | - currentDiffFile.initSyntax({ registerHighlighter: finalHighlighter }); |
208 | | - if (finalHighlighter.type !== "class") currentDiffFile.notifyAll(); |
209 | 212 | } |
210 | 213 | } |
211 | 214 | } |
|
0 commit comments