@@ -7,6 +7,7 @@ import { Color } from 'vs/base/common/color';
77import { Emitter , Event } from 'vs/base/common/event' ;
88import { IDisposable , toDisposable } from 'vs/base/common/lifecycle' ;
99import { ColorId , ITokenizationRegistry , ITokenizationSupport , ITokenizationSupportChangedEvent } from 'vs/editor/common/modes' ;
10+ import { withUndefinedAsNull } from 'vs/base/common/types' ;
1011import { keys } from 'vs/base/common/map' ;
1112
1213export class TokenizationRegistryImpl implements ITokenizationRegistry {
@@ -17,7 +18,11 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
1718 private readonly _onDidChange = new Emitter < ITokenizationSupportChangedEvent > ( ) ;
1819 public readonly onDidChange : Event < ITokenizationSupportChangedEvent > = this . _onDidChange . event ;
1920
20- private _colorMap : Color [ ] | undefined ;
21+ private _colorMap : Color [ ] | null ;
22+
23+ constructor ( ) {
24+ this . _colorMap = null ;
25+ }
2126
2227 public fire ( languages : string [ ] ) : void {
2328 this . _onDidChange . fire ( {
@@ -71,8 +76,8 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
7176 return null ;
7277 }
7378
74- public get ( language : string ) : ITokenizationSupport | undefined {
75- return this . _map . get ( language ) ;
79+ public get ( language : string ) : ITokenizationSupport | null {
80+ return withUndefinedAsNull ( this . _map . get ( language ) ) ;
7681 }
7782
7883 public setColorMap ( colorMap : Color [ ] ) : void {
@@ -83,14 +88,14 @@ export class TokenizationRegistryImpl implements ITokenizationRegistry {
8388 } ) ;
8489 }
8590
86- public getColorMap ( ) : Color [ ] | undefined {
91+ public getColorMap ( ) : Color [ ] | null {
8792 return this . _colorMap ;
8893 }
8994
90- public getDefaultBackground ( ) : Color | undefined {
95+ public getDefaultBackground ( ) : Color | null {
9196 if ( this . _colorMap && this . _colorMap . length > ColorId . DefaultBackground ) {
9297 return this . _colorMap [ ColorId . DefaultBackground ] ;
9398 }
94- return undefined ;
99+ return null ;
95100 }
96101}
0 commit comments