diff --git a/package.json b/package.json index f512bf8..d5fbfb2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oni-api", - "version": "0.0.35", + "version": "0.0.36", "description": "Oni's API layer", "main": "lib/index.js", "types": "lib/index.d.ts", diff --git a/src/index.ts b/src/index.ts index 9cf8c65..6a9f7fb 100644 --- a/src/index.ts +++ b/src/index.ts @@ -90,6 +90,29 @@ export interface IWindowSplit { render(): JSX.Element } +export enum FileOpenMode { + // Open file in existing editor / tab, if it is already open. + // Otherwise, open in a new tab in the active editor. + Edit = 0, + + // Open file in a new vertical split + VerticalSplit, + + // Open file in a new horizontal split + HorizontalSplit, + + // Open file in a new tab, in the active editor + NewTab, +} + +export interface FileOpenOptions { + openMode: FileOpenMode +} + +export const DefaultFileOpenOptions: FileOpenOptions = { + openMode: FileOpenMode.Edit +} + export interface EditorManager { /** @@ -114,6 +137,8 @@ export interface EditorManager { * for example, when focus moves from one `Editor` to another. */ onActiveEditorChanged: IEvent + + openFile(filePath: string, options?: FileOpenOptions): Promise } export interface InputManager { @@ -243,7 +268,9 @@ export interface Editor { */ blockInput(atomicInputFunction: (inputCallback: InputCallbackFunction) => Promise): void - openFile(file: string, method?: string): Promise + openFile(file: string, openOptions?: FileOpenOptions): Promise + + getBuffers(): Array onBufferEnter: IEvent onBufferLeave: IEvent