6

When I have code in java that uses streams intellij displays type hints about the result of the stream.

I would like to disable these hints

Example with the following code:

Stream.of (1, 2. 3)
    .map (n -> n + 1)
    .map (n -> n % 2 == 0 ? "even number " + n : "odd number " + n)
    .peek (System.out:println)
    .map (s -> Float.parseFloat (s.substring (s.lastIndexOf (" "))))
    ;

enter image description here

I have turned off other tool tips for parameters, but the hints after the streams are still present. They are visually very distracting while providing me with little extra information.

I would also be happy if I knew how to change the color or style of the hints (I have Material Theme UI installed)

MiniMe
  • 181
  • 2
  • 8
  • The attached picture beginning `Stream.of (1, 2, 3)` doesnt seem to match the code above beginning with `uris.stream()` ... – vikingsteve Aug 02 '19 at 07:57
  • 1
    Possible duplicate of https://stackoverflow.com/questions/40866202/intellij-shows-method-parameter-hints-on-usage-how-to-disable-it – Anurag Sharma Aug 02 '19 at 08:01
  • @AnuragSharma It is not a duplicate of that post, I have disabled those hints a long time ago, but the stream hints are still displayed. ps: I did see that post before I asked the question – MiniMe Aug 02 '19 at 08:37
  • @vikingsteve Yes sorry, i copied the wrong code block from intellij, I changed it. – MiniMe Aug 02 '19 at 08:40

2 Answers2

5

IntelliJ 2019.2 CE

  1. Navigate to: Preferences -> Editor -> Inlay Hints -> Java. Alternatively, press CMD (⌘)/Ctrl + Shift + A, search for Inlay Hints, open the first result, and select Java.
  2. Untick Method Chains tickbox

enter image description here

Alternatively, you can increase the count of unique types in streams/method chains from which the type hints will be shown. I.e., if your stream transforms from type A to type B, and then to type C, this would be 3 types. If you set it to 2, hints would be shown for 3 unique types and more.

cegas
  • 2,823
  • 3
  • 16
  • 16
  • I don't have the options that you have, perhaps a version difference (intellij idea community 2018.3 here). But seening that it is called 'inline hints' did search through the settings for that. And I did find a way to change the styling sort of solves my problem. I would accept your answer if i could verify that it works. – MiniMe Aug 02 '19 at 08:47
  • I upgraded to the latest version and see those options now, they do work, so I accepted your answer. Thanks for the help – MiniMe Aug 02 '19 at 08:55
  • You can also right click on a method chain hint in your code file and there is an option there – vikingsteve Aug 02 '19 at 09:17
  • Good point! Didn't notice it. Definitely the quicker way than navigating through settings if one just wants to get rid of hints. Upvoted. – cegas Aug 02 '19 at 09:39
  • @vikingsteve I did try that, but I had the older version, maybe now I would see it – MiniMe Aug 02 '19 at 10:02
1

An easier way!

Just right click on where it says (in your example) Stream<Integer> and untick the option Show method chain hints

enter image description here

Alternatively, hit CTRL+ALT+A and type "show me" - you can see the setting for "Show method chain hints"

enter image description here

vikingsteve
  • 38,481
  • 23
  • 112
  • 156