IntelliJ
Method Parameter Hints
Software Troubleshooting
IDE Settings
Coding Tips

IntelliJ shows method parameter hints on usage - How to disable it

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

IntelliJ IDEA by JetBrains is a powerful Integrated Development Environment (IDE) used for programming in various languages, including Java, Kotlin, and Scala. One of the helpful features in IntelliJ IDEA is the display of method parameter hints. These hints provide immediate context about the parameters required by a method without looking at the method declaration. However, some developers may find this feature cluttering, especially when working with methods that have self-explanatory parameter names or when the screen space is limited.

Understanding Method Parameter Hints

Method parameter hints are inline annotations that appear next to method arguments, displaying parameter names corresponding to the values being passed. This feature is particularly useful when dealing with methods that have multiple parameters, especially if the parameters are of the same type or have similar names. Here's a practical example:

java
1public class Example {
2    public void addPerson(String firstName, String lastName, int age) {
3        // method body
4    }
5
6    public static void main(String[] args) {
7        Example example = new Example();
8        example.addPerson("John", "Doe", 31);
9    }
10}
11

In the main method above, IntelliJ might display the hints like firstName: "John", lastName: "Doe", age: 31 next to the addPerson method call. These hints ensure that it's clear which argument corresponds to which parameter.

Disabling Method Parameter Hints

Although useful, parameter hints can make the code feel verbose, especially for seasoned developers who know their codebase well. Here’s how to disable this feature in IntelliJ IDEA:

  1. Accessing the Settings: Open IntelliJ IDEA and navigate to File > Settings on Windows and Linux, or IntelliJ IDEA > Preferences on macOS.
  2. Locating Editor Preferences: Within the Settings or Preferences window, go to Editor > Inlay Hints.
  3. Adjusting Inlay Settings for Language: Select the language for which you'd like to adjust the inlay hints settings, such as Java.
  4. Disabling Parameter Hints: Uncheck the box corresponding to Parameter hints. This will disable the method parameter hints across all your projects in IntelliJ.
  5. Apply and Close: Click on the Apply button to save your changes and then OK to close the settings window.

Considerations and Best Practices

While disabling parameter hints might clear up some visual clutter, there are situations where these hints can dramatically improve the readability and maintainability of the code. For instance, with overloaded methods or constructors, parameter hints prevent confusion and reduce bugs.

It’s also possible to selectively enable parameter hints only for specific methods or classes rather than globally turning off the feature. This selective enablement can be configured in the same Inlay Hints menu under the settings for specific file types or methods.

Summary Table

FeatureDescriptionHow to Access/Modify
Method Parameter HintsShows names of parameters in method callsEnabled by default; configurable per language
Disable GloballyTurn off parameter hints across all projectsEditor > Inlay Hints > [Language] > Uncheck Parameter hints
Selective DisablingDisable hints for specific methodsUse inline option or configure in settings

Additional Tips

Remember that these settings can be exported and imported which is beneficial if you work across multiple systems or share your IDE settings with a team. Furthermore, for collaborative projects, consistency in IDE configurations can help in maintaining a uniform code style among all developers.

IntelliJ IDEA’s flexibility in customization ensures that whether you prefer a minimalist code interface or a fully annotated script, adjusting the settings to suit your workflow is straightforward. By taking the time to customize your development environment, you increase both productivity and code quality.


Related reading
Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.