Skip to content

Commit 7763597

Browse files
authored
Merge pull request microsoft#128624 from microsoft/hediet/fix-128302-recovery2
Don't modify ghost text when reading it
2 parents 5cfe44b + 065c301 commit 7763597

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/vs/editor/contrib/inlineCompletions/ghostText.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export class GhostText {
1818
}
1919

2020
export interface GhostTextPart {
21-
readonly lines: string[];
21+
readonly lines: readonly string[];
2222
readonly column: number;
2323
}
2424

src/vs/editor/contrib/inlineCompletions/ghostTextWidget.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,15 @@ export class GhostTextWidget extends Disposable {
8686
const inlineTexts = new Array<InsertedInlineText>();
8787
const additionalLines = new Array<LineData>();
8888

89-
function addToAdditionalLines(lines: string[], className: string | undefined) {
89+
function addToAdditionalLines(lines: readonly string[], className: string | undefined) {
9090
if (additionalLines.length > 0) {
9191
const lastLine = additionalLines[additionalLines.length - 1];
9292
if (className) {
9393
lastLine.decorations.push(new LineDecoration(lastLine.content.length + 1, lastLine.content.length + 1 + lines[0].length, className, InlineDecorationType.Regular));
9494
}
9595
lastLine.content += lines[0];
9696

97-
lines.splice(0, 1);
97+
lines = lines.slice(1);
9898
}
9999
for (const line of lines) {
100100
additionalLines.push({

0 commit comments

Comments
 (0)