Jonik
Jonik

Reputation: 81751

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:

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?

Upvotes: 17

Views: 5562

Answers (2)

Tomer Shetah
Tomer Shetah

Reputation: 8529

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

Upvotes: 2

brinox
brinox

Reputation: 96

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.

Upvotes: 7

Related Questions