Is there a way to generate a switch case for a given variable in IntelliJ?
Ctrl + space, and also Ctrl + J do not produce results.
For enumeration variables, type switch (myEnumVar) and press Alt + Enter . Smart completion prompts: Create missing 'switch' branches
switch (myEnumVar)
Create missing 'switch' branches
Crazy Coder provided the following screenshot showing how to enable the Create Enum Switch Branches setting.
See YouTrack issue 6374 .
Follow these steps: https://confluence.jetbrains.com/display/PYH/Creating+and+applying+live+templates+(code+snippets)
for context, use JAVA and the code for the switch-case statement:
switch($switchVar$) { case $value$: $END$ break; default: break; }
Do the same for try-catch;)
try { $END$ } catch(Exception e) {e.printStackTrace();}
I like the template function in intellij and use a lot.