Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

In Scaladoc, how to link to a method in the same class?

What is the correct way to create link to a method in the same class? Scaladoc documentation doesn't have examples of this.

Consider a class such as:

package controllers

// import ...

class AccountController extends Controller with Secured {

  def current = Authenticated() { request =>
    // ...
  }

  /**
   * See [[current]] for an endpoint that...
   */
  def findAll = Authenticated() { request =>
     // ... 
  }

}

In IntelliJ IDEA's "quick documentation" pop up, all these show up as red:

  • [[current]]
  • [[#current]]
  • [[AccountController.current]]
  • [[AccountController#current]]
  • [[controllers.AccountController.current]]

enter image description here

This does show up as blue:

[[controllers.AccountController#current]]

So I suppose this is correct, but is there there no simpler yet correct way?

like image 439
Jonik Avatar asked Dec 28 '15 10:12

Jonik


2 Answers

The correct way for your example would be:

[[controllers.AccountController#current()]]

The empty parenthesis are necessary here for functions without parameters, despite you shouldn't add these in the code. You also have to use fully-qualified names everywhere, this means it should contain the package, class name, a hashtag and the method name.

like image 50
brinox Avatar answered Nov 08 '22 02:11

brinox


I am not sure when was it fixed, but I am using IntelliJ IDEA version 2020.3, and it works for me:

/**
 * See [[current]] for an endpoint that...
 */

enter image description here

like image 37
Tomer Shetah Avatar answered Nov 08 '22 02:11

Tomer Shetah