Home > other >  What does "x:" and "a:" mean in Java in Visual Studio Code?
What does "x:" and "a:" mean in Java in Visual Studio Code?

Time:04-21

I am using Visual Studio Code to practice some Java, and although there is nothing wrong when running the code, I am not sure why I keep getting the "x:" and "a:" in certain parts of the code.

For example:

public class Hello {
    
    public static void main (String[] args) {
    
            System.out.println(x:"Welcome to CS!!!");
            System.out.println(x:"Let's have some fun.");
    
            
            int yes = simple_int(a: 39);
            System.out.println(yes);
            
        }
    
        public static int simple_int (int a) {
            int b;
            b = 300;
            return a   b;
    }
    
}`

As you can see, inside the println, there is the x:, and inside the simple_int, there is the a:. I am not sure what those mean.

Attached is a screenshot

CodePudding user response:

These are not actually editable code. They are hints that VS Code gives for the parameter names in the function call.

Related questions on Stack Overflow:

How do I remove inline parameter hints in VSCode?.

Intellij like inline parameter hints in vs code

CodePudding user response:

This is the new feature of JAVA extension(link):

It's a new feature introduced in 1.5.0, called inlay hint. We use that to display the parameter names of those arguments.

If you do not want to have them in your editor, you can set the setting java.inlayHints.parameterNames.enabled to none

Code-Apprentice's method works well, but it will disable all the inlayHints through "editor.inlayHints.enabled": false, no matter which extension provided it.

  • Related