generic code snippets / templates in eclipse

会有一股神秘感。 提交于 2020-01-02 07:04:57

问题


I'm currently evaluating eclipse after using textmate for all my development for many years. what i miss in eclipse and what I can't find any solution for are some kind of generic templates:

I'm using PDT for my JavaScript and PHP development, and it supports code-templates. however , in my projects I'm writing large amounts of shell-scripts, yml-configuration-files, xml-files, gnu make scripts, etc., too. I'm writing source-documentation for all these scripts using a generic syntax (similar to robodoc) and you can save much time, when you can insert the doc-blocks using templates. however, besides PDT not all of the editor-plugins support templates.

Is there some generic way of storing code-snippets/templates in eclipse, which will work across all editor-plugins? I think it should be possible to implement such using eclipse monkey -- however, it seems development of monkey was stopped?

I'm using Eclipse 3.4.0.


回答1:


If you have the web tools (WTP) plugins installed you should have a Snippets view which is an editor-independent place for collecting reusable code snippets. You can create and place your snippets in there and can separate them using 'drawers'. Double clicking or dragging a snippet item will insert it in the active editor.

The web tools user guide has a section about this view.




回答2:


Why don't you try Snip2Code plugin? It is a general purpose snippet manager platform that you can add to your Eclipse and will store your snippets on the cloud, so that you don't have to sync them when you reinstall Eclipse or move onto another machine.

http://www.snip2code.com/Static/Downloads



来源:https://stackoverflow.com/questions/865830/generic-code-snippets-templates-in-eclipse

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!