java 是否可以在 IntelliJ Idea 中超链接评论?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13778645/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is it possible to hyperlink comments in IntelliJ Idea?
提问by Gaurav Agarwal
I am using IntelliJ Idea for Android devleopment. Is there any way in which I can hyperlink two comments in the IDE. For example
我正在使用 IntelliJ Idea for Android devleopment。有什么方法可以让我在 IDE 中超链接两个评论。例如
Filea.java
文件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
}
Fileb.java
文件b.java
import k;
public interface b {
public j;
public m;
/**
* This will be used when this and this will happen.
*/
public n;
}
回答by Vic
回答by madmuffin
Current IntelliJ versions support the @link notation, just like Eclipse.
当前的 IntelliJ 版本支持 @link 表示法,就像 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.
您还可以不使用该方法,或将参数类型列表添加到该方法(在括号中),这在使用不同参数实现的方法并且您想要链接到特定参数时非常有用。