( env: CliEnv = getCliEnv(), )
| 469 | } |
| 470 | |
| 471 | const detectJetBrainsTheme = ( |
| 472 | env: CliEnv = getCliEnv(), |
| 473 | ): ThemeName | null => { |
| 474 | if (!isJetBrainsTerminal(env)) { |
| 475 | return null |
| 476 | } |
| 477 | |
| 478 | const lafPaths = collectExistingPaths(resolveJetBrainsLafPaths(env)) |
| 479 | |
| 480 | for (const lafPath of lafPaths) { |
| 481 | const content = safeReadFile(lafPath) |
| 482 | if (!content) continue |
| 483 | const theme = extractJetBrainsTheme(content) |
| 484 | if (theme) { |
| 485 | return theme |
| 486 | } |
| 487 | |
| 488 | // If extractJetBrainsTheme returned null, check if autodetect is enabled |
| 489 | // and fall back to platform detection |
| 490 | const autodetectMatch = content.match( |
| 491 | /<component[^>]+name="LafManager"[^>]+autodetect="(true|false)"/i, |
| 492 | ) |
| 493 | if (autodetectMatch?.[1]?.toLowerCase() === 'true') { |
| 494 | return detectPlatformTheme() |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | return null |
| 499 | } |
| 500 | |
| 501 | const extractZedTheme = (content: string): ThemeName | null => { |
| 502 | try { |
no test coverage detected