Skip to content

Commit

Permalink
Merge pull request #27 from onivim/bryphe/api/open-file-options
Browse files Browse the repository at this point in the history
API: Open File Options + getBuffers
  • Loading branch information
bryphe authored Feb 27, 2018
2 parents 3e052d2 + a5c46b3 commit 52d15ce
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
29 changes: 28 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

/**
Expand All @@ -114,6 +137,8 @@ export interface EditorManager {
* for example, when focus moves from one `Editor` to another.
*/
onActiveEditorChanged: IEvent<Editor>

openFile(filePath: string, options?: FileOpenOptions): Promise<Buffer>
}

export interface InputManager {
Expand Down Expand Up @@ -243,7 +268,9 @@ export interface Editor {
*/
blockInput(atomicInputFunction: (inputCallback: InputCallbackFunction) => Promise<void>): void

openFile(file: string, method?: string): Promise<Buffer>
openFile(file: string, openOptions?: FileOpenOptions): Promise<Buffer>

getBuffers(): Array<Buffer | InactiveBuffer>

onBufferEnter: IEvent<EditorBufferEventArgs>
onBufferLeave: IEvent<EditorBufferEventArgs>
Expand Down

0 comments on commit 52d15ce

Please sign in to comment.