Netbeans for PHP v8.0.2 said to generate getter and setter methods just press Crtl + I (Mac OS) and select 'Getter & setter' option but it does not show up as an option in there. Anyone know how to activate this please?
Just right click in side the class body,not over the class variables
and choose insert code option as shown in third image.
link:http://w.planetnetbeans.org/topic28565.html
Related
Suppose a Foo.java file which defines the Foo class.
The cursor is now on some line of Foo.java. The symbol under the cursor is not necessarily Foo).
How to quickly jump to the class declaration line (i.e., the line like public class Foo {) in Intellij?
Any shortcuts for this?
I use the ideavim plugin. Therefore, solutions relying on vim functionalities are OK.
On Mac you can do cmd + up arrow
(on Windows or Linux, I'm assuming it will be ctrl + up arrow)
This will select the current file in the breadcrumb (navigation bar) then hit enter and you'll be at the class declaration
You can look to which key combination this is mapped for you by looking in the keymaps for 'Jump to Navigation Bar'
From 2022.3.1 on Mac, cmd + up may not work for this case. it need you jump to a specific method.
Instead of cmd + up using navigation bar, cmd + F12 which show the file structure popup, then use left arrow to select class name if method is selected default, press enter and you'll be navigated to class declaration line.
I use the Generate function in the context menu to create my getter and setter methods. But there seems no way to tell Intellij to place the generated methods after the last method in the file ie at the bottom of the class definition. This is possible in Eclipse. Anybody know how to do it automatically in Intellij?
First of all a little hint. IntelliJ is designed to use without a mouse, so I prefer using the keyboard-shortcut Alt + Insert for code generating.
I don't know any possibility to generally define the place for inserting generated code. I recommend to place the cursor there, where you want to insert generated code and then generate it.
If you want to generate getters and setters via Generate menu, the only way is to place cursor at the bottom of your class (or wherever you want them to be)
But if your field is not used yet, there is another option: navigate to the field you need getter/setter for, press Alt+Enter (it calls intentions dialog) and choose "generate getter and setter" option. Then getter and setter will be generated at the bottom of the class (but not below inner classes if any).
settings > code style > java > arrangement
lets you customize the auto formatting options
Is there a shortcut to quickly show the type of a variable in JetBrains' AppCode? Preferably this would be something akin to Visual Studio, which shows the type of a variable when you hover over it with the mouse.
Alternately, if you hold the command key while hovering, you can hover the variable to have the executive summary info bubble. By then clicking the keyword (not the info-bubble) you can then get 'beamed over' to the code that declares or implements the specific interface. For example, in the following line :
[fa.AoEspec addTileSpec:[AoEtile AoEtileFromString:#"0,0,50,hit"]];
I will get an 'info bubble' for fa (local variable), AoeSpec (a property) AoEtile (a class) AoeTileFromString ... all clickable.
You can press SHIFT-COMMAND I to see the definition of the variable under the cursor. It shows you the line that defines the variable, as well as which file. Pretty handy when looking at code you didn't write.
In AppCode 2.1.x Cmd+Shift+I is not a predefined keyboard shortcut (anymore?!). And the previous mentioned Cmd+MouseOver may not be suitable for keyboard-only-junkies. So here come some alternatives:
Cmd+B - to go to the definition (and Cmd+Alt+CursorLeft to go back)
Alt+Space or Cmd+y - to show the quick definition window [1]
Maybe this is helpful.
[1] In AppCode 2.1.2 there seems to be a bug I filed with JetBrains that the quick definition window is empty for iVars (these underscore variables that are generate by auto-synthesize from #property fields). But in all other cases quick definition window works fine! And maybe the bug is fixed when you read this...
What works for me in AppCode 2018.2 is control + command + ? when the variable is under the cursor (quick documentation under View).
You can see a couple of other useful combinations under the View menu.
I'm looking for a generate method from usage. IntelliJ supports extract, rename etc. But if i write, for instance, $this->new_method($a) i would like to quickly generate this method in the same class. Does this exist or maybe there is a plugin for it?
Thanks for any help
Place cursor on non existing method
Alt + Enter (or wait and click on light bulb)
Choose Add method from submenu.
In Eclipse, when a variable is inspected and Eclipse is able to show its value, it does so by calling toString().
IntelliJ IDEA does not do it. Can it be told to?
Thanks.
Settings | Debugger | Data Views:
Using IDEA 13.1:
Preferences -> Debugger -> Data Type Renderers
+(add) new renderer, give it a name
On 'When rendering the node' select option 'Use following expression', type in 'toString()'.
This seems to give me Eclipse-like behaviour.
I'd paste a picture... but don't have enough points. :P
By default Intellij Idea does display the toString() of objects in debug view, unless you explicitly tell it not to in the dialog pointed by CrazyCoder above.
The problem that I have found is that for some crooked reason which only the folks at JetBrains understand, IntelliJ Idea (still as of version 13) will silently ignore the above setting and it will not invoke toString() on classes which do not override the toString() method. Even adding your class in the 'For classes from the list:' will not result in invocation of toString() unless your class explicitly overrides it. So, it appears that IntelliJ Idea will never ever invoke the default toString() method of class Object. I suppose it must be allergic to it.
Right click the variable in the Debug window, and choose "view text". It will open a window showing "toString"