[completion] IJPL-207762 make some lookup decorators transparent in sense of insert handling

GitOrigin-RevId: b8bdf202d533fb88a083fbac731acb4e8438ce0e
This commit is contained in:
Max Medvedev
2025-10-14 00:05:43 +00:00
committed by intellij-monorepo-bot
parent 885b621e79
commit 04378d0238
3 changed files with 18 additions and 3 deletions
@@ -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<T extends LookupElement> extends LookupElementDecorator<T> {
public final class PrioritizedLookupElement<T extends LookupElement> extends LookupElementDecorator<T> implements TransparentForInsertHandling {
@SuppressWarnings({"unchecked", "rawtypes"})
public static final ClassConditionKey<PrioritizedLookupElement<?>> CLASS_CONDITION_KEY =
(ClassConditionKey)ClassConditionKey.create(PrioritizedLookupElement.class);
@@ -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
@@ -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<T extends LookupElement> extends Lo
}
}
private static final class VisagisteDecorator<T extends LookupElement> extends LookupElementDecorator<T> {
private static final class VisagisteDecorator<T extends LookupElement> extends LookupElementDecorator<T> implements
TransparentForInsertHandling {
private final LookupElementRenderer<? super LookupElementDecorator<T>> myVisagiste;
VisagisteDecorator(T element, LookupElementRenderer<? super LookupElementDecorator<T>> visagiste) {