Skip to content

Commit b300def

Browse files
authored
Merge pull request #247 from vim-denops/fix-gen
Bump version to Vim 9.1.0448 and Nvim 0.10.0
2 parents b001c06 + 4b1f9d4 commit b300def

File tree

15 files changed

+1960
-1698
lines changed

15 files changed

+1960
-1698
lines changed

.scripts/gen-function/gen-function.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { DOCS_OVERRIDES } from "./override.ts";
55
import { transform } from "./transform.ts";
66
import { downloadString } from "../utils.ts";
77

8-
const VIM_VERSION = "9.1.0399";
9-
const NVIM_VERSION = "0.9.5";
8+
const VIM_VERSION = "9.1.0448";
9+
const NVIM_VERSION = "0.10.0";
1010

1111
const commonGenerateModule = "../../function/_generated.ts";
1212
const vimGenerateModule = "../../function/vim/_generated.ts";

.scripts/gen-function/parse.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ export function parse(content: string): Definition[] {
5858
} else {
5959
const line = content.substring(0, start + 1).split("\n").length;
6060
console.error(
61-
`Failed to parse function definition for ${fn} at line ${line}`,
61+
`Failed to parse function definition for '${fn}' at line ${line}:`,
6262
);
63+
console.error("----- block start -----");
64+
console.error(block);
65+
console.error("----- block end -----");
6366
}
6467
}
6568
return definitions;

.scripts/gen-option/gen-option.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { DOCS_OVERRIDES } from "./override.ts";
55
import { transform } from "./transform.ts";
66
import { downloadString } from "../utils.ts";
77

8-
const VIM_VERSION = "9.1.0399";
9-
const NVIM_VERSION = "0.9.5";
8+
const VIM_VERSION = "9.1.0448";
9+
const NVIM_VERSION = "0.10.0";
1010

1111
const commonGenerateModule = "../../option/_generated.ts";
1212
const vimGenerateModule = "../../option/vim/_generated.ts";
@@ -36,7 +36,7 @@ for (const vimHelpDownloadUrl of vimHelpDownloadUrls) {
3636
console.log(`Download from ${vimHelpDownloadUrl}`);
3737
}
3838
const vimHelps = await Promise.all(vimHelpDownloadUrls.map(downloadString));
39-
const vimDefs = vimHelps.map(parse).flat();
39+
const vimDefs = parse(vimHelps.join("\n"));
4040
const vimOptionSet = new Set(vimDefs.map((def) => def.name)).difference(
4141
manualOptionSet,
4242
);
@@ -48,7 +48,7 @@ for (const nvimHelpDownloadUrl of nvimHelpDownloadUrls) {
4848
console.log(`Download from ${nvimHelpDownloadUrl}`);
4949
}
5050
const nvimHelps = await Promise.all(nvimHelpDownloadUrls.map(downloadString));
51-
const nvimDefs = nvimHelps.map(parse).flat();
51+
const nvimDefs = parse(nvimHelps.join("\n"));
5252
const nvimOptionSet = new Set(nvimDefs.map((def) => def.name)).difference(
5353
manualOptionSet,
5454
);

.scripts/gen-option/parse.ts

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function parse(content: string) {
2929

3030
const options: Option[] = [];
3131
const succeeds = new Set<number>();
32-
const errors: Array<{ name: string; start: number }> = [];
32+
const errors: Array<{ name: string; start: number; block: string }> = [];
3333
let last = -1;
3434
for (const match of content.matchAll(/\*'(\w+)'\*/g)) {
3535
const name = match[1];
@@ -45,17 +45,20 @@ export function parse(content: string) {
4545
succeeds.add(start);
4646
last = end;
4747
} else {
48-
errors.push({ name, start });
48+
errors.push({ name, start, block });
4949
}
5050
}
5151

5252
if (errors.length) {
53-
for (const { name, start } of errors) {
53+
for (const { name, start, block } of errors) {
5454
if (!succeeds.has(start)) {
5555
const line = content.substring(0, start + 1).split("\n").length;
5656
console.error(
57-
`Failed to parse option definition for ${name} at line ${line}`,
57+
`Failed to parse option definition for '${name}' at line ${line}:`,
5858
);
59+
console.error("----- block start -----");
60+
console.error(block);
61+
console.error("----- block end -----");
5962
}
6063
}
6164
}
@@ -107,7 +110,8 @@ function parseBlock(name: string, body: string): Option | undefined {
107110
const reTags = /(?:[ \t]+\*[^*\s]+\*)+[ \t]*$/.source;
108111
const reShortNames = /(?:[ \t]+'\w+')*/.source;
109112
const reType = /[ \t]+(?<type>\w+)/.source;
110-
const reDefaults = /[ \t]+(?<defaults>\(.*?(?:\n\t{3,}[ \t].*?)*?\))/.source;
113+
const reDefaults =
114+
/[ \t]+(?<defaults>\(.*?(?:\n(?:\t{3,}| {24,})[ \t].*?)*?\))/.source;
111115
const reDefinition =
112116
`^'${name}'${reShortNames}(?:${reType}(?:${reDefaults})?)?(?:${reTags})?$`;
113117
const m1 = body.match(new RegExp(reDefinition, "dm"));

.scripts/markdown.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ export function createMarkdownFromHelp(body: string): string {
1212
const codeBlockIndent = " ";
1313
let lastIndent = firstlineIndent;
1414
body = body.replaceAll(
15-
/(?<normal>.*?)[\n ]>\n(?<code>.*?)(?:\n(?=<)|$)|(?<rest>.*)/gs,
16-
(_, normal: string, code: string, rest: string) => {
15+
/(?<normal>.*?)[\n ]>(?<ft>\w*)\n(?<code>.*?)(?:\n(?=<)|$)|(?<rest>.*)/gs,
16+
(_, normal: string, _ft: string, code: string, rest: string) => {
1717
if (rest !== undefined) {
1818
return formatNormalBlock(rest);
1919
}

.scripts/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import * as streams from "@std/streams";
66
*/
77
export async function downloadString(url: string): Promise<string> {
88
const response = await fetch(url);
9-
if (!response.body) {
9+
if (response.status >= 400 || !response.body) {
1010
throw new Error(`Failed to read ${url}`);
1111
}
1212
//const reader = streams.readerFromStreamReader(response.body.getReader());

0 commit comments

Comments
 (0)