@@ -3,21 +3,23 @@ import { IEditorOverrideServices, StandaloneServices } from 'vs/editor/standalon
33import { IResolvedTextEditorModel , ITextModelService } from 'vs/editor/common/services/resolverService'
44import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'
55import { CodeEditorService } from 'vs/workbench/services/editor/browser/codeEditorService'
6- import { IEditorService , PreferredGroup } from 'vs/workbench/services/editor/common/editorService'
7- import { IEditorPane , IResourceDiffEditorInput , ITextDiffEditorPane , IUntitledTextResourceEditorInput , IUntypedEditorInput } from 'vs/workbench/common/editor'
6+ import { IEditorService , IEditorsChangeEvent , IOpenEditorsOptions , IRevertAllEditorsOptions , ISaveAllEditorsOptions , ISaveEditorsOptions , ISaveEditorsResult , IUntypedEditorReplacement , PreferredGroup } from 'vs/workbench/services/editor/common/editorService'
7+ import { EditorInputWithOptions , EditorsOrder , GroupIdentifier , IEditorCloseEvent , IEditorIdentifier , IEditorPane , IFindEditorOptions , IResourceDiffEditorInput , IRevertOptions , ITextDiffEditorPane , IUntitledTextResourceEditorInput , IUntypedEditorInput , IVisibleEditorPane } from 'vs/workbench/common/editor'
88import { Emitter , Event } from 'vs/base/common/event'
99import { EditorInput } from 'vs/workbench/common/editor/editorInput'
10- import { IEditorOptions , IResourceEditorInput , ITextResourceEditorInput } from 'vs/platform/editor/common/editor'
10+ import { IEditorOptions , IResourceEditorInput , IResourceEditorInputIdentifier , ITextResourceEditorInput } from 'vs/platform/editor/common/editor'
1111import { IEditor } from 'vs/editor/common/editorCommon'
1212import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
1313import { Disposable , IReference } from 'vs/base/common/lifecycle'
14- import { ICodeEditor } from 'vs/editor/browser/editorBrowser'
14+ import { ICodeEditor , IDiffEditor } from 'vs/editor/browser/editorBrowser'
1515import { ITextEditorService , TextEditorService } from 'vs/workbench/services/textfile/common/textEditorService'
16+ import { ICloseEditorOptions , IEditorGroup , IEditorReplacement } from 'vs/workbench/services/editor/common/editorGroupsService'
17+ import { URI } from 'vs/base/common/uri'
1618import { OpenEditor , wrapOpenEditor } from './tools/editor'
1719import { unsupported } from '../tools'
1820import 'vs/workbench/browser/parts/editor/editor.contribution'
1921
20- class EditorService extends Disposable implements IEditorService {
22+ class SimpleEditorService extends Disposable implements IEditorService {
2123 public activeTextEditorControl : IEditor | undefined
2224 private _onDidActiveEditorChange = this . _register ( new Emitter < void > ( ) )
2325
@@ -49,47 +51,49 @@ class EditorService extends Disposable implements IEditorService {
4951 }
5052
5153 readonly _serviceBrand : undefined
52- onDidActiveEditorChange = this . _onDidActiveEditorChange . event
53- onDidVisibleEditorsChange = Event . None
54- onDidEditorsChange = Event . None
55- onDidCloseEditor = Event . None
56- activeEditorPane : undefined
57- activeEditor : undefined
58- activeTextEditorLanguageId = undefined
59- visibleEditorPanes = [ ]
60- visibleEditors = [ ]
61- visibleTextEditorControls = [ ]
62- editors = [ ]
63- count = 0
64- getEditors = ( ) => [ ]
54+ onDidActiveEditorChange : Event < void > = this . _onDidActiveEditorChange . event
55+ onDidVisibleEditorsChange : Event < void > = Event . None
56+ onDidEditorsChange : Event < IEditorsChangeEvent > = Event . None
57+ onDidCloseEditor : Event < IEditorCloseEvent > = Event . None
58+ activeEditorPane : IVisibleEditorPane | undefined
59+ activeEditor : EditorInput | undefined
60+ activeTextEditorLanguageId : string | undefined
61+ visibleEditorPanes : IVisibleEditorPane [ ] = [ ]
62+ visibleEditors : EditorInput [ ] = [ ]
63+ visibleTextEditorControls : Array < ICodeEditor | IDiffEditor > = [ ]
64+ editors : EditorInput [ ] = [ ]
65+ count : number = 0
66+ getEditors : ( order : EditorsOrder , options ?: { excludeSticky ?: boolean } ) => readonly IEditorIdentifier [ ] = ( ) => [ ]
6567
6668 openEditor ( editor : EditorInput , options ?: IEditorOptions , group ?: PreferredGroup ) : Promise < IEditorPane | undefined >
6769 openEditor ( editor : IUntypedEditorInput , group ?: PreferredGroup ) : Promise < IEditorPane | undefined >
6870 openEditor ( editor : IResourceEditorInput , group ?: PreferredGroup ) : Promise < IEditorPane | undefined >
6971 openEditor ( editor : ITextResourceEditorInput | IUntitledTextResourceEditorInput , group ?: PreferredGroup ) : Promise < IEditorPane | undefined >
7072 openEditor ( editor : IResourceDiffEditorInput , group ?: PreferredGroup ) : Promise < ITextDiffEditorPane | undefined >
7173 openEditor ( editor : EditorInput | IUntypedEditorInput , optionsOrPreferredGroup ?: IEditorOptions | PreferredGroup , preferredGroup ?: PreferredGroup ) : Promise < IEditorPane | undefined >
72- async openEditor ( ) {
74+ async openEditor ( _editor : EditorInput | IUntypedEditorInput , _optionsOrPreferredGroup ?: IEditorOptions | PreferredGroup , _preferredGroup ?: PreferredGroup ) : Promise < IEditorPane | undefined > {
7375 return undefined
7476 }
7577
76- openEditors = unsupported
77- replaceEditors = unsupported
78- isOpened = ( ) => false
79- isVisible = ( ) => false
80- findEditors = ( ) => [ ]
81- save = async ( ) => ( { success : true , editors : [ ] } )
82- saveAll = async ( ) => ( { success : true , editors : [ ] } )
83- revert = unsupported
84- revertAll = unsupported
85- closeEditor = unsupported
86- closeEditors = unsupported
78+ openEditors : ( editors : Array < EditorInputWithOptions | IUntypedEditorInput > , preferredGroup ?: PreferredGroup , options ?: IOpenEditorsOptions ) => Promise < IEditorPane [ ] > = unsupported
79+ replaceEditors : ( replacements : Array < IEditorReplacement | IUntypedEditorReplacement > , group : IEditorGroup | GroupIdentifier ) => Promise < void > = unsupported
80+ isOpened : ( editor : IResourceEditorInputIdentifier ) => boolean = ( ) => false
81+ isVisible : ( editor : EditorInput ) => boolean = ( ) => false
82+ findEditors ( resource : URI , options ?: IFindEditorOptions ) : readonly IEditorIdentifier [ ]
83+ findEditors ( editor : IResourceEditorInputIdentifier , options ?: IFindEditorOptions ) : readonly IEditorIdentifier [ ]
84+ findEditors ( ) : readonly IEditorIdentifier [ ] { return [ ] }
85+ save : ( editors : IEditorIdentifier | IEditorIdentifier [ ] , options ?: ISaveEditorsOptions ) => Promise < ISaveEditorsResult > = async ( ) => ( { success : true , editors : [ ] } )
86+ saveAll : ( options ?: ISaveAllEditorsOptions ) => Promise < ISaveEditorsResult > = async ( ) => ( { success : true , editors : [ ] } )
87+ revert : ( editors : IEditorIdentifier | IEditorIdentifier [ ] , options ?: IRevertOptions ) => Promise < boolean > = unsupported
88+ revertAll : ( options ?: IRevertAllEditorsOptions ) => Promise < boolean > = unsupported
89+ closeEditor : ( editor : IEditorIdentifier , options ?: ICloseEditorOptions ) => Promise < void > = unsupported
90+ closeEditors : ( editors : readonly IEditorIdentifier [ ] , options ?: ICloseEditorOptions ) => Promise < void > = unsupported
8791}
8892
8993export default function getServiceOverride ( openEditor : OpenEditor ) : IEditorOverrideServices {
9094 return {
9195 [ ICodeEditorService . toString ( ) ] : new SyncDescriptor ( CodeEditorService , undefined , true ) ,
92- [ IEditorService . toString ( ) ] : new SyncDescriptor ( EditorService , [ openEditor ] ) ,
96+ [ IEditorService . toString ( ) ] : new SyncDescriptor ( SimpleEditorService , [ openEditor ] ) ,
9397 [ ITextEditorService . toString ( ) ] : new SyncDescriptor ( TextEditorService )
9498 }
9599}
@@ -98,5 +102,6 @@ export {
98102 OpenEditor ,
99103 IEditorOptions ,
100104 IResolvedTextEditorModel ,
101- IReference
105+ IReference ,
106+ SimpleEditorService
102107}
0 commit comments