17. Commenter
评论者允许用户通过相应的操作自动注释光标处的代码或选定的代码.
17.1.
定义评论者
package com.simpleplugin;
import com.intellij.lang.Commenter;
import org.jetbrains.annotations.Nullable;
public class SimpleCommenter implements Commenter {
@Nullable
@Override
public String getLineCommentPrefix() {
return "#";
}
@Nullable
@Override
public String getBlockCommentPrefix() {
return "";
}
@Nullable
@Override
public String getBlockCommentSuffix() {
return null;
}
@Nullable
@Override
public String getCommentedBlockCommentPrefix() {
return null;
}
@Nullable
@Override
public String getCommentedBlockCommentSuffix() {
return null;
}
}
17.2.
注册评论者
<lang.commenter language="Simple" implementationClass="com.simpleplugin.SimpleCommenter"/>
17.3.
运行该项目
![注释器(IMG/commenter.png)
Last modified: 11 May 2019