Insert Incremental numbers in Intellij
Edit: check below for new solution
Quick tip. If you're used to the Text-Pastry or Increment Selection plugins in Sublime Text, then there's finally a way to do it in Intellij and it's sisters (like WebStorm or PHPStrom) using the plugin String Manipulation.
It's a bit different from ST. You need to write your starting numbers first:
System.out.println("Here 1");
System.out.println("Here 1");
System.out.println("Here 1");
System.out.println("Here 1");
Then select the numbers with multiple selection and activate the Create Sequence command to get this:
System.out.println("Here 1");
System.out.println("Here 2");
System.out.println("Here 3");
System.out.println("Here 4");
YES!! Was missing this so much. There are also issues open about this, but my needs are now met.
Solution 2
Turns out live templates do this trick for debugging purposes even better.
- Open Settings -> Editor -> Live Templates
- Create new template
- Insert these values
Template text isconsole.log("$file$:$line$ $method$()");
. - Click on Change and add Javascript to the context.
- Click on Edit Variables and insert these
- Close settings
- In your editor write
log
and press tab. You'll now get the filename, line number and method name all in one go, even with multiple cursors!