@@ -72,31 +72,64 @@ export async function exists(denops: Denops, name: string): Promise<boolean> {
72
72
export async function getbufline (
73
73
denops : Denops ,
74
74
name : string | number ,
75
- lnum : number ,
76
- end ?: number ,
77
- ) : Promise < string | string [ ] > {
78
- if ( end ) {
79
- return await denops . call ( "getbufline" , name , lnum , end ) as string [ ] ;
80
- }
81
- return await denops . call ( "getbufline" , name , lnum ) as string ;
75
+ lnum : string | number ,
76
+ end ?: string | number ,
77
+ ) : Promise < string [ ] > {
78
+ return await denops . call ( "getbufline" , name , lnum , end ) as string [ ] ;
82
79
}
83
80
84
81
export async function getline (
85
82
denops : Denops ,
86
- lnum : number ,
87
- end ?: number ,
83
+ lnum : string | number ,
84
+ ) : Promise < string > ;
85
+ export async function getline (
86
+ denops : Denops ,
87
+ lnum : string | number ,
88
+ end : string | number ,
89
+ ) : Promise < string [ ] > ;
90
+ export async function getline (
91
+ denops : Denops ,
92
+ lnum : string | number ,
93
+ end ?: string | number ,
88
94
) : Promise < string | string [ ] > {
89
95
if ( end ) {
90
96
return await denops . call ( "getline" , lnum , end ) as string [ ] ;
91
97
}
92
98
return await denops . call ( "getline" , lnum ) as string ;
93
99
}
94
100
95
- export async function has ( denops : Denops , name : string ) : Promise < boolean > {
101
+ export async function has (
102
+ denops : Denops ,
103
+ name : string ,
104
+ check ?: boolean ,
105
+ ) : Promise < boolean > {
106
+ if ( check ) {
107
+ const result = await denops . call ( "has" , name , 1 ) as number ;
108
+ return ! ! result ;
109
+ }
96
110
const result = await denops . call ( "has" , name ) as number ;
97
111
return ! ! result ;
98
112
}
99
113
114
+ export async function setbufline (
115
+ denops : Denops ,
116
+ name : string | number ,
117
+ lnum : string | number ,
118
+ text : string | string [ ] ,
119
+ ) : Promise < boolean > {
120
+ const result = await denops . call ( "setbufline" , name , lnum , text ) as number ;
121
+ return ! ! result ;
122
+ }
123
+
124
+ export async function setline (
125
+ denops : Denops ,
126
+ lnum : string | number ,
127
+ text : string | string [ ] ,
128
+ ) : Promise < boolean > {
129
+ const result = await denops . call ( "setline" , lnum , text ) as number ;
130
+ return ! ! result ;
131
+ }
132
+
100
133
export class FunctionHelper {
101
134
#denops: Denops ;
102
135
@@ -144,15 +177,36 @@ export class FunctionHelper {
144
177
return await has ( this . #denops, name ) ;
145
178
}
146
179
147
- async getbufline ( name : string | number , lnum : number , end ?: number ) {
180
+ async getbufline (
181
+ name : string | number ,
182
+ lnum : string | number ,
183
+ end ?: string | number ,
184
+ ) {
148
185
return await getbufline ( this . #denops, name , lnum , end ) ;
149
186
}
150
187
151
- async getline ( lnum : number , end ?: number ) {
152
- return await getline ( this . #denops, lnum , end ) ;
188
+ async getline ( lnum : string | number ) : Promise < string > ;
189
+ async getline ( lnum : string | number , end : string | number ) : Promise < string [ ] > ;
190
+ async getline ( lnum : string | number , end ?: string | number ) {
191
+ if ( end ) {
192
+ return await getline ( this . #denops, lnum , end ) ;
193
+ }
194
+ return await getline ( this . #denops, lnum ) ;
153
195
}
154
196
155
- async has ( name : string ) : Promise < boolean > {
156
- return await has ( this . #denops, name ) ;
197
+ async has ( name : string , check ?: boolean ) : Promise < boolean > {
198
+ return await has ( this . #denops, name , check ) ;
199
+ }
200
+
201
+ async setbufline (
202
+ name : string | number ,
203
+ lnum : string | number ,
204
+ text : string | string [ ] ,
205
+ ) {
206
+ return await setbufline ( this . #denops, name , lnum , text ) ;
207
+ }
208
+
209
+ async setline ( lnum : string | number , text : string | string [ ] ) {
210
+ return await setline ( this . #denops, lnum , text ) ;
157
211
}
158
212
}
0 commit comments