英文:
Why does IntelliJ not show the "System.out.println()" shortcut when I type "sout"?
问题
当我在IntelliJ中键入sout时,它不显示System.out.println()的快捷方式,而是显示WSDLOutput、WSDLOutputImpl、JSWBlend_SRC_Outpeer和LSOutput。
英文:
When i type sout in IntelliJ, it doesn't show the System.out.println() shortcut, and instead shows WSDLOutput, WSDLOutputImpl, JSWBlend_SRC_Outpeer, and LSOutput.
答案1
得分: 3
这个Live Template在Java文件的方法内部工作(而不是在类的根部,在那里除了静态初始化块之外不能有可执行代码)。
因此,请确保您在方法内部,并且还要检查Java类是否在源根目录内。
要尝试的示例类:
public class Main {
    public static void main(String[] args) {
        sout <- 在此处按Tab键
    }
}
您可以使用<kbd>Tab</kbd>键进行展开。
英文:
This live template works in Java files inside a method (not in the root of the class where there can be no executable code except the static initializer blocks).
So, make sure you are inside a method and also check Java class in inside the sources root.
Sample class to try:
public class Main {
    public static void main(String[] args) {
        sout <- press Tab here
    }
}
You can expand it using the <kbd>Tab</kbd> key.
答案2
得分: 0
前往 Preferences -> Live Templates -> Java。检查是否有 sout 代码模板。如果没有,请在 user 部分下添加一个新的代码模板,缩写为 sout,文本为 System.out.println()。
英文:
Go to Preferences -> Live Templates -> Java. Check that you have the sout live template. If you don't, add a new live template under the user section with the abbreviation sout and the text System.out.println().
专注分享java语言的经验与见解,让所有开发者获益!




评论