简体   繁体   中英

Is it possible to hyperlink comments in IntelliJ Idea?

I am using IntelliJ Idea for Android devleopment. Is there any way in which I can hyperlink two comments in the IDE. For example

File a.java

import a;

/**
* This class does something and something
* and does implements interface b, 
* (i want a hyperlink here, if pressed opens file b.java in IDE and cursor is at comments        
*  before method n)
*/

public class a {
  //do something
}

File b.java

import k;

public interface b {

   public j;
   public m;
   /**
    * This will be used when this and this will happen.
   */  
   public n;
}

You can use Javadocs' @see tag - examples here .

It should be sufficient to do something like that:

/**
* Bla bla bla
* @see b#n
*/
public class a

Current IntelliJ versions support the @link notation, just like Eclipse.

To link to another class/method, just use this pattern:

/**
 * {@link Class#method}
 */
public void myMethod() {
}

you can also spare the method, or add a list of argument types to the method (in parenthesis), useful if a method is implemented with different parameters and you want to link to a specific one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM