From 04378d02382ac599c4a0bc6501579ddd0a9639dc Mon Sep 17 00:00:00 2001 From: Max Medvedev Date: Mon, 13 Oct 2025 13:05:05 +0200 Subject: [PATCH] [completion] IJPL-207762 make some lookup decorators transparent in sense of insert handling GitOrigin-RevId: b8bdf202d533fb88a083fbac731acb4e8438ce0e --- .../completion/PrioritizedLookupElement.java | 4 ++-- .../completion/TransparentForInsertHandling.kt | 13 +++++++++++++ .../codeInsight/lookup/LookupElementDecorator.java | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) create mode 100644 platform/analysis-api/src/com/intellij/codeInsight/completion/TransparentForInsertHandling.kt diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/PrioritizedLookupElement.java b/platform/analysis-api/src/com/intellij/codeInsight/completion/PrioritizedLookupElement.java index c7b0244e9344..147e9be891e0 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/completion/PrioritizedLookupElement.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/PrioritizedLookupElement.java @@ -1,4 +1,4 @@ -// Copyright 2000-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// 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; @@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull; * * @see CompletionContributor */ -public final class PrioritizedLookupElement extends LookupElementDecorator { +public final class PrioritizedLookupElement extends LookupElementDecorator implements TransparentForInsertHandling { @SuppressWarnings({"unchecked", "rawtypes"}) public static final ClassConditionKey> CLASS_CONDITION_KEY = (ClassConditionKey)ClassConditionKey.create(PrioritizedLookupElement.class); diff --git a/platform/analysis-api/src/com/intellij/codeInsight/completion/TransparentForInsertHandling.kt b/platform/analysis-api/src/com/intellij/codeInsight/completion/TransparentForInsertHandling.kt new file mode 100644 index 000000000000..616efbb823ff --- /dev/null +++ b/platform/analysis-api/src/com/intellij/codeInsight/completion/TransparentForInsertHandling.kt @@ -0,0 +1,13 @@ +// 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 + +import org.jetbrains.annotations.ApiStatus + +/** + * Mark a [com.intellij.codeInsight.lookup.LookupElementDecorator] as transparent for insert handling. + * In this case, remote-development machinery will be able to properly pick up the insert handler of the decorated element. + * Otherwise, + */ +//TODO IJPL-207762 mark experimental +@ApiStatus.Internal +interface TransparentForInsertHandling \ No newline at end of file diff --git a/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java b/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java index a0ad22812424..c281ccfafd3a 100644 --- a/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java +++ b/platform/analysis-api/src/com/intellij/codeInsight/lookup/LookupElementDecorator.java @@ -3,6 +3,7 @@ package com.intellij.codeInsight.lookup; import com.intellij.codeInsight.completion.InsertHandler; import com.intellij.codeInsight.completion.InsertionContext; +import com.intellij.codeInsight.completion.TransparentForInsertHandling; import com.intellij.openapi.util.ClassConditionKey; import com.intellij.psi.PsiElement; import org.jetbrains.annotations.ApiStatus; @@ -243,7 +244,8 @@ public abstract class LookupElementDecorator extends Lo } } - private static final class VisagisteDecorator extends LookupElementDecorator { + private static final class VisagisteDecorator extends LookupElementDecorator implements + TransparentForInsertHandling { private final LookupElementRenderer> myVisagiste; VisagisteDecorator(T element, LookupElementRenderer> visagiste) {