mirror of
https://github.com/morluto/rea.git
synced 2026-10-29 19:05:45 +00:00
fix(clients): preserve large TOML documents without argument spreads
Fixes #4856
This commit is contained in:
1 parent
3460ceac3f
commit
c43bc0bf66
3 files changed
+139
-3
No files matched your search
@@ -967,8 +967,12 @@ const upsertTomlServerSection = (
|
||||
const discardPending = (): void => {
|
||||
pending.length = 0;
|
||||
};
|
||||
// Document line counts must not become engine-limited argument counts.
|
||||
const appendLines = (lines: readonly string[]): void => {
|
||||
for (const line of lines) kept.push(line);
|
||||
};
|
||||
const flushPending = (): void => {
|
||||
kept.push(...pending);
|
||||
appendLines(pending);
|
||||
pending.length = 0;
|
||||
};
|
||||
const lineIndexAt = (offset: number): number => {
|
||||
@@ -1039,7 +1043,7 @@ const upsertTomlServerSection = (
|
||||
: undefined;
|
||||
if (disabledLines !== undefined) {
|
||||
flushPending();
|
||||
kept.push(...disabledLines);
|
||||
appendLines(disabledLines);
|
||||
lineIndex = endLine + 1;
|
||||
mode = "none";
|
||||
continue;
|
||||
@@ -1064,7 +1068,7 @@ const upsertTomlServerSection = (
|
||||
edited === undefined
|
||||
? text.slice(lineStart, statementEnd)
|
||||
: `${prefix}${edited}${suffix}`;
|
||||
kept.push(...replacement.split("\n"));
|
||||
appendLines(replacement.split("\n"));
|
||||
inlineServerTable = true;
|
||||
} else discardPending();
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user