From cf2cc5cbf8d79d8b1c9f4346ddcc23e4d180f1d8 Mon Sep 17 00:00:00 2001 From: "Vitaliy.Bibaev" Date: Sat, 20 Aug 2022 08:12:03 +0200 Subject: [PATCH] [ml-ranking] Introduce MLRankingIgnorable.wrap(LookupElement) API GitOrigin-RevId: 31973b971594375acefcd76d6a5534bc9a6d4286 --- .../completion/ml/MLRankingIgnorable.java | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/platform/lang-api/src/com/intellij/codeInsight/completion/ml/MLRankingIgnorable.java b/platform/lang-api/src/com/intellij/codeInsight/completion/ml/MLRankingIgnorable.java index fa5dd9cfa7f6..d391cc0c54ce 100644 --- a/platform/lang-api/src/com/intellij/codeInsight/completion/ml/MLRankingIgnorable.java +++ b/platform/lang-api/src/com/intellij/codeInsight/completion/ml/MLRankingIgnorable.java @@ -1,12 +1,25 @@ // Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license. package com.intellij.codeInsight.completion.ml; +import com.intellij.codeInsight.lookup.LookupElement; +import com.intellij.codeInsight.lookup.LookupElementDecorator; import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; /** - * A marker interface for the {@link com.intellij.codeInsight.lookup.LookupElement} inheritors to ignore this element + * A marker interface for the {@link LookupElement} inheritors to ignore this element * in sorting by Machine Learning-assisted completion. */ @ApiStatus.Experimental public interface MLRankingIgnorable { + static LookupElement wrap(LookupElement element) { + class MLIgnorableLookupElement extends LookupElementDecorator implements MLRankingIgnorable { + + private MLIgnorableLookupElement(@NotNull LookupElement delegate) { + super(delegate); + } + } + + return new MLIgnorableLookupElement(element); + } }