IntellIJ has a feature where you can surround a String with double quotes by simply pressing “. Here’s how:
- Select the text you want in quotes
- Press “
There’s a video showing the feature.
However, this may appear not to work on your machine. There are two possible causes
Cause #1: The feature is off
Go into your IDE settings and choose
- Editor
- General
- Smart Keys
- Check “Surround selection on typing quote or brace”
Cause #2: Keyboard mapping
I’m on a Mac and the feature worked for single quotes and not double quotes. How odd. It’s clearly not cause #1 since it works for single quotes.
I then tried on my laptop keyboard and it worked with double quotes. So clearly the problem was my keyboard! Somehow it was being treated as an international keyboard instead of US. I remapped by going to “Keyboard” on Mac system settings and choosing “setup keyboard.”
Once I did this, the feature worked consistently on both keyboards.
Makes me wonder how people with non-US keyboards are supposed to use the feature!