DEV Community

Philipp Montesano
Philipp Montesano

Posted on

Useful live template for pull requests in IntelliJ IDEA

Using the pull requests feature in IntelliJ has dramatically improved my personal workflow when reviewing features. It allows you to use all your developer experience from within the IDE, including things like documentation, all your well-known shortcuts, jumping to implementations, finding usages, viewing parameter info and so on.

So first of all a big shoutout to the IDEA team.

It lacks one feature though, which the GitHub UI manages better IMHO: Suggestions. Well IDEA does provide it, in fact, but not so elegant. But it also provides you with live templates: A very powerful feature to insert predefined text snippets into your editor (or wherever you're typing). And mixing both enables you to use suggestions in a more fluent way.


To enable such a live template for pull request suggestions, first navigate to File > Settings > Editor > Live Templates.

Then add a new live template, choose a Name, an Abbreviation (the abbreviation is the shortcut which you will use in your editor later using CTRL + Space) and a Description and add the following to the Template text:



```suggestion
$CLIPBOARD$
```


Additionally, assign the $CLIPBOARD$ variable with the clipboard() expression, allowing you to insert the copied text as the suggestion directly.

You then finally need to enable the live template in Other texts.


You're then ready to use GitHub's pull request suggestions via the code completion (CTRL + Space) using live templates.

It gets rendered to the known suggestion within the GitHub UI.

Top comments (0)