diff --git a/java/java-impl/src/com/intellij/codeInsight/hints/JavaInlayParameterHintsProvider.kt b/java/java-impl/src/com/intellij/codeInsight/hints/JavaInlayParameterHintsProvider.kt index 95474f8bc583..4173de7f7283 100644 --- a/java/java-impl/src/com/intellij/codeInsight/hints/JavaInlayParameterHintsProvider.kt +++ b/java/java-impl/src/com/intellij/codeInsight/hints/JavaInlayParameterHintsProvider.kt @@ -53,7 +53,9 @@ class JavaInlayParameterHintsProvider : InlayParameterHintsProvider { return MethodInfo(fullMethodName, paramNames) } - override val defaultBlackList = setOf( + override fun getDefaultBlackList() = defaultBlackList + + private val defaultBlackList = setOf( "(begin*, end*)", "(start*, end*)", "(first*, last*)", diff --git a/platform/lang-api/src/com/intellij/codeInsight/hints/InlayParameterHintsProvider.java b/platform/lang-api/src/com/intellij/codeInsight/hints/InlayParameterHintsProvider.java new file mode 100644 index 000000000000..cadcc5abeacd --- /dev/null +++ b/platform/lang-api/src/com/intellij/codeInsight/hints/InlayParameterHintsProvider.java @@ -0,0 +1,78 @@ +/* + * Copyright 2000-2017 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInsight.hints; + +import com.intellij.lang.Language; +import com.intellij.psi.PsiElement; +import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.ApiStatus; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; +import java.util.Set; + +@ApiStatus.Experimental +public interface InlayParameterHintsProvider { + + /** + * Hints for params to be shown + */ + @NotNull + List getParameterHints(PsiElement element); + + /** + * Provides hint info, for alt-enter action (can be MethodInfo or OptionInfo) + * + * MethodInfo: provides fully qualified method name (e.g. "java.util.Map.put") and list of it's parameter names. + * Used to match method with blacklist, and to add method into blacklist + * + * OptionInfo: provides option to disable/enable by alt-enter + */ + @Nullable + HintInfo getHintInfo(PsiElement element); + + /** + * Default list of patterns for which hints should not be shown + */ + @NotNull + Set getDefaultBlackList(); + + /** + * Returns language which blacklist will be appended to the resulting one + * E.g. to prevent possible Groovy and Kotlin extensions from showing hints for blacklisted java methods. + */ + @Nullable + default Language getBlackListDependencyLanguage() { + return null; + } + + /** + * List of supported options, shown in settings dialog + */ + @NotNull + default List