File tree Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Expand file tree Collapse file tree 1 file changed +11
-13
lines changed Original file line number Diff line number Diff line change 11import type { ShikiInternal , ThemeRegistrationResolved } from '@shikijs/types'
2- import type monacoNs from 'monaco-editor-core'
2+ import type * as monacoNs from 'monaco-editor-core'
33import type { MonacoLineToken } from './types'
44import { EncodedTokenMetadata , INITIAL } from '@shikijs/vscode-textmate'
55import { TokenizerState } from './tokenizer'
@@ -32,18 +32,16 @@ export function textmateThemeToMonacoTheme(theme: ThemeRegistrationResolved): Mo
3232 const themeSettings = theme . settings || theme . tokenColors
3333
3434 for ( const { scope, settings : { foreground, background, fontStyle } = { } } of themeSettings ) {
35- const scopes = Array . isArray ( scope ) ? scope : [ scope ]
36-
37- for ( const s of scopes ) {
38- if ( s && ( foreground || background || fontStyle ) ) {
39- rules . push ( {
40- token : s ,
41- foreground : normalizeColor ( foreground ) ,
42- background : normalizeColor ( background ) ,
43- fontStyle,
44- } )
45- }
46- }
35+ if ( ! foreground && ! background && ! fontStyle )
36+ continue
37+ const scopes = Array . isArray ( scope ) ? scope : scope ? [ scope ] : [ ]
38+
39+ rules . push ( ...scopes . map ( s => ( {
40+ token : s ,
41+ foreground : normalizeColor ( foreground ) ,
42+ background : normalizeColor ( background ) ,
43+ fontStyle,
44+ } ) ) )
4745 }
4846 }
4947
You can’t perform that action at this time.
0 commit comments