Shortcut key to auto-complete covering the next word.
Hello,
I am working on IntelliJ for MacOS. I am looking at options to auto-complete where the auto-complete also covers the next word. I know two shortcut keys to auto-complete right now. One is 'Tab' which replaces the next word and the other is 'Cmd + Shift + Enter' which covers the entire line. It is difficult to describe but here is my best effort:
1. I have a word like this public String getValue() and I want to convert it to public Optional<String> getValue(). So I type public OptString getValue() and the Optional auto-complete pops up. What shortcut key can I hit such that that Optional covers the string in <> to change from OptString to Optional<String>?
2. I have a statement like this return "h" + name. I want to change it to return Optional.of("h") + name but when I hit Cmd + Shift + Enter I get Optional.of("h" + name), i.e. it covers the entire line instead of just the next word. Any shortcut key for that?
Please sign in to leave a comment.
Try creating a surround live template or the postfix completion:
https://www.jetbrains.com/help/idea/using-live-templates.html
https://www.jetbrains.com/help/idea/auto-completing-code.html#postfix_completion