@@ -170,25 +170,6 @@ export class ColorThemeData implements IWorkbenchColorTheme {
170170 }
171171 }
172172 }
173- for ( const rule of tokenClassificationRegistry . getTokenStylingDefaultRules ( ) ) {
174- const matchScore = rule . selector . match ( type , modifiers , language ) ;
175- if ( matchScore >= 0 ) {
176- let style : TokenStyle | undefined ;
177- if ( rule . defaults . scopesToProbe ) {
178- style = this . resolveScopes ( rule . defaults . scopesToProbe ) ;
179- if ( style ) {
180- _processStyle ( matchScore , style , rule . defaults . scopesToProbe ) ;
181- }
182- }
183- if ( ! style && useDefault !== false ) {
184- const tokenStyleValue = rule . defaults [ this . type ] ;
185- style = this . resolveTokenStyleValue ( tokenStyleValue ) ;
186- if ( style ) {
187- _processStyle ( matchScore , style , tokenStyleValue ! ) ;
188- }
189- }
190- }
191- }
192173 for ( const rule of this . tokenStylingRules ) {
193174 const matchScore = rule . selector . match ( type , modifiers , language ) ;
194175 if ( matchScore >= 0 ) {
@@ -201,6 +182,36 @@ export class ColorThemeData implements IWorkbenchColorTheme {
201182 _processStyle ( matchScore , rule . style , rule ) ;
202183 }
203184 }
185+ let hasUndefinedStyleProperty = false ;
186+ for ( let k in score ) {
187+ const key = k as keyof TokenStyle ;
188+ if ( score [ key ] === - 1 ) {
189+ hasUndefinedStyleProperty = true ;
190+ } else {
191+ score [ key ] = Number . MAX_VALUE ; // set it to the max, so it won't be replaced by a default
192+ }
193+ }
194+ if ( hasUndefinedStyleProperty ) {
195+ for ( const rule of tokenClassificationRegistry . getTokenStylingDefaultRules ( ) ) {
196+ const matchScore = rule . selector . match ( type , modifiers , language ) ;
197+ if ( matchScore >= 0 ) {
198+ let style : TokenStyle | undefined ;
199+ if ( rule . defaults . scopesToProbe ) {
200+ style = this . resolveScopes ( rule . defaults . scopesToProbe ) ;
201+ if ( style ) {
202+ _processStyle ( matchScore , style , rule . defaults . scopesToProbe ) ;
203+ }
204+ }
205+ if ( ! style && useDefault !== false ) {
206+ const tokenStyleValue = rule . defaults [ this . type ] ;
207+ style = this . resolveTokenStyleValue ( tokenStyleValue ) ;
208+ if ( style ) {
209+ _processStyle ( matchScore , style , tokenStyleValue ! ) ;
210+ }
211+ }
212+ }
213+ }
214+ }
204215 return TokenStyle . fromData ( result ) ;
205216
206217 }
0 commit comments