From a0975b9b18517cac0e512f0c3838473d85aed0da Mon Sep 17 00:00:00 2001 From: Uchijo Date: Tue, 15 Oct 2024 18:40:53 +0900 Subject: [PATCH] remove unnecessary if-branch --- src/codeHighlighter.ts | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/src/codeHighlighter.ts b/src/codeHighlighter.ts index 002d214..516ac0c 100644 --- a/src/codeHighlighter.ts +++ b/src/codeHighlighter.ts @@ -1,17 +1,11 @@ import json5 from 'json5'; import * as shiki from 'shiki'; -import type { IShikiTheme, Theme } from 'shiki'; +import type { IShikiTheme } from 'shiki'; import { Highlighter } from 'shiki'; import * as vscode from 'vscode'; declare const TextDecoder: any; -// Default themes use `include` option that shiki doesn't support -const defaultThemesMap = new Map([ - ['Default Light+', 'light-plus'], - ['Default Dark+', 'dark-plus'], -]); - function getCurrentThemePath(themeName: string): vscode.Uri | undefined { for (const ext of vscode.extensions.all) { const themes = ext.packageJSON.contributes && ext.packageJSON.contributes.themes; @@ -87,9 +81,7 @@ export class CodeHighlighter { let theme: string | IShikiTheme | undefined; const currentThemeName = vscode.workspace.getConfiguration('workbench').get('colorTheme'); - if (currentThemeName && defaultThemesMap.has(currentThemeName)) { - theme = defaultThemesMap.get(currentThemeName); - } else if (currentThemeName) { + if (currentThemeName) { const colorThemePath = getCurrentThemePath(currentThemeName); if (colorThemePath) { theme = await shiki.loadTheme(colorThemePath.fsPath);