Using IntelliJ
when i type try followed by Ctrl-Space
(autocomplete), i get nothing added
Instead, i'd like to see
try {
// do something great
} catch {
case e: Exception => // handle me
}
Language is Scala
, if this matters.
How can i define autocomplete pattern as shown above?
By default, IntelliJ IDEA displays the code completion popup automatically as you type. If automatic completion is disabled, press Ctrl+Shift+Space or choose Code | Code Completion | Type-Matching from the main menu. If necessary, press Ctrl+Shift+Space once again.
I have tried the following according to this thread (Intellij IDEA CE 12 Android XML Code Completion not working): Go to File->Power Save Mode and disable it - it is off. Go to Preferences->Editor->Code Completion and check Autopopup code completion - this has been checked. Go to File->Invalidate Caches and restart.
By default, IntelliJ IDEA shows all classes, methods, and other elements of the current file. To toggle the elements you want to show, click the corresponding buttons on the Structure tool window toolbar.
Use the surround templates:
You can find more details in help:
Yes, you can go to File > Settings...
and under Live Templates
add your own with,
Abbreviation: try
Template text:
try {
// do something great
} catch {
case e: Exception => $END$ // handle me
}
Applicable in Java: expression.
The $VAL$
places the cursor there after you tab off of the "try".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With