Intellij Idea Live Templates

I faced with the problem of writing my vcs current branch name each time I have written 'todo' comment.

Recently I learned about Intellij's 'Live Templates' which is quite comfortable to use. I tried to apply it to my problem but there's no templates to take out a branch name.

So the question is could I actually take out the name of my branch to code comments somehow?


Staples Advantage Login


For live templates you can use predefined functions. Unfortunately there is no function to detect the current VCS branch.
But you can create a template to make work a little easier:

// TODO [$branch_name$]: $comment$

With this template, you still have to fill branch name, but you should not type symbols like [ and caret will be placed automatically.

You can also create a feature request for a new predefined function.


 I must to write my current branch name in 'todo' comment (like 'todo [feature-xxx]: <my_todo_comment>') each time I want to leave a comment somewhere in a code. And it's actually a bit boring so I want to generate 'todo' template automatically (as I understood Live Templates, you only start writing a special key word and then full template will be generated). In search of acceptable template I didn't find any way to do that (I couldn't found any function to find out which branch is currently used).


Please sign in to leave a comment.