From c9d56af5c252cc3147f05abf5a12355f33fa09e7 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Mon, 25 Aug 2025 17:24:45 +0200 Subject: [PATCH] inline hostEditor GitOrigin-RevId: 17e83d174304d76891ace83593e60a1055b56d31 --- .../intellij/codeInsight/lookup/impl/LookupImpl.java | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 656ef94dc13f..fc4c221b363f 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -696,10 +696,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, int prefixLength) { String lookupString = LookupUtil.getCaseCorrectedLookupString(item, matcher, itemPattern); - final Editor hostEditor = editor; - hostEditor.getCaretModel().runForEachCaret(__ -> { - EditorModificationUtilEx.deleteSelectedText(hostEditor); - final int caretOffset = hostEditor.getCaretModel().getOffset(); + editor.getCaretModel().runForEachCaret(__ -> { + EditorModificationUtilEx.deleteSelectedText(editor); + int caretOffset = editor.getCaretModel().getOffset(); LookupElementInsertStopper element = item.as(LookupElementInsertStopper.class); if (element == null || !element.shouldStopLookupInsertion()) { int offset; @@ -713,9 +712,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, LOG.error("When completing " + item + " (" + classes + ")", ae); return; } - hostEditor.getCaretModel().moveToOffset(offset); + editor.getCaretModel().moveToOffset(offset); } - hostEditor.getSelectionModel().removeSelection(); + editor.getSelectionModel().removeSelection(); }); editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);