From 0cdbe0fd084c02a15ed9cc010d0e200173ea59c8 Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Sun, 12 Oct 2025 15:48:38 +0200 Subject: [PATCH] [java, completion] IJPL-207762 MethodCallInstallerHandler is serializable GitOrigin-RevId: ce77f24156ff15d0ccd09d2336dc7e17235a8b7c --- .../resource/intellij.java.frontback.impl.xml | 1 + .../method/JavaMethodCallInsertHandlerHelper.kt | 2 +- .../method/MethodCallInstallerHandler.kt | 17 +++++++++++++++++ .../completion/JavaMethodCallInsertHandler.kt | 6 ------ 4 files changed, 19 insertions(+), 7 deletions(-) create mode 100644 java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/MethodCallInstallerHandler.kt diff --git a/java/java-frontback-impl/resource/intellij.java.frontback.impl.xml b/java/java-frontback-impl/resource/intellij.java.frontback.impl.xml index d48d2ef96d59..a8f3300e3327 100644 --- a/java/java-frontback-impl/resource/intellij.java.frontback.impl.xml +++ b/java/java-frontback-impl/resource/intellij.java.frontback.impl.xml @@ -81,6 +81,7 @@ + diff --git a/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/JavaMethodCallInsertHandlerHelper.kt b/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/JavaMethodCallInsertHandlerHelper.kt index a93064946f21..5183b9b39e84 100644 --- a/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/JavaMethodCallInsertHandlerHelper.kt +++ b/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/JavaMethodCallInsertHandlerHelper.kt @@ -39,7 +39,7 @@ object JavaMethodCallInsertHandlerHelper { item.putUserData(refStartKey, refStart) } - fun installCall(context: InsertionContext, item: LookupElement) { + internal fun installCall(context: InsertionContext, item: LookupElement) { val methodCall = findCallAtOffset(context, getReferenceStartOffset(context, item)) ?: return // make sure this is the method call we've just added, not the enclosing one diff --git a/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/MethodCallInstallerHandler.kt b/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/MethodCallInstallerHandler.kt new file mode 100644 index 000000000000..03d8a5a6a223 --- /dev/null +++ b/java/java-frontback-impl/src/com/intellij/codeInsight/completion/method/MethodCallInstallerHandler.kt @@ -0,0 +1,17 @@ +// Copyright 2000-2025 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. +package com.intellij.codeInsight.completion.method + +import com.intellij.codeInsight.completion.FrontendFriendlyInsertHandler +import com.intellij.codeInsight.completion.InsertHandler +import com.intellij.codeInsight.completion.InsertionContext +import com.intellij.codeInsight.lookup.LookupElement +import kotlinx.serialization.Serializable +import org.jetbrains.annotations.ApiStatus + +@ApiStatus.Internal +@Serializable +class MethodCallInstallerHandler : InsertHandler, FrontendFriendlyInsertHandler { + override fun handleInsert(context: InsertionContext, item: LookupElement) { + JavaMethodCallInsertHandlerHelper.installCall(context, item) + } +} \ No newline at end of file diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallInsertHandler.kt b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallInsertHandler.kt index 4bf99e3a4704..f2eb1a83a219 100644 --- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallInsertHandler.kt +++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaMethodCallInsertHandler.kt @@ -314,12 +314,6 @@ private class ShowParameterInfoInsertHandler : InsertHandler { - override fun handleInsert(context: InsertionContext, item: LookupElement) { - JavaMethodCallInsertHandlerHelper.installCall(context, item) - } -} - private class MethodCallRegistrationHandler : InsertHandler { override fun handleInsert(context: InsertionContext, item: JavaMethodCallElement) { val method = item.getObject()