Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: expose SimpleEditorService #141

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 21 additions & 15 deletions src/service-override/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
import { IResolvedTextEditorModel, ITextModelService } from 'vs/editor/common/services/resolverService'
import { ICodeEditorService } from 'vs/editor/browser/services/codeEditorService'
import { CodeEditorService } from 'vs/workbench/services/editor/browser/codeEditorService'
import { IEditorService, PreferredGroup } from 'vs/workbench/services/editor/common/editorService'
import { IEditorPane, IResourceDiffEditorInput, ITextDiffEditorPane, IUntitledTextResourceEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor'
import { IEditorService, IRevertAllEditorsOptions, ISaveAllEditorsOptions, ISaveEditorsOptions, ISaveEditorsResult, PreferredGroup, SIDE_GROUP_TYPE } from 'vs/workbench/services/editor/common/editorService'

Check failure on line 6 in src/service-override/editor.ts

View workflow job for this annotation

GitHub Actions / Check build

'SIDE_GROUP_TYPE' is declared but its value is never read.
import { EditorsOrder, IEditorIdentifier, IEditorPane, IFindEditorOptions, IResourceDiffEditorInput, IRevertOptions, ITextDiffEditorPane, IUntitledTextResourceEditorInput, IUntypedEditorInput } from 'vs/workbench/common/editor'
import { Emitter, Event } from 'vs/base/common/event'
import { EditorInput } from 'vs/workbench/common/editor/editorInput'
import { IEditorOptions, IResourceEditorInput, ITextResourceEditorInput } from 'vs/platform/editor/common/editor'
import { IEditorOptions, IResourceEditorInput, IResourceEditorInputIdentifier, ITextResourceEditorInput } from 'vs/platform/editor/common/editor'
import { IEditor } from 'vs/editor/common/editorCommon'
import { SyncDescriptor } from 'vs/platform/instantiation/common/descriptors'
import { Disposable, IReference } from 'vs/base/common/lifecycle'
import { ICodeEditor } from 'vs/editor/browser/editorBrowser'
import { ITextEditorService, TextEditorService } from 'vs/workbench/services/textfile/common/textEditorService'
import { ICloseEditorOptions } from 'vs/workbench/services/editor/common/editorGroupsService'
import { URI } from 'vs/base/common/uri'
import { OpenEditor, wrapOpenEditor } from './tools/editor'
import { unsupported } from '../tools'
import 'vs/workbench/browser/parts/editor/editor.contribution'
Expand Down Expand Up @@ -61,29 +63,32 @@
visibleTextEditorControls = []
editors = []
count = 0
getEditors = () => []
getEditors: (order: EditorsOrder, options?: { excludeSticky?: boolean
}) => readonly IEditorIdentifier[] = () => []

openEditor(editor: EditorInput, options?: IEditorOptions, group?: PreferredGroup): Promise<IEditorPane | undefined>
openEditor(editor: IUntypedEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>
openEditor(editor: IResourceEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>
openEditor(editor: ITextResourceEditorInput | IUntitledTextResourceEditorInput, group?: PreferredGroup): Promise<IEditorPane | undefined>
openEditor(editor: IResourceDiffEditorInput, group?: PreferredGroup): Promise<ITextDiffEditorPane | undefined>
openEditor(editor: EditorInput | IUntypedEditorInput, optionsOrPreferredGroup?: IEditorOptions | PreferredGroup, preferredGroup?: PreferredGroup): Promise<IEditorPane | undefined>
async openEditor () {
async openEditor (): Promise<IEditorPane | undefined> {
return undefined
}

openEditors = unsupported
replaceEditors = unsupported
isOpened = () => false
isVisible = () => false
findEditors = () => []
save = async () => ({ success: true, editors: [] })
saveAll = async () => ({ success: true, editors: [] })
revert = unsupported
revertAll = unsupported
closeEditor = unsupported
closeEditors = unsupported
isOpened: (editor: IResourceEditorInputIdentifier) => boolean = () => false
isVisible: (editor: EditorInput) => boolean = () => false
findEditors(resource: URI, options?: IFindEditorOptions): readonly IEditorIdentifier[]
findEditors(editor: IResourceEditorInputIdentifier, options?: IFindEditorOptions): readonly IEditorIdentifier[]
findEditors (): readonly IEditorIdentifier[] { return [] }
save: (editors: IEditorIdentifier | IEditorIdentifier[], options?: ISaveEditorsOptions) => Promise<ISaveEditorsResult> = async () => ({ success: true, editors: [] })
saveAll: (options?: ISaveAllEditorsOptions) => Promise<ISaveEditorsResult> = async () => ({ success: true, editors: [] })
revert: (editors: IEditorIdentifier | IEditorIdentifier[], options?: IRevertOptions) => Promise<boolean> = unsupported
revertAll: (options?: IRevertAllEditorsOptions) => Promise<boolean> = unsupported
closeEditor: (editor: IEditorIdentifier, options?: ICloseEditorOptions) => Promise<void> = unsupported
closeEditors: (editors: readonly IEditorIdentifier[], options?: ICloseEditorOptions) => Promise<void> = unsupported
}

export default function getServiceOverride (openEditor: OpenEditor): IEditorOverrideServices {
Expand All @@ -98,5 +103,6 @@
OpenEditor,
IEditorOptions,
IResolvedTextEditorModel,
IReference
IReference,
EditorService as SimpleEditorService
}
Loading