also keep scroll state stable when additional edits come in late, https://github.com/microsoft/vscode/issues/94173

This commit is contained in:
Johannes Rieken 2020-05-13 12:11:37 +02:00
parent 6298d2f0d0
commit c4f02d6a64

View file

@ -327,10 +327,12 @@ export class SuggestController implements IEditorContribution {
if (didType) {
this.editor.pushUndoStop();
}
const scrollState = StableEditorScrollState.capture(this.editor);
this.editor.executeEdits(
'suggestController.additionalTextEdits.async',
item.completion.additionalTextEdits.map(edit => EditOperation.replace(Range.lift(edit.range), edit.text))
);
scrollState.restoreRelativeVerticalPositionOfCursor(this.editor);
if (didType || !(oldFlags & InsertFlags.NoAfterUndoStop)) {
this.editor.pushUndoStop();
}