IJPL-49827 [java]: Inlay hints settings: update descriptions and code samples

GitOrigin-RevId: 44d5acbba371d7bcb14a5c8b721ee6acae140189
This commit is contained in:
Bas Leijdekkers
2025-12-26 15:24:38 +00:00
committed by intellij-monorepo-bot
parent 4f096fedef
commit 2fd7ae61ef
8 changed files with 44 additions and 58 deletions
@@ -1,9 +1,12 @@
class ImplicitType {
void test() {
var x/*<# : ImplicitType #>*/ = someMethod();
import java.util.*;
class HintsDemo {
public static void main(String[] args) {
var list/*<# : List<String> #>*/ = getList();
}
ImplicitType someMethod() {
return null;
private static List<String> getList() {
return Arrays.asList("hello", "world");
}
}
@@ -1,9 +1,28 @@
import java.util.stream.*;
class Foo {
{
Stream.of(1, 2, 3).filter(x -> x % 2 == 0)/*<# Stream<Integer> #>*/
.map(x -> x * 2)/*<# Stream<Integer> #>*/
.map(x -> "item: " + x)/*<# Stream<String> #>*/
.forEach(System.out::println);
class Test {
static AccountManager accountManager = new AccountManager();
public static void main(String[] args) {
String id = accountManager
.getAccounts()/*<# List<Account> #>*/
.get(0)/*<# Account #>*/
.getId()/*<# UUID> #>*/
.toString();
}
}
class AccountManager {
List<Account> accounts = new ArrayList<>();
public List<Account> getAccounts() {
return accounts;
}
}
class Account {
private UUID id;
public UUID getId() {
return id;
}
}
@@ -1,8 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.java.codeInsight.daemon.inlays
import com.intellij.codeInsight.hints.JavaImplicitTypeDeclarativeInlayHintsProvider
import com.intellij.lang.java.JavaLanguage
import com.intellij.testFramework.LightProjectDescriptor
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
import com.intellij.testFramework.utils.inlays.declarative.DeclarativeInlayHintsProviderTestCase
@@ -78,21 +77,6 @@ class Demo {
testAnnotations(text)
}
fun testPreview() {
doTestPreview("""
class ImplicitType {
void test() {
var x/*<# : |[ImplicitType:java.fqn.class]ImplicitType #>*//*<# : ImplicitType #>*/ = someMethod();
}
ImplicitType someMethod() {
return null;
}
}
""".trimIndent(), JavaImplicitTypeDeclarativeInlayHintsProvider.PROVIDER_ID, JavaImplicitTypeDeclarativeInlayHintsProvider(), JavaLanguage.INSTANCE)
}
private fun testAnnotations(@Language("Java") text: String) {
doTestProvider("A.java", text, JavaImplicitTypeDeclarativeInlayHintsProvider())
}
@@ -1,8 +1,7 @@
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
// 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.java.codeInsight.daemon.inlays
import com.intellij.codeInsight.hints.JavaMethodChainsDeclarativeInlayProvider
import com.intellij.lang.java.JavaLanguage
import com.intellij.testFramework.utils.inlays.declarative.DeclarativeInlayHintsProviderTestCase
import org.intellij.lang.annotations.Language
@@ -207,21 +206,6 @@ public class Chains {
""")
}
fun testPreview() {
doTestPreview("""
import java.util.stream.*;
class Foo {
{
Stream.of(1, 2, 3).filter(x -> x % 2 == 0)/*<# Stream<Integer> #>*/
.map(x -> x * 2)/*<# Stream<Integer> #>*/
.map(x -> "item: " + x)/*<# Stream<String> #>*/
.forEach(System.out::println);
}
}
""".trimIndent(), JavaMethodChainsDeclarativeInlayProvider.PROVIDER_ID, JavaMethodChainsDeclarativeInlayProvider(),
JavaLanguage.INSTANCE)
}
fun test() {
check("""
abstract class Foo<T> {
@@ -1263,7 +1263,7 @@ inlay.parameters.java.enums=Enum constant declarations that use a parametrized c
# suppress inspection "UnusedProperty"
inlay.parameters.java.new.expr=Calls to parametrized constructors.
# suppress inspection "UnusedProperty"
inlay.parameters.java.clear.expression.type=Method calls that use a complex expression as an argument, for example, the ternary operator or a Java 13 switch statement.
inlay.parameters.java.clear.expression.type=Method calls that use a complex expression as an argument, for example, a conditional expression or Java 13 switch expression.
inlay.MethodChainsInlayProvider.description=Method return types in call chains.
inlay.annotation.hints.inferred.annotations=Annotations that IntelliJ IDEA generates by scanning libraries and project code. These annotations help you understand code contracts and improve the capabilities of static analysis. They include: <br> @Contract <br> @Nullable <br> @NotNull <br> @Unmodifiable <br>@UnmodifiableView <br><br><a href='https://www.jetbrains.com/help/idea/inferring-nullity.html#inferred-annotations'>Documentation</a>
inlay.annotation.hints.external.annotations=Annotations that are stored outside your source code.<br>These annotations are useful when you need an annotation, but adding it to the source code is not an option (for example, when working with a library code).<br><br><a href='https://www.jetbrains.com/help/idea/external-annotations.html'>Documentation</a>
@@ -1,5 +1,3 @@
class Thing {
void changedMethod(String s) {
}
class Button {
void actionPerformed() {}
}
@@ -1,5 +1,3 @@
class Thing {
void doThing() {
}
class Button {
void actionPerformed() {}
}
@@ -18,13 +18,13 @@ CodeLensGlobalSettingsProvider.visibleMetricsAbove.description=Visible metrics a
CodeLensGlobalSettingsProvider.visibleMetricsNext.description=Visible metrics next to declaration:
codeLens.references.name=Usages
codeLens.references.description=The number of usages of the class or method in the project. Click the hint to navigate to usages.
codeLens.references.description=The number of usages of the class or method in the project. Click the hint to navigate to the usages.
codeLens.inheritors.name=Inheritors
codeLens.inheritors.description=The number of descendants the class or interface has. Click the hint to navigate to the code that inherits from this class or interface.
codeLens.problems.name=Related problems
codeLens.problems.description=The number of problems in the project related to the class or member signature. For example: missing parameters, wrong return type, and so on.<br><br>The hint does not appear for the problems within the same file.
codeLens.problems.description=The number of problems in the project related to the class or member signature. For example: missing parameters, wrong return type, and so on.<br><br>The hint does not appear for problems within the same file.
codeLens.vcs.code.vision.name=Code author
codeLens.vcs.code.vision.description=Code author(s) for a given element (e.g. class or method).
codeLens.vcs.code.vision.description=The author of the code according to the records in the VCS.<br><br>The author is whoever last edited the class, method, or function. If there are multiple commits from different authors, the one who owns the most lines is considered the author.
codeLens.rename.name=Rename
codeLens.rename.description=Shown after renaming a symbol. Click the hint to rename usages of the symbol in the project.
codeLens.change.signature.name=Change signature