3

[Initial post] : I am new to Java, and decided to use Eclipse IDE for a start.

By looking a tutorial on youtube, I found that the tutorial IDE showed the parameters' name directly in the editor as in the picture below. I have however no idea what the IDE used is (just that it is not Eclipse).

I was wondering if it was possible to achieve the same result in Eclipse. I tried to tune parameters in Windows>Preferences with no results.

( Array was a class created during the tutorial and .insert is a method of this class )

Results Expected - parameter in method

For relative same topics there is this question, it is more about the helping pop-up : Is it possible to show the annotations of method parameters in Eclipse?

[edit] : I think I found what parameter is allowing this : Windows>Preferences>Java>Editor>Code Minings> EnableCodeMinings>uncheck Only if there is at least one result.

It do works for one of my custom type class:

public class noeud_custom {
    private double x; 
    private double y ; 
    public noeud_custom() {
        this.x = 0; 
        this.y = 0; 
        }
    public noeud_custom(double x, double y) {
        this.x = x; 
        this.y = y; 
    }; 
    public void print() {
        System.out.println("x:" + x); 
        System.out.println("y:" + y); 
    }
    public void set(double x, double y) {
        this.x = x; 
        this.y = y; 
    }
    public double get_x() {
    return this.x; 
    }
    public double get_y() {
    return this.y; 
    }
    public noeud_custom equal(noeud_custom noeud) {     
    return noeud;       
}
// ----------Result (in editor) : --------------
public class main {
    public static void main(String[] args) {
        noeud_custom testnode= new noeud_custom(5,2); 
        testnode.set(x: 5,y: 10);  // OK, it works there !

   // for my other custom class: 
     LinkedList list = new LinkedList(); 
     list.addLast(10);  // NOK, it doesnt works there... ( ps : the code is running well)
    }
}

However my other classes does not achieve the same behavior, is there another parameter to tune ?

Chewbaka
  • 184
  • 10
  • It certainly seems your lead towards _Preferences>Java>Editor>Code Minings_ is a sound one. When I checked "_Show method parameter names_" I can indeed see parameter names in the called method. I'm not certain on how this function may have changed since 2020. This function does seem to warrant something specific, because it works pretty much everywhere in a small project of mine, but not in some quick test files I made. You can also go into the editor settings and enable "_show code minings for problem annotations_". Thanks for sharing! – MiB May 27 '23 at 12:09

0 Answers0