Skip to content

Commit 8c8357c

Browse files
committed
☕ improved whitespace parsing
In Neovim 0.10.0, `(default ...)` in `options.txt` is indented with spaces instead of tabs when it contains newlines.
1 parent 83daed1 commit 8c8357c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

.scripts/gen-option/parse.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ function parseBlock(name: string, body: string): Option | undefined {
110110
const reTags = /(?:[ \t]+\*[^*\s]+\*)+[ \t]*$/.source;
111111
const reShortNames = /(?:[ \t]+'\w+')*/.source;
112112
const reType = /[ \t]+(?<type>\w+)/.source;
113-
const reDefaults = /[ \t]+(?<defaults>\(.*?(?:\n\t{3,}[ \t].*?)*?\))/.source;
113+
const reDefaults =
114+
/[ \t]+(?<defaults>\(.*?(?:\n(?:\t{3,}| {24,})[ \t].*?)*?\))/.source;
114115
const reDefinition =
115116
`^'${name}'${reShortNames}(?:${reType}(?:${reDefaults})?)?(?:${reTags})?$`;
116117
const m1 = body.match(new RegExp(reDefinition, "dm"));

0 commit comments

Comments
 (0)