开发者

Eclipse code template to insert a bookmark?

Eclipse has a nifty feature which开发者_运维问答 allows you to define "templates" for code. I have created one to automatically put in a println and add a "TODO" comment. I'd like for this to also add a bookmark so I can easily find it again.

(The codebase I am working with makes it unfeasible to use just the Task List to find what I need to do since there are a lot of TODOs laying around.)

My current template is simply System.out.println("don't commit me!"); //TODO: fix this ${cursor}.


A bookmark is part of the editor.

You can find all of your TODO comments in the Eclipse Tasks view. If the Tasks view isn't open, just left click on Window -> Show View -> Tasks (not Task List).

If you left click on the Tasks description to make sure the Tasks view has focus, then double click on the Tasks description, Eclipse will open the editor and take you to the TODO line.

If you have the code already open in the Eclipse editor, Eclipse draws blue rectangles on the right side of the editor to mark all of the TODO comments. Left clicking on the blue rectangles will take you to the TODO comment line.

Edited to add: You can sort the Tasks view by clicking on any of the titles, like Resource.


I don't think it's possible via a code template.

It's certainly possible with the a key shortcut that can be assigned to add bookmark in:

Window->Preferences->Keys

but you still have the prompt to enter the name of the bookmark (rather than use a default set of text).

If you really want to get close to the functionality you want you could take a look at the Eclipse Bookmarks plugin:

http://www.etc.to/eclipse_bookmarks_plugin

and maybe hack it to do what you want... (if it doesn't already)...

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜