Skip to content

Commit 8a2c449

Browse files
committed
Added custom typings file
1 parent bc4e5bc commit 8a2c449

File tree

2 files changed

+142
-1
lines changed

2 files changed

+142
-1
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@ node_modules
66
.DS_Store
77
*.vsix
88
*.log
9-
typings
9+
10+
typings/*
11+
!typings/custom/
1012
testing
Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
declare module "promised-neovim-client" {
2+
3+
export interface Nvim extends NodeJS.EventEmitter {
4+
quit(): void;
5+
getVersion(): NvimVersion;
6+
bufLineCount(buffer: Buffer, notify?: boolean): Promise<number>;
7+
bufGetLines(buffer: Buffer, start: number, end: number, strict_indexing: boolean, notify?: boolean): Promise<Array<string>>;
8+
bufSetLines(buffer: Buffer, start: number, end: number, strict_indexing: boolean, replacement: Array<string>, notify?: boolean): Promise<void>;
9+
bufGetVar(buffer: Buffer, name: string, notify?: boolean): Promise<VimValue>;
10+
bufSetVar(buffer: Buffer, name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
11+
bufDelVar(buffer: Buffer, name: string, notify?: boolean): Promise<VimValue>;
12+
bufGetOption(buffer: Buffer, name: string, notify?: boolean): Promise<VimValue>;
13+
bufSetOption(buffer: Buffer, name: string, value: VimValue, notify?: boolean): Promise<void>;
14+
bufGetNumber(buffer: Buffer, notify?: boolean): Promise<number>;
15+
bufGetName(buffer: Buffer, notify?: boolean): Promise<string>;
16+
bufSetName(buffer: Buffer, name: string, notify?: boolean): Promise<void>;
17+
bufIsValid(buffer: Buffer, notify?: boolean): Promise<boolean>;
18+
bufGetMark(buffer: Buffer, name: string, notify?: boolean): Promise<Array<number>>;
19+
bufAddHighlight(buffer: Buffer, src_id: number, hl_group: string, line: number, col_start: number, col_end: number, notify?: boolean): Promise<number>;
20+
bufClearHighlight(buffer: Buffer, src_id: number, line_start: number, line_end: number, notify?: boolean): Promise<void>;
21+
tabpageGetWindows(tabpage: Tabpage, notify?: boolean): Promise<Array<Window>>;
22+
tabpageGetVar(tabpage: Tabpage, name: string, notify?: boolean): Promise<VimValue>;
23+
tabpageSetVar(tabpage: Tabpage, name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
24+
tabpageDelVar(tabpage: Tabpage, name: string, notify?: boolean): Promise<VimValue>;
25+
tabpageGetWindow(tabpage: Tabpage, notify?: boolean): Promise<Window>;
26+
tabpageIsValid(tabpage: Tabpage, notify?: boolean): Promise<boolean>;
27+
uiAttach(width: number, height: number, enable_rgb: boolean, notify?: boolean): Promise<void>;
28+
uiDetach(notify?: boolean): Promise<void>;
29+
uiTryResize(width: number, height: number, notify?: boolean): Promise<void>;
30+
uiSetOption(name: string, value: VimValue, notify?: boolean): Promise<void>;
31+
command(str: string, notify?: boolean): Promise<void>;
32+
feedkeys(keys: string, mode: string, escape_csi: boolean, notify?: boolean): Promise<void>;
33+
input(keys: string, notify?: boolean): Promise<number>;
34+
replaceTermcodes(str: string, from_part: boolean, do_lt: boolean, special: boolean, notify?: boolean): Promise<string>;
35+
commandOutput(str: string, notify?: boolean): Promise<string>;
36+
eval(str: string, notify?: boolean): Promise<VimValue>;
37+
callFunction(fname: string, args: Array<RPCValue>, notify?: boolean): Promise<VimValue>;
38+
strwidth(str: string, notify?: boolean): Promise<number>;
39+
listRuntimePaths(notify?: boolean): Promise<Array<string>>;
40+
changeDirectory(dir: string, notify?: boolean): Promise<void>;
41+
getCurrentLine(notify?: boolean): Promise<string>;
42+
setCurrentLine(line: string, notify?: boolean): Promise<void>;
43+
delCurrentLine(notify?: boolean): Promise<void>;
44+
getVar(name: string, notify?: boolean): Promise<VimValue>;
45+
setVar(name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
46+
delVar(name: string, notify?: boolean): Promise<VimValue>;
47+
getVvar(name: string, notify?: boolean): Promise<VimValue>;
48+
getOption(name: string, notify?: boolean): Promise<VimValue>;
49+
setOption(name: string, value: VimValue, notify?: boolean): Promise<void>;
50+
outWrite(str: string, notify?: boolean): Promise<void>;
51+
errWrite(str: string, notify?: boolean): Promise<void>;
52+
reportError(str: string, notify?: boolean): Promise<void>;
53+
getBuffers(notify?: boolean): Promise<Array<Buffer>>;
54+
getCurrentBuf(notify?: boolean): Promise<Buffer>;
55+
setCurrentBuffer(buffer: Buffer, notify?: boolean): Promise<void>;
56+
getWindows(notify?: boolean): Promise<Array<Window>>;
57+
getCurrentWindow(notify?: boolean): Promise<Window>;
58+
setCurrentWindow(window: Window, notify?: boolean): Promise<void>;
59+
getTabpages(notify?: boolean): Promise<Array<Tabpage>>;
60+
getCurrentTabpage(notify?: boolean): Promise<Tabpage>;
61+
setCurrentTabpage(tabpage: Tabpage, notify?: boolean): Promise<void>;
62+
getMode(notify?: boolean): Promise<{[key: string]: RPCValue}>
63+
subscribe(event: string, notify?: boolean): Promise<void>;
64+
unsubscribe(event: string, notify?: boolean): Promise<void>;
65+
nameToColor(name: string, notify?: boolean): Promise<number>;
66+
getColorMap(notify?: boolean): Promise<{[key: string]: RPCValue}>;
67+
getApiInfo(notify?: boolean): Promise<Array<RPCValue>>;
68+
winGetBuffer(window: Window, notify?: boolean): Promise<Buffer>;
69+
winGetHeight(window: Window, notify?: boolean): Promise<number>;
70+
winSetHeight(window: Window, height: number, notify?: boolean): Promise<void>;
71+
winGetWidth(window: Window, notify?: boolean): Promise<number>;
72+
winSetWidth(window: Window, width: number, notify?: boolean): Promise<void>;
73+
winGetVar(window: Window, name: string, notify?: boolean): Promise<VimValue>;
74+
winSetVar(window: Window, name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
75+
winDelVar(window: Window, name: string, notify?: boolean): Promise<VimValue>;
76+
winGetOption(window: Window, name: string, notify?: boolean): Promise<VimValue>;
77+
winSetOption(window: Window, name: string, value: VimValue, notify?: boolean): Promise<void>;
78+
winGetPosition(window: Window, notify?: boolean): Promise<Array<number>>;
79+
winGetTabpage(window: Window, notify?: boolean): Promise<Tabpage>;
80+
winIsValid(window: Window, notify?: boolean): Promise<boolean>;
81+
equals(rhs: Nvim): boolean;
82+
}
83+
export interface Buffer {
84+
getLine(index: number, notify?: boolean): Promise<string>;
85+
setLine(index: number, line: string, notify?: boolean): Promise<void>;
86+
delLine(index: number, notify?: boolean): Promise<void>;
87+
getLineSlice(start: number, end: number, include_start: boolean, include_end: boolean, notify?: boolean): Promise<Array<string>>;
88+
setLineSlice(start: number, end: number, include_start: boolean, include_end: boolean, replacement: Array<string>, notify?: boolean): Promise<void>;
89+
insert(lnum: number, lines: Array<string>, notify?: boolean): Promise<void>;
90+
lineCount(notify?: boolean): Promise<number>;
91+
getLines(start: number, end: number, strict_indexing: boolean, notify?: boolean): Promise<Array<string>>;
92+
setLines(start: number, end: number, strict_indexing: boolean, replacement: Array<string>, notify?: boolean): Promise<void>;
93+
getVar(name: string, notify?: boolean): Promise<VimValue>;
94+
setVar(name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
95+
delVar(name: string, notify?: boolean): Promise<VimValue>;
96+
getOption(name: string, notify?: boolean): Promise<VimValue>;
97+
setOption(name: string, value: VimValue, notify?: boolean): Promise<void>;
98+
getNumber(notify?: boolean): Promise<number>;
99+
getName(notify?: boolean): Promise<string>;
100+
setName(name: string, notify?: boolean): Promise<void>;
101+
isValid(notify?: boolean): Promise<boolean>;
102+
getMark(name: string, notify?: boolean): Promise<Array<number>>;
103+
addHighlight(src_id: number, hl_group: string, line: number, col_start: number, col_end: number, notify?: boolean): Promise<number>;
104+
clearHighlight(src_id: number, line_start: number, line_end: number, notify?: boolean): Promise<void>;
105+
equals(rhs: Buffer): boolean;
106+
}
107+
export interface Window {
108+
getBuffer(notify?: boolean): Promise<Buffer>;
109+
getCursor(notify?: boolean): Promise<Array<number>>;
110+
setCursor(pos: Array<number>, notify?: boolean): Promise<void>;
111+
getHeight(notify?: boolean): Promise<number>;
112+
setHeight(height: number, notify?: boolean): Promise<void>;
113+
getWidth(notify?: boolean): Promise<number>;
114+
setWidth(width: number, notify?: boolean): Promise<void>;
115+
getVar(name: string, notify?: boolean): Promise<VimValue>;
116+
setVar(name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
117+
delVar(name: string, notify?: boolean): Promise<VimValue>;
118+
getOption(name: string, notify?: boolean): Promise<VimValue>;
119+
setOption(name: string, value: VimValue, notify?: boolean): Promise<void>;
120+
getPosition(notify?: boolean): Promise<Array<number>>;
121+
getTabpage(notify?: boolean): Promise<Tabpage>;
122+
isValid(notify?: boolean): Promise<boolean>;
123+
equals(rhs: Window): boolean;
124+
}
125+
export interface Tabpage {
126+
getWindows(notify?: boolean): Promise<Array<Window>>;
127+
getVar(name: string, notify?: boolean): Promise<VimValue>;
128+
setVar(name: string, value: VimValue, notify?: boolean): Promise<VimValue>;
129+
delVar(name: string, notify?: boolean): Promise<VimValue>;
130+
getWindow(notify?: boolean): Promise<Window>;
131+
isValid(notify?: boolean): Promise<boolean>;
132+
equals(rhs: Tabpage): boolean;
133+
}
134+
export function attach(writer: NodeJS.WritableStream, reader: NodeJS.ReadableStream): Promise<Nvim>;
135+
136+
export interface NvimVersion { major: number; minor: number; patch: number; rest: string; }
137+
export type RPCValue = Buffer | Window | Tabpage | number | boolean | string | any[] | {[key: string]: any};
138+
export type VimValue = number | boolean | string | any[] | {[key: string]: any} | null
139+
}

0 commit comments

Comments
 (0)