Hi, Starting with kotlin 1.2.40 kotlin scratch ca...
# intellij
j
Hi, Starting with kotlin 1.2.40 kotlin scratch can be run. This is great. Unfortunately I didn’t find a way to run the scratch file by shortcut. Moreover, I did not find a way to create a custom shortcut for Run Scratch File action - the green icon button in the scratch editor buttons bar. Moreover
Run Scratch File
is not included in the Run action - Cmd Shift A Thank you in advance for helping me with this.
c
Standard "run current file" hotkey works for scratch fiels, too:
Ctrl+Shift+F10
(Linux/Windows)
j
Thank you Alexander, This is not the same as running the scratch file using the green arrow button on the left-top side of the scratch editor.
Running the scratch file using the above mentioned button run the scratch file more like a scala worksheet
c
Oh, I see. Never tried to press it before 😄 For me it doesn't even work, trying to run
println("works")
via that button gives me
Copy code
Unresolved reference: println
Compilation Error
Huh, just needed to specify the correct module to attach scratch to. I see now what you mean.
This seems important. I wasn't aware about it earlier, but now that I know it exists, I want to use it 🙂 Will you/have you filed an issue?
j
Yes, it is important to select the correct gradle-subproject module (and source set as well), otherwise the autocomplete/compilation doesn’t work. I already put a comment about the issue with shortcut in the youtrack ticket about Running a kotlin scratch file. As soon as I am getting a reply I will go further with filling in an ticket, and let you know.
👍 1
Just noticed you seen my comment in https://youtrack.jetbrains.com/issue/KT-10368
c
Yeah, I did. Unfortunately since ticket was closed and the issue you've described is not the one in that ticket, next step is creating new ticket regardless of any response there.
j
c
Cool! Voted.
👍 1
j
Hi, This would also be a very useful addition to kotlin idea plugin. https://youtrack.jetbrains.com/issue/KT-10176 I think it worth your vote. Thank you.
c
Voted out of courtesy but the one time I actually needed to use it in my project, it failed miserably to do what I wanted. So I don't much care for this functionality.