DEV Community

Philipp Montesano
Philipp Montesano

Posted on

2 2

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.

AWS Q Developer image

Your AI Code Assistant

Ask anything about your entire project, code and get answers and even architecture diagrams. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Start free in your IDE

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay