@@ -98,15 +98,13 @@ export class SimpleEditorModelResolverService implements ITextModelService {
9898 }
9999
100100 public createModelReference ( resource : URI ) : Promise < IReference < ITextEditorModel > > {
101- let model : ITextModel ;
102-
103- model = withTypedEditor ( this . editor ,
101+ let model : ITextModel | null = withTypedEditor ( this . editor ,
104102 ( editor ) => this . findModel ( editor , resource ) ,
105103 ( diffEditor ) => this . findModel ( diffEditor . getOriginalEditor ( ) , resource ) || this . findModel ( diffEditor . getModifiedEditor ( ) , resource )
106104 ) ;
107105
108106 if ( ! model ) {
109- return Promise . resolve ( new ImmortalReference ( null ) ) ;
107+ return Promise . reject ( new Error ( `Model not found` ) ) ;
110108 }
111109
112110 return Promise . resolve ( new ImmortalReference ( new SimpleModel ( model ) ) ) ;
@@ -144,7 +142,7 @@ export class SimpleProgressService implements IProgressService {
144142 }
145143
146144 showWhile ( promise : Thenable < any > , delay ?: number ) : Thenable < void > {
147- return null ;
145+ return Promise . resolve ( void 0 ) ;
148146 }
149147}
150148
@@ -277,11 +275,16 @@ export class StandaloneKeybindingService extends AbstractKeybindingService {
277275 } ) ) ;
278276 }
279277
280- public addDynamicKeybinding ( commandId : string , keybinding : number , handler : ICommandHandler , when : ContextKeyExpr | null ) : IDisposable {
278+ public addDynamicKeybinding ( commandId : string , _keybinding : number , handler : ICommandHandler , when : ContextKeyExpr | null ) : IDisposable {
279+ const keybinding = createKeybinding ( _keybinding , OS ) ;
280+ if ( ! keybinding ) {
281+ throw new Error ( `Invalid keybinding` ) ;
282+ }
283+
281284 let toDispose : IDisposable [ ] = [ ] ;
282285
283286 this . _dynamicKeybindings . push ( {
284- keybinding : createKeybinding ( keybinding , OS ) ,
287+ keybinding : keybinding ,
285288 command : commandId ,
286289 when : when ,
287290 weight1 : 1000 ,
@@ -426,10 +429,10 @@ export class SimpleConfigurationService implements IConfigurationService {
426429 }
427430
428431 public reloadConfiguration ( ) : Promise < void > {
429- return Promise . resolve ( null ) ;
432+ return Promise . resolve ( void 0 ) ;
430433 }
431434
432- public getConfigurationData ( ) : IConfigurationData {
435+ public getConfigurationData ( ) : IConfigurationData | null {
433436 return null ;
434437 }
435438}
@@ -450,8 +453,11 @@ export class SimpleResourceConfigurationService implements ITextResourceConfigur
450453 getValue < T > ( resource : URI , section ?: string ) : T ;
451454 getValue < T > ( resource : URI , position ?: IPosition , section ?: string ) : T ;
452455 getValue < T > ( resource : any , arg2 ?: any , arg3 ?: any ) {
453- const position : IPosition = Pos . isIPosition ( arg2 ) ? arg2 : null ;
454- const section : string = position ? ( typeof arg3 === 'string' ? arg3 : void 0 ) : ( typeof arg2 === 'string' ? arg2 : void 0 ) ;
456+ const position : IPosition | null = Pos . isIPosition ( arg2 ) ? arg2 : null ;
457+ const section : string | undefined = position ? ( typeof arg3 === 'string' ? arg3 : void 0 ) : ( typeof arg2 === 'string' ? arg2 : void 0 ) ;
458+ if ( typeof section === 'undefined' ) {
459+ return this . configurationService . getValue < T > ( ) ;
460+ }
455461 return this . configurationService . getValue < T > ( section ) ;
456462 }
457463}
@@ -482,11 +488,11 @@ export class StandaloneTelemetryService implements ITelemetryService {
482488 public isOptedIn = false ;
483489
484490 public publicLog ( eventName : string , data ?: any ) : Promise < void > {
485- return Promise . resolve ( null ) ;
491+ return Promise . resolve ( void 0 ) ;
486492 }
487493
488494 public getTelemetryInfo ( ) : Promise < ITelemetryInfo > {
489- return null ;
495+ throw new Error ( `Not available` ) ;
490496 }
491497}
492498
@@ -526,8 +532,8 @@ export class SimpleWorkspaceContextService implements IWorkspaceContextService {
526532 return WorkbenchState . EMPTY ;
527533 }
528534
529- public getWorkspaceFolder ( resource : URI ) : IWorkspaceFolder {
530- return resource && resource . scheme === SimpleWorkspaceContextService . SCHEME ? this . workspace . folders [ 0 ] : void 0 ;
535+ public getWorkspaceFolder ( resource : URI ) : IWorkspaceFolder | null {
536+ return resource && resource . scheme === SimpleWorkspaceContextService . SCHEME ? this . workspace . folders [ 0 ] : null ;
531537 }
532538
533539 public isInsideWorkspace ( resource : URI ) : boolean {
@@ -567,19 +573,21 @@ export class SimpleBulkEditService implements IBulkEditService {
567573
568574 let edits = new Map < ITextModel , TextEdit [ ] > ( ) ;
569575
570- for ( let edit of workspaceEdit . edits ) {
571- if ( ! isResourceTextEdit ( edit ) ) {
572- return Promise . reject ( new Error ( 'bad edit - only text edits are supported' ) ) ;
573- }
574- let model = this . _modelService . getModel ( edit . resource ) ;
575- if ( ! model ) {
576- return Promise . reject ( new Error ( 'bad edit - model not found' ) ) ;
577- }
578- let array = edits . get ( model ) ;
579- if ( ! array ) {
580- array = [ ] ;
576+ if ( workspaceEdit . edits ) {
577+ for ( let edit of workspaceEdit . edits ) {
578+ if ( ! isResourceTextEdit ( edit ) ) {
579+ return Promise . reject ( new Error ( 'bad edit - only text edits are supported' ) ) ;
580+ }
581+ let model = this . _modelService . getModel ( edit . resource ) ;
582+ if ( ! model ) {
583+ return Promise . reject ( new Error ( 'bad edit - model not found' ) ) ;
584+ }
585+ let array = edits . get ( model ) ;
586+ if ( ! array ) {
587+ array = [ ] ;
588+ }
589+ edits . set ( model , array . concat ( edit . edits ) ) ;
581590 }
582- edits . set ( model , array . concat ( edit . edits ) ) ;
583591 }
584592
585593 let totalEdits = 0 ;
0 commit comments