可以在IntelliJ Idea中超链接评论吗?

Gau*_*wal 12 java intellij-idea

我正在使用IntelliJ Idea for Android devleopment.有什么方法可以在IDE中超链接两个注释.例如

提交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
}
Run Code Online (Sandbox Code Playgroud)

文件 b.java

import k;

public interface b {

   public j;
   public m;
   /**
    * This will be used when this and this will happen.
   */  
   public n;
}
Run Code Online (Sandbox Code Playgroud)

Vic*_*Vic 16

你可以在这里使用Javadocs的@see标签 - 例子.

这样做应该足够了:

/**
* Bla bla bla
* @see b#n
*/
public class a
Run Code Online (Sandbox Code Playgroud)

  • @codingcrow,试试吧,你可以按住`CTRL`并点击导航,就像其他链接一样.`CTRL + B`也适用. (6认同)
  • 这只会在我试图找到的 Javadoc 中创建链接,是否可以在 IDE 中连接两个文件。 (3认同)

mad*_*fin 6

当前的IntelliJ版本支持@link表示法,就像Eclipse一样.

要链接到另一个类/方法,只需使用此模式:

/**
 * {@link Class#method}
 */
public void myMethod() {
}
Run Code Online (Sandbox Code Playgroud)

您也可以使用方法,或者在方法中添加参数类型列表(在括号中),如果使用不同的参数实现方法并且您想链接到特定的参数,则非常有用.

  • 这不适用于注释的内联类型(`// comment ...`) (3认同)