eclipse change member order shortcut (like intellij) - eclipse

Intellij has a shortcut for moving the current method internally in the class ( I think it is Ctrl+Shift+{Up or Down Arrow})
I would like to know if Eclipse has the same functionality.
I could mark the whole method and then alt-arrow to move it, but then it would move one line at a time. I would like it to move one member for every keystroke.
I would also not like to use the mouse (in the outline view where one may re-order members of a class)

if you double-click just after the opening { of a function, you will select the all function body.
You can then:
Alt+Up: to move the function up one line
Alt+Down: to move the function down one line
Of course, that is the shortcut you describe in your question, and moving a function by just one line can result in an incorrect code (as the function can end up within another one).
You have to repeat the shortcut the appropriate number of time to actually move the function before or after another one.
So the answer is: No, not exactly like IDEA, but close enough.
Actually, if the outline view is not sorted alphabetically, you can drag and drop a function in order to reorder them.
But that is not a shortcut.

If you can afford to use the mouse, you can do it from the outline view. That will be easiest.

Related

viewing method signatures with parameter highlighting in NetBeans

When the cursor's positioned in the middle of an argument list (making a method call), is there a way to bring up the method's signature with the parameter that that the cursor is on highlighted? Ctrl-space (sort of) brings up the signature, but it includes the huge search list of everything else I can legally type right there, and it's up to me to count through the arguments and the parameters to figure out which one I'm lined up on. (that popup also disappears if I try to move to the next or previous argument).
I've had this struggle with compiled code, and worse with code as I type it in. I typically type the name of the object, then a dot, and then I wait for the signature list to pop up (that filters down as I type). When I see the signature I'm after, I auto-complete with tab or Enter, and then I always end up in a struggle. NB pastes in variable names that are usually about 99% wrong, and I try to navigate the little red, comma-triggered edit boxes, hoping the signature popup will stay in view while I struggle to edit, delete (and stop thinking about) all the (semantic) errors. I usually end up botching it and loose the precious signature window that highlights each parameter as I moved through the argument list.
Any way to get that thing back (with the parameter highlighting)? And/or make the red editing boxes go away? And/or block NB from populating with all the errors?
Super thankful for any help or tips!
Netbeans show popup with method signatures and popup with method documentation only when your cursor is placed at the name of a method. Popup is displayed automatically when writing method name or on demand if you press Ctrl+Space.
When your cursor is placed at the argument list, only parameter names from method signature are displayed in form of a small tooltip. You can force display of this tooltip by Ctrl+P. Unfortunately there is no way how to invoke popup with method documentation in this phase. Instead you will see documentation popups related to arguments which you will type into the method argument list. The only way to display method documentation again is to place the cursor back at the method name and press Ctrl+Space.
When you start writing a method name, popup with method signatures will emerge. When you select one of proposed method signatures by pressing Enter, Netbeans will autocomplete method name as well as its arguments. You find this uncomfortable, because names of autocompleted arguments are usually wrong. You can however easily navigate between autocompleted arguments using Tab and Shift+Tab and overwrite them as you like. Alternatively, you can use Tab instead of Enter when selecting method from method signatures popup. This way Netbeans will autocomplete only the name of the function, not its arguments.
Described Netbeans behavior applies to editing PHP code, and may differ slightly for other languages.

How to move cursor to a C++ function(method)'s name from its body in VSCode with VIM extension

I'm developing some C++ code with VSCode+VIM extension. From time to time I need to do this while reading code: say I'm inside a long function and I want to know who called it. The first step to do is to move cursor directly under function's name so that I can invoke some keystrokes to show references.
What I'm current using is to press "[" key twice which will bring me to the opening bracket of the function. Since I have to follow some coding standard, the typical scenario is like this:
ReturnType ClassName::FunctionName(
ParamType1 param1,
ParamType2 param2,
ParamType3 param3)
{ // <-- Cursor here
......
}
Then I need to press "k" several times to move cursor under "ReturnType", depending on how many parameters are there. Next, I still have to press "w" 3 times to eventually move cursor from "ReturnType", to "FunctionName".
As you can see, this is a little painful here. I've tried easy motion approach with VSCode VIM extension, this makes my life a little easier, but I'm looking for a even better one.
Any VIM trick or VSCode extension can do this decently?
Any help will be appreciated, thanks!
To avoid having to press k a variable number of times it's possible to make use of the fact that the ) is right on the line above, and use % to go to the matching (. The complete key sequence is [[b%b.
However the first b will go to the ( if there's nothing between the parentheses. [[ge%b can be used instead.
If there's something between ) and { (such as a const qualifier) [[?)<cr>%b would work (this solution is complex and perhaps only useful in a key binding?)
[[?(<cr>b works too as long as there's no parameter that contains an open parentheses (such as in FunctionName(int (*function_pointer)(int, int)) { ... })

notepad++ How to assign two macro to same key?

Using the GUI: I assigned a macro to allow me to select the current line my cursor is on. I assigned it to 'ctrl+a', and reassigned 'select all' to 'ctrl+alt+a'. I now want, when I press 'ctrl+a' a second time, to have it highlight the remainder of the paragraph. Currently these commands are available via the following key-press:
Instruction:
1. Home->shift+end --highlights one line
2. Home->shift+end->shift+end -- highlights connected lines
So 1. is assigned to 'ctrl+a', but I'm stuck at this point. How do I assign ctrl+a when hit a second time to highlight the connected lines/paragraph? Details/specifics in layman's terms would be appreciated. Again, I've only been using the gui options, I'm not familiar with the more codey options. Note that it doesn't allow me to use
ctrl+a->shift+end.
I'm not overly familiar with macro and hotkey binding, so I'm unaware if this is a limitation or if there's a workaround, other than writing a program to fix it.
Not a coder, but from what I know of Lua I cameup with:
is_press=false
if btn(ctrl+a) and !is_press then btn(Home->shift+end) is_press=true end
if btn(ctrl+a) and is_press then btn(Home->shift+end->shift+end) is_press=false end
I could assign 2. to ctrl+shift+a, as a separate macro if all else fails.
Short answer, I don't think this is possible with a singe shortcut/macro.
Behind the scenes, Scintilla is doing the selecting. Once you've done the selection, going back to "home" the second time will reset the word wrap extension.

deleting collapsed code section in Eclipse

Collapsing code sections is nice. But everytime I select the collapsed part in the editor and cut/delete it the selection expands and I have to find the start/end manually in the expanded code.
Is there an easier way?
Many thanks!
When your cursor is inside the element you can use Select Enclosing Element Shift+Alt+Up. You may need to press it a few times, depending how many levels of enclosing elements there are (blocks like loops).
You may use a desktop environment that thinks it is a good idea to define a few hundred shortcuts that you will never use but that override all your application shortcuts (Ubuntu Unity). In this case you may need to change your desktop environment (by far the most painless way to solve this problem).
Using Neon
Collapse the code
Double click the collapsed code
Hit ctrl-x or the Delete key.
Hitting Backspace or the Enter key still just expands the collapsed code

using idioms in vim for perl

I have the perl-support plugin enabled. now, I tried the \idd idiom shortcut which would give you a my ($,$); statement with the cursor placed on the first var. Now the second var is displayed as <+name+>. In effect the my line after entering the first variables name would be
my ( $top, $<+name+> );
If it was a code snippet I could have easily used tab to go to the next field, but it is not working in this case. How do I quickly move to changing the 2nd part of the idiom?
Those are jump targets, and you can visit them with Ctrl+J. See perlsupport-templates-jump for details.
If this is VIM, why don't you just use VIM's navigation keys for this?
3W (that is a capital W) will move you three words to the left, right onto $<+name+>.
You could also try:
f< to put the cursor on the <, and then you can change <+name+>.