diff --git a/.gitignore b/.gitignore index a49e6b6f..8702603e 100644 --- a/.gitignore +++ b/.gitignore @@ -6,5 +6,7 @@ node_modules .DS_Store *.vsix *.log -typings + +typings/* +!typings/custom/ testing diff --git a/typings/custom/promised-neovim-client.d.ts b/typings/custom/promised-neovim-client.d.ts new file mode 100644 index 00000000..d097daf1 --- /dev/null +++ b/typings/custom/promised-neovim-client.d.ts @@ -0,0 +1,139 @@ +declare module "promised-neovim-client" { + + export interface Nvim extends NodeJS.EventEmitter { + quit(): void; + getVersion(): NvimVersion; + bufLineCount(buffer: Buffer, notify?: boolean): Promise; + bufGetLines(buffer: Buffer, start: number, end: number, strict_indexing: boolean, notify?: boolean): Promise>; + bufSetLines(buffer: Buffer, start: number, end: number, strict_indexing: boolean, replacement: Array, notify?: boolean): Promise; + bufGetVar(buffer: Buffer, name: string, notify?: boolean): Promise; + bufSetVar(buffer: Buffer, name: string, value: VimValue, notify?: boolean): Promise; + bufDelVar(buffer: Buffer, name: string, notify?: boolean): Promise; + bufGetOption(buffer: Buffer, name: string, notify?: boolean): Promise; + bufSetOption(buffer: Buffer, name: string, value: VimValue, notify?: boolean): Promise; + bufGetNumber(buffer: Buffer, notify?: boolean): Promise; + bufGetName(buffer: Buffer, notify?: boolean): Promise; + bufSetName(buffer: Buffer, name: string, notify?: boolean): Promise; + bufIsValid(buffer: Buffer, notify?: boolean): Promise; + bufGetMark(buffer: Buffer, name: string, notify?: boolean): Promise>; + bufAddHighlight(buffer: Buffer, src_id: number, hl_group: string, line: number, col_start: number, col_end: number, notify?: boolean): Promise; + bufClearHighlight(buffer: Buffer, src_id: number, line_start: number, line_end: number, notify?: boolean): Promise; + tabpageGetWindows(tabpage: Tabpage, notify?: boolean): Promise>; + tabpageGetVar(tabpage: Tabpage, name: string, notify?: boolean): Promise; + tabpageSetVar(tabpage: Tabpage, name: string, value: VimValue, notify?: boolean): Promise; + tabpageDelVar(tabpage: Tabpage, name: string, notify?: boolean): Promise; + tabpageGetWindow(tabpage: Tabpage, notify?: boolean): Promise; + tabpageIsValid(tabpage: Tabpage, notify?: boolean): Promise; + uiAttach(width: number, height: number, enable_rgb: boolean, notify?: boolean): Promise; + uiDetach(notify?: boolean): Promise; + uiTryResize(width: number, height: number, notify?: boolean): Promise; + uiSetOption(name: string, value: VimValue, notify?: boolean): Promise; + command(str: string, notify?: boolean): Promise; + feedkeys(keys: string, mode: string, escape_csi: boolean, notify?: boolean): Promise; + input(keys: string, notify?: boolean): Promise; + replaceTermcodes(str: string, from_part: boolean, do_lt: boolean, special: boolean, notify?: boolean): Promise; + commandOutput(str: string, notify?: boolean): Promise; + eval(str: string, notify?: boolean): Promise; + callFunction(fname: string, args: Array, notify?: boolean): Promise; + strwidth(str: string, notify?: boolean): Promise; + listRuntimePaths(notify?: boolean): Promise>; + changeDirectory(dir: string, notify?: boolean): Promise; + getCurrentLine(notify?: boolean): Promise; + setCurrentLine(line: string, notify?: boolean): Promise; + delCurrentLine(notify?: boolean): Promise; + getVar(name: string, notify?: boolean): Promise; + setVar(name: string, value: VimValue, notify?: boolean): Promise; + delVar(name: string, notify?: boolean): Promise; + getVvar(name: string, notify?: boolean): Promise; + getOption(name: string, notify?: boolean): Promise; + setOption(name: string, value: VimValue, notify?: boolean): Promise; + outWrite(str: string, notify?: boolean): Promise; + errWrite(str: string, notify?: boolean): Promise; + reportError(str: string, notify?: boolean): Promise; + getBuffers(notify?: boolean): Promise>; + getCurrentBuf(notify?: boolean): Promise; + setCurrentBuffer(buffer: Buffer, notify?: boolean): Promise; + getWindows(notify?: boolean): Promise>; + getCurrentWindow(notify?: boolean): Promise; + setCurrentWindow(window: Window, notify?: boolean): Promise; + getTabpages(notify?: boolean): Promise>; + getCurrentTabpage(notify?: boolean): Promise; + setCurrentTabpage(tabpage: Tabpage, notify?: boolean): Promise; + getMode(notify?: boolean): Promise<{[key: string]: RPCValue}> + subscribe(event: string, notify?: boolean): Promise; + unsubscribe(event: string, notify?: boolean): Promise; + nameToColor(name: string, notify?: boolean): Promise; + getColorMap(notify?: boolean): Promise<{[key: string]: RPCValue}>; + getApiInfo(notify?: boolean): Promise>; + winGetBuffer(window: Window, notify?: boolean): Promise; + winGetHeight(window: Window, notify?: boolean): Promise; + winSetHeight(window: Window, height: number, notify?: boolean): Promise; + winGetWidth(window: Window, notify?: boolean): Promise; + winSetWidth(window: Window, width: number, notify?: boolean): Promise; + winGetVar(window: Window, name: string, notify?: boolean): Promise; + winSetVar(window: Window, name: string, value: VimValue, notify?: boolean): Promise; + winDelVar(window: Window, name: string, notify?: boolean): Promise; + winGetOption(window: Window, name: string, notify?: boolean): Promise; + winSetOption(window: Window, name: string, value: VimValue, notify?: boolean): Promise; + winGetPosition(window: Window, notify?: boolean): Promise>; + winGetTabpage(window: Window, notify?: boolean): Promise; + winIsValid(window: Window, notify?: boolean): Promise; + equals(rhs: Nvim): boolean; + } + export interface Buffer { + getLine(index: number, notify?: boolean): Promise; + setLine(index: number, line: string, notify?: boolean): Promise; + delLine(index: number, notify?: boolean): Promise; + getLineSlice(start: number, end: number, include_start: boolean, include_end: boolean, notify?: boolean): Promise>; + setLineSlice(start: number, end: number, include_start: boolean, include_end: boolean, replacement: Array, notify?: boolean): Promise; + insert(lnum: number, lines: Array, notify?: boolean): Promise; + lineCount(notify?: boolean): Promise; + getLines(start: number, end: number, strict_indexing: boolean, notify?: boolean): Promise>; + setLines(start: number, end: number, strict_indexing: boolean, replacement: Array, notify?: boolean): Promise; + getVar(name: string, notify?: boolean): Promise; + setVar(name: string, value: VimValue, notify?: boolean): Promise; + delVar(name: string, notify?: boolean): Promise; + getOption(name: string, notify?: boolean): Promise; + setOption(name: string, value: VimValue, notify?: boolean): Promise; + getNumber(notify?: boolean): Promise; + getName(notify?: boolean): Promise; + setName(name: string, notify?: boolean): Promise; + isValid(notify?: boolean): Promise; + getMark(name: string, notify?: boolean): Promise>; + addHighlight(src_id: number, hl_group: string, line: number, col_start: number, col_end: number, notify?: boolean): Promise; + clearHighlight(src_id: number, line_start: number, line_end: number, notify?: boolean): Promise; + equals(rhs: Buffer): boolean; + } + export interface Window { + getBuffer(notify?: boolean): Promise; + getCursor(notify?: boolean): Promise>; + setCursor(pos: Array, notify?: boolean): Promise; + getHeight(notify?: boolean): Promise; + setHeight(height: number, notify?: boolean): Promise; + getWidth(notify?: boolean): Promise; + setWidth(width: number, notify?: boolean): Promise; + getVar(name: string, notify?: boolean): Promise; + setVar(name: string, value: VimValue, notify?: boolean): Promise; + delVar(name: string, notify?: boolean): Promise; + getOption(name: string, notify?: boolean): Promise; + setOption(name: string, value: VimValue, notify?: boolean): Promise; + getPosition(notify?: boolean): Promise>; + getTabpage(notify?: boolean): Promise; + isValid(notify?: boolean): Promise; + equals(rhs: Window): boolean; + } + export interface Tabpage { + getWindows(notify?: boolean): Promise>; + getVar(name: string, notify?: boolean): Promise; + setVar(name: string, value: VimValue, notify?: boolean): Promise; + delVar(name: string, notify?: boolean): Promise; + getWindow(notify?: boolean): Promise; + isValid(notify?: boolean): Promise; + equals(rhs: Tabpage): boolean; + } + export function attach(writer: NodeJS.WritableStream, reader: NodeJS.ReadableStream): Promise; + + export interface NvimVersion { major: number; minor: number; patch: number; rest: string; } + export type RPCValue = Buffer | Window | Tabpage | number | boolean | string | any[] | {[key: string]: any}; + export type VimValue = number | boolean | string | any[] | {[key: string]: any} | null +} \ No newline at end of file