IntelliJ IDEA code completion popup does not appear on Ctrl+Space after entering few arguments of method - intellij-idea

Suppose I have a method:
addUser(String userid, String email, String phoneNo){..}
When I write only two arguments addUser("martin","asd#gmail.com" and press Ctrl+Space then IntelliJ IDEA does not show the arguments that are accepted by this method.
Instead I need to remove them and type api. Ctrl+Space.

Code completion is supposed to work differently, once you choose addUser from the popup, you will have something like this:
Type the parameter values and press Enter to switch to the next one.
Parameter info can be shown automatically:
or manually on Ctrl+P (View | Show Parameter Info):
Code completion popup will appear after typing , next to the second parameter and pressing Ctrl+Space.

Related

Intellij Idea - complete next parameter shortcut

Example:
Author author = new Author("Jack", "Daniels");
In Exlipce when filled "Jack" and pressed "enter" - it automatically went to second parameter and let me fill second one. In Intellij I always have to click with mouse, or use arrow keys.
Is there a shortcut in Intellij to make it quicker? I can't find one myself.
Since IntelliJ 2018.2
You can now jump outside the closing bracket or quote with Tab.
(from: https://blog.jetbrains.com/idea/2018/07/intellij-idea-2018-2-macbook-touch-bar-java-11-breakpoint-intentions-spring-boot-version-control-and-more/)
Basically it means if you have:
Author author = new Author("Jack<cursor>");
And you press Tab, the cursor is placed like this:
Author author = new Author("Jack"<cursor>);
Note: it doesn't matter where the cursor is initially, as long as you are somewhere inside the quotes when you press Tab the cursor is moved outside and placed behind it. If you want to enter the next parameter you have to manually type the comma and String.
The option can be found under: Settings -> Editor -> General -> Smart Keys and is called Jump outside closing bracket/quote with Tab
There are some other useful options there as well like insert pair quote and insert pair brackets.
If you want to go more advanced you can have a look into Live Templates.

Autocompleting Parameters of a function in intelliJ

I have a function with parameters.
I like to use this function and would like to see the parameters that I have to provide to this function.
How can I force IntelliJ, that it shows me the parameters needed for that function when my cursor is in the () of that function ? Ctrl-Space do not help me out.
try CTRL+P
its shows you the type and the name
Press CTRL+SHIFT+A and search for Parameter Info and it will show u your hotkey

intellijidea code completion not new variables

I'm using Android Studio and I have code completion enabled as in picture.
I have enabled "Autopopup code completion" and "Insert selected variant by typing dot, space, etc..".
I want to write:
Drawable d = new BitmapDrawable(....);
I write "Dr", appears the popup, I click the space bar, and it writes "Drawable". It's all ok.
Then I write "d", appears the popup with "drawable" suggested, I click the space bar, and it writes "drawable".
But I want to write "d".
Is it possible to change this option applying only to classes and methods and not to new variables?
There is not a way to have code complete only apply to classes and methods and not to new variables. You have three options:
Turn off the Insert selected variant by typing dot, space, etc." options. You will then need to use Enter (to insert) or Tab (To overwrite) when you want to select an item from auto complete. The . (period/dot) key will still work when completing classes if you want to invoke a static member. (This is likely the best of the three choices and is the default behavior.)
After you type d for the variable name, hit Esc to close the auto complete popup before you hit the Space.
Turn off "Autopopup code completion" so that you have to manually activate it each time via Ctrl+Space

Returning to usage's location after Intellij IDEA "Create on Usage" intention action

Suppose I type a Java method call with an argument that I intend to make into a field:
knownObject.knownMethod(newField);
At this point, newField is highlighted as compilation error. I can press Alt+Enter and select "Create Filed 'newField'" from the menu.
That brings me up to the beginning of the class file where other fields are defined.
I can press Enter to confirm the new field's type.
Now I'd like to go back to my knownMethod() call and continue coding. How do I do that?
Bonus question: in the above situation, Ctrl+Shift+Backspace may help because I just edited the the knownMethod() call. What if I decide to first type in multiple arguments to the method? How do I get back to the argument I've just created a field for in that case?
For getting back to a previous caret location the Navigate > Back menu item usually works (CtrlAltLeft Arrow on Windows). Another option may be to use Edit > Find > Find Usages on the field (enable the Skip results tab with one usage checkbox setting)

Save a user popup selection in a custom Automator Action

Using Xcode 5.* for a cocoa-applescript automator action.
Interface is a a simple popup menu that gets populated using an outlet with:
tell thePopupMenu to removeAllItems()
tell thePopupMenu to addItemsWithTitles_(theList)
When the action is used in a workflow (a Service actually), I want the next time it is run and the action dialog shows up (I will have "Options:Show when run" selected), I want the popup menu to change the selection to the last one that was selected. Right now, the default first item shows, even though last time it was run, the user selected a different item in the popup menu.
My thought was that I need to capture a change in the popup menu with a Sent Action handler, and then set some type of default. I have a working handler:
on thePopupMenuSentAction_(sender)
set popupValue to (popupSelectedValue of my parameters()) as string
-- save this selection somewhere???
end
What's the right way to save this? Do I use User Defaults? My Bindings are currenly all tied through Parameter object/controller. If I should use User Defaults, can someone give example code for setting up User Defaults, and then how to get and set a new value using Cocoa-Applescript?
If I can get the name string of the menu item saved somewhere, I can get the string and then change the selection of the popup menu in the
on opened {}
-- set up the action interface
end
handler which gets called just before the action is displayed each time.
Thanks for any help,
Joe
I did mine a bit differently. I will assume you are referring to what XCode calls a "pop up button" (somewhat misleading). I did not use the parameters at all, although that is probably better for larger projects. Have a look at the code:
script Insert_Picture_into_Powerpoint_Slide_Show
property parent : class "AMBundleAction"
property menuChoices : {"Insert a Beginning", "Insert at End"}
property menuSelection : missing value
if (menuSelection as string) is "missing value"
set menuSelection to 0 as integer -- sets default value
end if
end script
I bound Content Values to File's Owner and under Model Key Path I put menuChoices.
Then you just bind the Selected Index to File's Owner and for the Model Key Path type menuSelection.
Defaults
On the initial run, if the user does not click anything, the menuSelection will be missing value. Because I couldn't find a way around this, I created a conditional which tests for this and sets it to the first choice by default (the one that is shown when you add the action).
When the user selections one of the menu choices, the choice is remembered on sequential runs.