@@ -72,8 +72,8 @@ 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 ,
75
+ lnum : string | number ,
76
+ end ?: string | number ,
77
77
) : Promise < string | string [ ] > {
78
78
if ( end ) {
79
79
return await denops . call ( "getbufline" , name , lnum , end ) as string [ ] ;
@@ -83,20 +83,47 @@ export async function getbufline(
83
83
84
84
export async function getline (
85
85
denops : Denops ,
86
- lnum : number ,
87
- end ?: number ,
86
+ lnum : string | number ,
87
+ end ?: string | number ,
88
88
) : Promise < string | string [ ] > {
89
89
if ( end ) {
90
90
return await denops . call ( "getline" , lnum , end ) as string [ ] ;
91
91
}
92
92
return await denops . call ( "getline" , lnum ) as string ;
93
93
}
94
94
95
- export async function has ( denops : Denops , name : string ) : Promise < boolean > {
95
+ export async function has (
96
+ denops : Denops ,
97
+ name : string ,
98
+ check ?: boolean ,
99
+ ) : Promise < boolean > {
100
+ if ( check ) {
101
+ const result = await denops . call ( "has" , name , 1 ) as number ;
102
+ return ! ! result ;
103
+ }
96
104
const result = await denops . call ( "has" , name ) as number ;
97
105
return ! ! result ;
98
106
}
99
107
108
+ export async function setbufline (
109
+ denops : Denops ,
110
+ name : string | number ,
111
+ lnum : string | number ,
112
+ text : string | string [ ] ,
113
+ ) : Promise < boolean > {
114
+ const result = await denops . call ( "setbufline" , name , lnum , text ) as number ;
115
+ return ! ! result ;
116
+ }
117
+
118
+ export async function setline (
119
+ denops : Denops ,
120
+ lnum : string | number ,
121
+ text : string | string [ ] ,
122
+ ) : Promise < boolean > {
123
+ const result = await denops . call ( "setline" , lnum , text ) as number ;
124
+ return ! ! result ;
125
+ }
126
+
100
127
export class FunctionHelper {
101
128
#denops: Denops ;
102
129
@@ -144,15 +171,31 @@ export class FunctionHelper {
144
171
return await has ( this . #denops, name ) ;
145
172
}
146
173
147
- async getbufline ( name : string | number , lnum : number , end ?: number ) {
174
+ async getbufline (
175
+ name : string | number ,
176
+ lnum : string | number ,
177
+ end ?: string | number ,
178
+ ) {
148
179
return await getbufline ( this . #denops, name , lnum , end ) ;
149
180
}
150
181
151
- async getline ( lnum : number , end ?: number ) {
182
+ async getline ( lnum : string | number , end ?: string | number ) {
152
183
return await getline ( this . #denops, lnum , end ) ;
153
184
}
154
185
155
- async has ( name : string ) : Promise < boolean > {
156
- return await has ( this . #denops, name ) ;
186
+ async has ( name : string , check ?: boolean ) : Promise < boolean > {
187
+ return await has ( this . #denops, name , check ) ;
188
+ }
189
+
190
+ async setbufline (
191
+ name : string | number ,
192
+ lnum : string | number ,
193
+ text : string | string [ ] ,
194
+ ) {
195
+ return await setbufline ( this . #denops, name , lnum , text ) ;
196
+ }
197
+
198
+ async setline ( lnum : string | number , text : string | string [ ] ) {
199
+ return await setline ( this . #denops, lnum , text ) ;
157
200
}
158
201
}
0 commit comments