intelliJ automatically formating variables first - intellij-idea

with ctrl-alt-L I can format the code of a class which works fine.
Is there also a shortcut to automatically sort codelines so the variables comes first and methods later ?

The action for this is Rearrange Code in the Code menu. It does not have a shortcut assigned by default, but you can assign one in Settings | Keymap.

Related

Remove Attributes on Rubberduck VBA

I'm just getting into using Rubberduck for my VBA applications. I came across a great post on adding attributes here:
How to set the Attribute VB_PredeclaredId using RubberDuck '#PredeclaredID
However, what if I want to remove the attribute? It seems like the only way to do it is via code inspections. However, after you initially set the '#PredeclaredId, there's no longer any error that shows up. So the option to remove the attribute is no longer available.
I tried deleting the attribute, but the "Predeclared" annotation is still in my explorer:
I'm sure I can export, edit in the text editor, and then re-import again, but one purpose of rubberduck is to avoid doing that.
Thanks.
After deleting the attribute annotation there will be a new "attribute value out of sync" inspection with 2 options:
adjust attribute value
adjust annotation
You want to do the first option which will nuke the hidden attribute value.
Update
Another 2 alternatives:
indent the module ctrl+m
cut and paste the code ctrl-a ctrl-x ctrl-v
Both these options will wipe out the attribute values by forcing VBA to recompile the module without them. This is normally an annoyance (indenting my project wipes the attributes and I need to restore them with RD annotation inspections)
Final thing remember to refresh RD code explorer so it picks up the changes and the icon will change. This often happens automatically though.

How to use Option in Intellij Keymaps?

I am trying to add Option-i | u for "Find usages" as shown in this dialog (Note that the "i" is lowercase - shift is not depressed):
But after having selected OK and then going back into Actions we see that the setting did not "take":
Note: I do have custom keymap entries to use Option- for accessing Main Menu items. But why is Option not working in this case? Is there a workaround?
On macOS, "Option" is used for typing special characters, thus when editor is focused and you hit Option-I the shortcut you assigned won't work (it will type a character instead).
However, when no editing field is selected, the shortcut should work (e.g. from tool windows).

Shortcut/feature for prepending $this automatically in Intellij/Phpstorm

Is it possible/does such feature exist that when I write an instance variable name (without $this->) it would search for a declared variable? I think it would save a bit of time not writing $this-> anytime I need to access an instance variable.
Currently such functionality is not available in PhpStorm.
https://youtrack.jetbrains.com/issue/WI-19345 -- watch this ticket (star/vote/comment) to get notified on progress.
Right now I may only suggest to write custom Live Template that would convert t[TAB] (or whatever abbreviation you desire) to $this-> with code completion popup already shown.
Related: https://youtrack.jetbrains.com/issue/WI-551
If all you need is save yourself the trouble of writing $this->, join the club. :) Macros are here for rescue.
I solved this problem by recording a Macro and then binding it with a keyboard shortcut:
Go to Edit | Macros | Start Macro Recording
Type '$this->'
Stop Macro Recording using the button in the lower right corner, then name it whatever you want.
Assign Shortcut to it:
Go to File | Settings | Keymap | Macros
Right click and choose 'Add Keyboard Shortcut'
I chose Ctrl+. as the shortcut and now I am more than happy. :)
I have answered a similar question here

Resetting IntelliJ refactoring defaults

I have set some defaults on IntelliJ's method renaming functionality [specifically 'rename string usages'] and its causing me pain.
How do I remove these defaults? I can't find it in the project settings
Use the Refactor | Rename keyboard shortcut twice to get the dialog with options:
Note the hint at the bottom of the popup.

NetBeans debugging variable values

I am debugging in NetBeans IDE, where can I see assigned variables and their values?
While you're in the debugger go Window -> Debugger -> Variables
You can also use ALT+SHIFT+1 to bring up variable viewer.
Generally, the pane underneath the code has some tabs - and one of them will say 'Variables'. Click on that tab and you will see variables and their values. You need to be actually running a debug session before the variables tab is available.
For this to show all local variables you need to have the line:
xdebug.show_local_vars=1
in your xdebug.ini file. Don't forget to restart Apache if you add that line.
If you are not seeing all local variables then you may have hit the problem where your version of the module file (xdebug.so) has a bug. This is the case currently for Ubuntu 10.04.
To fix this you need to compile a newer version of the xdebug.so file. Follow the instructions at http://xdebug.org/wizard.php to get your new file which should replace your current xdebug.so file.
There exists another solution that is
Press Ctrl+F9 to display Evaluate Expression Panel/Tab
Enter variable name in Evaluate Expression Panel/Tab
Press Ctrl+Enter (or arrow icon at right of Evaluate Expression Panel/Tab
The variable's value is then displayed in Variables Panel just below (on my PC) Evaluate Expression Panel/Tab.
You can also use this solution to display EXPRESSION and not only VARIABLE !
Example: (String sSheetData is a String variable that contains a very big string)
sSheetData.substring(4000,4200);
StringTools.Right(sSheetData,100);
StringTools.Mid(sSheetData,4000,200);
This is also possible using New Watch callable using contextual menu.
But this is not as easy as using Immediate Windows on Microsoft Visual Studio :-)