How to go to a highlighted function in radare2? - radare2

In radare2, after hitting "v", I can scroll through the code, and also selection function calls with the cursor. I'm curious how I can jump to the definition of a function, as in "step into" a function call that's highlighted.

In visual mode, you can use s to step into a function, or S to step over a function.

Related

How to make IntelliSense show the parameters of a function in VSCode?

How can I make Intellisense show up the function parameters once the parentheses are written down? It shows only if I just type them like in the tutorial example, but not once they are already written and I set the cursor with the mouse inside.
I think you want the Trigger Parameter Hints command. If you type it in the command palette it will show your current short-cut (mine is Ctrl+Shift+Space).

Unfold all sections in selected section

So in Visual Studio if I have a collapsed function code, when I unfold it, it also unfolds all the ifs, switches etc. inside of it. In visual studio code hovewer if I go for Fold All (Ctrl+K Ctrl+0) then if I wanna quickly check one function (f.e unfolding it by mouse click on the cross near line numbers), it unfolds the function but it doesn't go recursively, making me to unfold every other if/else or case. Is there a way to make this work the way I would expect it?
Try Ctrl-K Ctrl-] recursive unfolding when the cursor is on the function to unfold.

How to trigger documentation popup in vscode

How to trigger a popup with documentation for identifier under the cursor?
Normally it appears when hovering the identifier using the mouse pointer:
I would like to achieve this effect using a command or keyboard shortcut.
The only related commands I found are: trigger completion (which doesn't show the function doc) and trigger parameters hint (which only works when the cursor is inside function call - parameters list).
This is the editor.action.showHover command. It is bound to cmdk cmdi by default.
Note: Shortcut works by holding down the cmd [ctrl in windows], then while holding press k then i
You can change the keyboard shortcut with a keybinding such as:
{
"key": "cmd+k ctrl+space",
"command": "editor.action.showHover",
"when": "editorTextFocus"
}
The default shortcut for Trigger Parameter Hints is Ctrl+Shift+Space
You also have, with VSCode 1.40 (Oct. 2019):
Definition Preview Hover from the keyboard
There is a new command Show Definition Preview Hover for better accessibility of the definition preview hover widget, which can be triggered by hovering a symbol with the mouse and pressing a modifier key dependent on the platform and configuration.
Previously, only the command Show Hover was provided, which is equivalent to hovering the mouse cursor over a symbol.
Now, with Show Definition Preview Hover, the detailed hover information can be shown via the keyboard.
To make this more graphic, check these steps:
In Visual Studio 2019 for Mac, I couldn't find anything about "hover" in the Key Bindings setting. The relevant command seems to be called "Show quick info" and is bound by default to Cmd + F1.
I know this question is about VSCode but I could only find this question when trying to search for an answer. Therefore I would also like to leave the information here in case somebody finds it useful.
There are multiple ways to trigger the documentation popup:
First: Using shortcut ctrl + space
Second: Using vscode extension:
Here is the documentation:
Each answer here demonstrates a different function. Below is a consolidation of every type of helpful popup, the context in which they come up and all the ways I know to trigger them.
These assume default settings.
Function: Display documentation
Shortcut: Ctrlk Ctrli
Scope: Works over named elements - variable and function names (does nothing over literals).
Can display function documentation:
or variable or even property information:
This is the same pop-up you get when you hover over the element briefly.
Function: Display parameter hints.
Shortcut: CtrlShiftSpace
Scope: Works inside a function call.
The cursor must be inside the parenthesis that contain the passed arguments. Does nothing outside that scope.
Can also be triggered by typing a comma, as if passing another argument.
Up/Down arrows can be used to cycle through overloaded definitions (instead of moving the cursor up and down the document).
Function: Display the code completion menu
Shortcut: CtrlSpace
Scope: Anywhere. Will adapt to the context. In strings will display words only. In code will offer symbol hints - function names, variable names within the current scope, known properties, etc.
Is case insensitive.
Matches all contained characters - they do not have to be consecutive (see image above).
Tab or Enter accepts the currently selected suggestion.
Symbol hints can be triggered by just typing letters. Inside strings you must use the keyboard shortcut.

Difference between "step" and "step in" in the MATLAB debugger

What is the difference between "Step" and "Step in" in the MATLAB debugger? As far as I have tested them in some debugging so far they gave me the same steps and results.
When you use step in on a function call, you will enter said function. step is used to move to the next line. When you use them on lines without function calls, they are equivalent.
The command dbstep (or the debugger tool "Step") executes the next line of code. It does not stop within that function, even if that function is implemented in MATLAB code and contains breakpoints.
The command dbstep in (or the debugger tool "Step In") also executes the next line of code, but if that line is a call to a function implemented in MATLAB code (i.e. not a built-in), it will enter that function and stop at the next line of code within the function.
If the next line is not a call to a function implemented in MATLAB code, dbstep and dbstep in are equivalent.
See the Matlab doc: dbstep
Basically, Step executes the next line, even if there is a call to complex function/other script. Step In jumps in the code on the called function if possible, else executes the entire line.

(matlab)implement "Evaluate or Open Code You Select" in everywhere? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
How do you retrieve the selected text in MATLAB?
I want to implement and add some features to the function "Evaluate Selections", where you can highlight code and then "Evaluate Selections" by right click your mouse (or F9).
In the editor environment, this is how it is done:
editorObject = matlab.desktop.editor.getActive;
eval([editorObject.SelectedText ';']);
How can I implement this from the command line window, or the help window?
EDIT:
Maybe I didn't express my question clearly.
Imagining that we already have this function called eva_select(), I can use function this way:
I wrap the function as the Shortcuts button.
Use mouse to select a variable at command line window, maybe I entered before, say var_a
Then I click that Shortcuts button, the text which I selected before will be executed. This is exactly as press F9 key or choose right mouse menu -- "Evaluate Selections".
But if we really have that function, we can do more! We can modified eva_select() to eva_select_size(), in this way, we can select a variable, say var_a at command line window or help window, click eva_select_size() shortcuts button, then, we will get size(var_a) at command line window!
EDIT:
Thanks, I can retrieve the text in the command window, but I can't do the same thing in the help window, is it possible to do that?
The command window, like other GUI components in the MATLAB desktop, is Java-based. Therefore it can be accessed programmatically, but it is completely undocumented and its use is not officially supported.
Exploring around, here is a solution that seems to work in both R2012a and R2012b. It involves obtaining a handle to the underlying JTextArea of the command window, which is used to get the selected text (to evaluate size of selected variable name)
Create a shortcut with the following code:
x = com.mathworks.mde.cmdwin.XCmdWndView.getInstance();
s = char(x.getSelectedText());
if isvarname(s) && exist(s,'var')
eval( sprintf('size(%s)',s) );
end
Next highlight a variable name in the command window and execute the shortcut. The size will be immediately printed as shown in the screenshot below:
It is not very nice as it is an external solution, but this is how it could work:
Assuming you are in the command window and want to evaluate size(var_a) by selecting it, you can probably do this with a keyboard macro. Defind the appropriate function of var_a
f(x) = eval('size(' x ')'
%This could be done in the macro, but nicer to do it here for easy editing.
Then make sure your macro does this:
Copy 'var_a'
Turn it into 'f(var_a)'
Paste the result
Hit enter
Like i said, it's not pretty, but it should do the trick.