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]]
This does show up as blue:
[[controllers.AccountController#current]]
So I suppose this is correct, but is there there no simpler yet correct way?
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.
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...
*/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With