Skip to content

Commit 098ca3e

Browse files
committed
Fix code to read builtin function docs for Vim 9
Builtin functions were split out from eval.txt in Vim 8.2.3917
1 parent 5ef194d commit 098ca3e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/script/build-docs.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ interface IConfig {
2424
}
2525

2626
const EVAL_PATH = "/doc/eval.txt";
27+
const BUILTIN_PATH = "/doc/builtin.txt";
2728
const OPTIONS_PATH = "/doc/options.txt";
2829
const INDEX_PATH = "/doc/index.txt";
2930
// const API_PATH = "/doc/api.txt";
@@ -65,6 +66,7 @@ class Server {
6566
if (vimruntime) {
6667
const paths = [
6768
EVAL_PATH,
69+
BUILTIN_PATH,
6870
OPTIONS_PATH,
6971
INDEX_PATH,
7072
// API_PATH,
@@ -229,12 +231,12 @@ class Server {
229231

230232
// get vim builtin function from document eval.txt
231233
private resolveBuiltinFunctions() {
232-
const evalText = this.text[EVAL_PATH] || [];
234+
const builtinText = this.text[BUILTIN_PATH] || [];
233235
let isMatchLine = false;
234236
let completionItem: CompletionItem;
235-
for (const line of evalText) {
237+
for (const line of builtinText) {
236238
if (!isMatchLine) {
237-
if (/\*functions\*/.test(line)) {
239+
if (/\*builtin-function-list\*/.test(line)) {
238240
isMatchLine = true;
239241
}
240242
continue;
@@ -276,15 +278,13 @@ class Server {
276278
}
277279

278280
private resolveBuiltinFunctionsDocument() {
279-
const evalText = this.text[EVAL_PATH] || [];
281+
const builtinText = this.text[BUILTIN_PATH] || [];
280282
let isMatchLine = false;
281283
let label: string = "";
282-
for (let idx = 0; idx < evalText.length; idx++) {
283-
const line = evalText[idx];
284+
for (const line of builtinText) {
284285
if (!isMatchLine) {
285-
if (/\*abs\(\)\*/.test(line)) {
286+
if (/\*builtin-function-details\*/.test(line)) {
286287
isMatchLine = true;
287-
idx -= 1;
288288
}
289289
continue;
290290
} else {
@@ -297,7 +297,7 @@ class Server {
297297
if (!this.vimBuiltFunctionDocuments[label]) {
298298
this.vimBuiltFunctionDocuments[label] = [];
299299
}
300-
} else if (/^[ \t]*\*string-match\*[ \t]*$/.test(line)) {
300+
} else if (/^[ \t]*\*feature-list\*[ \t]*$/.test(line)) {
301301
if (label) {
302302
this.vimBuiltFunctionDocuments[label].pop();
303303
}

0 commit comments

Comments
 (0)