55
66import { onUnexpectedError } from 'vs/base/common/errors' ;
77import { Event , Emitter } from 'vs/base/common/event' ;
8- import { TPromise } from 'vs/base/common/winjs.base' ;
98import { IMode , LanguageId , LanguageIdentifier } from 'vs/editor/common/modes' ;
109import { FrankensteinMode } from 'vs/editor/common/modes/abstractMode' ;
1110import { LanguagesRegistry } from 'vs/editor/common/services/languagesRegistry' ;
@@ -27,8 +26,8 @@ export class ModeServiceImpl implements IModeService {
2726 this . _registry = new LanguagesRegistry ( true , warnOnOverwrite ) ;
2827 }
2928
30- protected _onReady ( ) : TPromise < boolean > {
31- return TPromise . as ( true ) ;
29+ protected _onReady ( ) : Promise < boolean > {
30+ return Promise . resolve ( true ) ;
3231 }
3332
3433 public isRegisteredMode ( mimetypeOrModeId : string ) : boolean {
@@ -115,15 +114,15 @@ export class ModeServiceImpl implements IModeService {
115114 return null ;
116115 }
117116
118- public getOrCreateMode ( commaSeparatedMimetypesOrCommaSeparatedIds : string ) : TPromise < IMode > {
117+ public getOrCreateMode ( commaSeparatedMimetypesOrCommaSeparatedIds : string ) : Promise < IMode > {
119118 return this . _onReady ( ) . then ( ( ) => {
120119 const modeId = this . getModeId ( commaSeparatedMimetypesOrCommaSeparatedIds ) ;
121120 // Fall back to plain text if no mode was found
122121 return this . _getOrCreateMode ( modeId || 'plaintext' ) ;
123122 } ) ;
124123 }
125124
126- public getOrCreateModeByLanguageName ( languageName : string ) : TPromise < IMode > {
125+ public getOrCreateModeByLanguageName ( languageName : string ) : Promise < IMode > {
127126 return this . _onReady ( ) . then ( ( ) => {
128127 const modeId = this . _getModeIdByLanguageName ( languageName ) ;
129128 // Fall back to plain text if no mode was found
@@ -141,7 +140,7 @@ export class ModeServiceImpl implements IModeService {
141140 return null ;
142141 }
143142
144- public getOrCreateModeByFilepathOrFirstLine ( filepath : string , firstLine ?: string ) : TPromise < IMode > {
143+ public getOrCreateModeByFilepathOrFirstLine ( filepath : string , firstLine ?: string ) : Promise < IMode > {
145144 return this . _onReady ( ) . then ( ( ) => {
146145 const modeId = this . getModeIdByFilepathOrFirstLine ( filepath , firstLine ) ;
147146 // Fall back to plain text if no mode was found
0 commit comments