How to add items to the top of the "surround with" context action?

I like the "surround with" action on alt+enter, but it only ever offer to surround with {}, or () when inside a method. If I want other templates (like #if..#endif), I have to drill down inside the submenu. Is there a way to force some templates to appear in the root menu?
I know I can do ctrl+E/U to have a surround menu directly, but alt+enter is much more convenient and ubiquitous.
(I attached a screenshot to illustrate my point, I cannot insert images in the body, it gives a HierarchyRequestError...)



Attachment(s):
capture.jpg
0
2 comments

You can't modify the items that are shown in the alt-enter surround with menu. However, you can customise the list that gets shown in the "surround with" sub menu. Select "more" and in the template chooser dialog that appears next, select the item, and check "add to quicklist". This also affects the standard surround with menu, which you can open with Ctrl+E, U (Ctrl+Alt+J for IntelliJ) and this will show the quicklist by default)

0
You can't modify the items that are shown in the alt-enter surround with menu.


Ah, that's what I was afraid of...



However, you can customise the list that gets shown in the "surround with" sub menu. Select "more" and in the template chooser dialog that appears next, select the item, and check "add to quicklist". This also affects the standard surround with menu, which you can open with Ctrl+E, U (Ctrl+Alt+J for IntelliJ) and this will show the quicklist by default)

Yes, I did customize that list, that's actually the reason I find it frustrating that it doesn't show more directly. As for the ctrl+e,u I don't really want to remember another shortcut (I actually very rarely use any "wait for the second key" shortcuts). That's the great thing about alt+enter, one shortcut to rule them all :) !

I since realized that the "surround" action can actually appear amongst others depending on the context, so I suppose then you wouldn't want to have a big fast list in the middle.
But, when I've selected a line or paragraph, and hit alt+enter and the only thing there is the "{}" menu item and "surround..." submenu, it feels a bit silly to have to drill down.

Anyway thanks for the answer.

0

Please sign in to leave a comment.