Pasting code into Specs test suites slow in 0.4.938

Copying and pasting even 2 or three lines of code is a real pain.
This bug appeared first in 0.4.833 and hasn't gone away after I upgraded to 0.4.938.
However it was not present in previous releases.

There is a 4 second delay after pressing Ctrl-V.
I noticed this happens only on some files - at least the files containing Specs and Specs2 tests, but I'm not sure if it is not present somewhere else (but I cannot reproduce it now).
The specs files need not be large to trigger this.

How to debug it? Is there a workaround for this?


Capture a CPU snapshow of the slow activity as described here:
Create a YouTrack ticket (project Scala) here:, and attach the CPU snapshot, if possible with example code.



The time is proportional to the size of the file from which the code was copied. That file must be analyzed to find which imports must be added to the target file.


The CPU snapshot is not available in the Community Edition. :(

And the slowdown happens when I copy-paste within a single, not so huge file - I mean a file 70 short LOC long including 4 test suites.
On a very tiny file (10 lines) the problem is not visible when pasting, but still there is a sluggishness while typing.

E.g. such a code:

import org.specs2.mutable._

class EmptySpecification extends Specification {

  "Typing should be very fast" in {
    println("the IDE is very sluggish while I'm typing this text here...")

Funny, this doesn't happen on large files that are not test suites.


You can get a CPU snapshot with the Community Edition by installing the eval version of YourKit, copying the agent library from the YourKit bin to the IDEA bin directory and then modify the IDEA vmoptions file to add the agent option which loads the YourKit library. The instructions are here:


The problem is fixed now (or I hope so ;)).

Moreover, the plugin now allows to choose desired imports on code paste.


Great! Thanks!

BTW: Another thing that would be nice to have is some sorting of the import list, at least those imports that are fully qualified package names. Now copy-pasting code that requires lots of imports makes a little mess. ;)


Please sign in to leave a comment.