66'use strict' ;
77
88import { IInstantiationService , ServicesAccessor } from 'vs/platform/instantiation/common/instantiation' ;
9- import { IEditorInput , IResourceInput , IUntitledResourceInput , IResourceDiffInput , IResourceSideBySideInput , IEditor , ITextEditorOptions , IEditorOptions , IEditorInputWithOptions , isEditorInputWithOptions } from 'vs/platform/editor/common/editor' ;
10- import { GroupIdentifier , IFileEditorInput , IEditorInputFactoryRegistry , Extensions as EditorExtensions , IFileInputFactory , EditorInput , SideBySideEditorInput , EditorOptions , TextEditorOptions , IEditorOpeningEvent } from 'vs/workbench/common/editor' ;
9+ import { IEditorInput , IResourceInput , IUntitledResourceInput , IResourceDiffInput , IResourceSideBySideInput , IEditor , ITextEditorOptions , IEditorOptions } from 'vs/platform/editor/common/editor' ;
10+ import { GroupIdentifier , IFileEditorInput , IEditorInputFactoryRegistry , Extensions as EditorExtensions , IFileInputFactory , EditorInput , SideBySideEditorInput , IEditorInputWithOptions , isEditorInputWithOptions , EditorOptions , TextEditorOptions , IEditorOpeningEvent } from 'vs/workbench/common/editor' ;
1111import { ResourceEditorInput } from 'vs/workbench/common/editor/resourceEditorInput' ;
1212import { DataUriEditorInput } from 'vs/workbench/common/editor/dataUriEditorInput' ;
1313import { Registry } from 'vs/platform/registry/common/platform' ;
@@ -163,9 +163,9 @@ export class NextEditorService extends Disposable implements INextEditorService
163163
164164 //#region openEditor()
165165
166- openEditor ( editor : IEditorInput , options ?: IEditorOptions , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor > ;
167- openEditor ( editor : IResourceEditor , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor > ;
168- openEditor ( editor : IEditorInput | IResourceEditor , optionsOrGroup ?: IEditorOptions | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE , group ?: GroupIdentifier ) : Thenable < IEditor > {
166+ openEditor ( editor : IEditorInput , options ?: IEditorOptions , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor > ;
167+ openEditor ( editor : IResourceEditor , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor > ;
168+ openEditor ( editor : IEditorInput | IResourceEditor , optionsOrGroup ?: IEditorOptions | INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE , group ?: GroupIdentifier ) : Thenable < IEditor > {
169169
170170 // Typed Editor Support
171171 if ( editor instanceof EditorInput ) {
@@ -189,17 +189,22 @@ export class NextEditorService extends Disposable implements INextEditorService
189189 const typedInput = this . createInput ( textInput ) ;
190190 if ( typedInput ) {
191191 const editorOptions = TextEditorOptions . from ( textInput ) ;
192- const targetGroup = this . findTargetGroup ( typedInput , editorOptions , optionsOrGroup as GroupIdentifier ) ;
192+ const targetGroup = this . findTargetGroup ( typedInput , editorOptions , optionsOrGroup as INextEditorGroup | GroupIdentifier ) ;
193193
194194 return targetGroup . openEditor ( typedInput , editorOptions ) . then ( ( ) => targetGroup . activeControl ) ;
195195 }
196196
197197 return TPromise . wrap < IEditor > ( null ) ;
198198 }
199199
200- private findTargetGroup ( input : IEditorInput , options ?: IEditorOptions , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : INextEditorGroup {
200+ private findTargetGroup ( input : IEditorInput , options ?: IEditorOptions , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : INextEditorGroup {
201201 let targetGroup : INextEditorGroup ;
202202
203+ // Group: Instance of Group
204+ if ( group && typeof group !== 'number' ) {
205+ return group ;
206+ }
207+
203208 // Group: Active Group
204209 if ( group === ACTIVE_GROUP ) {
205210 targetGroup = this . nextEditorGroupsService . activeGroup ;
@@ -271,9 +276,9 @@ export class NextEditorService extends Disposable implements INextEditorService
271276
272277 //#region openEditors()
273278
274- openEditors ( editors : IEditorInputWithOptions [ ] , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > ;
275- openEditors ( editors : IResourceEditor [ ] , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > ;
276- openEditors ( editors : ( IEditorInputWithOptions | IResourceEditor ) [ ] , group ?: GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > {
279+ openEditors ( editors : IEditorInputWithOptions [ ] , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > ;
280+ openEditors ( editors : IResourceEditor [ ] , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > ;
281+ openEditors ( editors : ( IEditorInputWithOptions | IResourceEditor ) [ ] , group ?: INextEditorGroup | GroupIdentifier | SIDE_GROUP_TYPE | ACTIVE_GROUP_TYPE ) : Thenable < IEditor [ ] > {
277282
278283 // Convert to typed editors and options
279284 const typedEditors : IEditorInputWithOptions [ ] = [ ] ;
0 commit comments