简体   繁体   English

Netbeans Code对代码模板的帮助

[英]Netbeans Code assistance on code templates

I have a long list of Code Templates in NetBeans and I want to sort them somehow because I don't remember all of them. 我在NetBeans中有很长的代码模板列表,我想以某种方式对它们进行排序,因为我不记得所有这些。 The abbreviation for my code templates is: user_template, something like this: 我的代码模板的缩写是:user_template,如下所示:

 alpha_sop  wich does:
 System.out.println(${cursor});

Also another one: 还有一个:

 alpha_psvm
 public static void main(String[] args) {
 ${cursor}
 }

And many many more... Is there a way that after I write alpha_ and press ctrl+space a list of all available templates that contain alpha_ dropdown in a list? 还有更多...有没有办法在我写alpha_并按ctrl + space后列出包含列表中alpha_ dropdown的所有可用模板? Id kinda like to select from my own list... 我有点喜欢从我自己的列表中选择...

Something like: 就像是:

alpha_ ctrl+space
*Dropdown*
alpha_psvm (with description of code)
alpha_sop (with description of code)

I'm currently using NetBeans 7.4 and it seems that CTRL + SPACE 我目前正在使用NetBeans 7.4,它似乎是CTRL + SPACE

Does in fact give me a list of suggestions for Code Templates. 实际上是否为我提供了代码模板的建议列表。

I am not sure if CUSTOM templates get registered in the Code Assistance and seems there's been some bug reports already made. 我不确定CUSTOM模板是否在代码帮助中注册,似乎已经有一些错误报告

代码模板的代码帮助

Code Assistance in the NetBeans IDE Java Editor: A Reference Guide NetBeans IDE Java编辑器中的代码帮助:参考指南

This is the sollution for the templates to expand on code assistant (sorry but names are in spanish :P hope you get the idea) 这是模板扩展代码助手的解决方案(对不起,但名字是西班牙语:P希望你明白了)

It is impostant to chose CONTEXT where to apply those templates when pressing ctrl+space ... 在按下ctrl + space时选择CONTEXT在哪里应用这些模板是徒劳的... 在此输入图像描述

And after adding a context you can properly expand: 添加上下文后,您可以正确扩展:

小教程

It is important that the templates are structured properly with abbreviation and description... 使用缩写和描述正确构建模板非常重要......

This functionality (autocompletion with code templates) does not exist in Netbeans. Netbeans中不存在此功能(使用代码模板自动完成)。 However, you can customize the IDE to achieve this functionality. 但是,您可以自定义IDE以实现此功能。 See autocompleteNB on GitHub. 请参阅GitHub上的autocompleteNB

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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