IntelliJ IDEA scala type info - scala

The Eclipse scala plugin has a very nice info. One can hover over pretty much anything be it a function definition, val, var, function call etc and get type info. This is immensely useful to me to ensure type compatibility especially when I am trying new things out.
Is there a similar feature in IntelliJ Idea 12.1 (the latest version as of this comment)?
The closest thing I could find was the type info setting. The default key binding did not even work for me on Mac OS 10.7.5. Even after tweaking, it does not work as universally as it does in Eclipse which shows a type for pretty much everything. Has any one managed to get this to work? My ideal setting would be type info on hover just like in the Eclipse.
I have heard great things about the IntelliJ IDE for Scala but so far the Eclipse Scala plugin wins hands down.

To enable on mouse hover type information go to Settings->Scala and select the "Show type info on mouse motion with delay" checkbox.

Type Info is great in IntelliJ; you have to press the key shortcut to see the type of a given variable or function.
If I recall correctly, there's a conflict between Type Info's key shortcut and something else in IntelliJ. If you go to Settings -> Keymap -> Plug-ins -> Scala -> Type Info, double-click it, you'll see the conflicts. I changed mine to Option ⌘ =. (see this answer for more tips if it still doesn't work)
Another shortcut I use quite a lot to quickly look up a definition is ⌘ shift I.

Not exactly what you're looking for but close enough - you can press alt + '=' when the cursor inside the function name, val name etc., and you will get popup with the type.

Intellij IDEA 14 (OSX) has this option in the Preferences -> Languages and Frameworks -> Scala Compile Server menu option.
Ensure that the Show type info on mouse motion with delay option is ticked.

I'm using Idea 13.0.2 with scala plugin 0.30.387 -- there is an option to display type info on hover just like eclipse. To turn it on, see
Preferences -> Scala

Related

Eclipse autocomplete parentheses in control structures

I have a quick question that might save me a few seconds of annoyance every day. I know that eclipse can do a lot of autocomplete magic, so this might be possible:
As a programmer who learned with python, I constantly forget to surround contitions in control structures (like if or while) with parentheses. How do I make eclipse autocomplete opening and closing parentheses when I finish typing while or if?
I am aware that I can autocomplete whole structures with ctrl-space, but how can I configure eclipse to do this by itself?
Any help is appreciated.
So in stock Eclipse, the usual way to bring up assisted content is to type Ctrl+Space. The problem with this is that it brings up both Help Proposals and Template Proposals, with the Help Proposals displayed first. You end up wasting time scrolling down to find what you actually want from the Template Proposals. And there's just that much more clutter to choose from.
The solution is this:
Go Window->Preferences->General->Keys. In the type filter text search for "Template". This should bring up a "C++ Content Assist (Template Proposal)" line. Click on it. Now map this to whatever shortcut you'd like (I did Shift+Space because that's an easy one to do while typing). Make sure to click on the "Binding" option to do this. Click "Ok" and you're done!
If you ever want to add or change what is brought up by that shortcut, and for which specific strings it works, just go Window->Preferences->C/C++->Editor->Templates and you can edit those to do exactly what you'd like when using that newly assigned shortcut.
Hope this helps.
EDIT: I am unable verify if this works for PyDev, as I'm running Eclipse Oxygen, which doesn't currently offer PyDev or the Eclipse Marketplace Client plugin. However, my guess is this would still work in PyDev. Best of luck!
Sources:
Setting auto complete shortcuts in Eclipse
How to change the Control+Space autocomplete shortcut keys in Eclipse for Android
Thanks for any help, but the only thing that seems to work are workarounds. My prefered "solution" is to change the Auto activation triggers for Java in Preferences>Java>Editor>Content Assist from . to .iwfs, so that the autocomplete dialog automatically pops up when I start typing if, while, for or switch. Then hitting enter will do exactly what I needed.

Groovy-Grails Tool Suite (GGTS) content assist not recognizing basic groovy

I have installed GGTS, on ubuntu and am trying to edit .Groovy files with the built in editor.
The autocomplete is extremely annoying because while it will recognize my domain objects i.e. my User class etc.. It doesn't recognize basic groovy, for instance I start typing "def" to define a variable then hit space and it will autocomplete to "Default", similarly if I try to type in "return" it autocompletes to "RETURN" while I am typing as soon as I hit space, which is very annoying.
Like i said it will recognize classes, so if I type def u = new User(), the User part will complete ok, but the problem is that the variable u I defined earlier isn't recgonized later in the code.
I hope you guys get my meaning... No idea how to fix it, short of not using the groovy editor and treating it as plain text. I even tried disabling content assist, but that didn't seem to work for some reason
I was having this problem in GGTS 3.4.0.RELEASE today, and getting very angry with the situation.
Somehow my workspace had the "Auto activation triggers for Java" set to "_.abcd....z" (all the lowercase letters)
Window -> Preferences
Java -> Editor -> Content Assist
"Auto activation triggers for Java" set to just "."
This seems to have helped dramatically.
I'm still not sure what caused my workspace to have this setting.
Make sure that you're in the Grails perspective; that can impact some of the Groovy/Grails features and how Eclipse (even GGTS) leverages them. You'll find the perspective button in the upper right. If you're in Java or Debug, odd things like this may occur.
Also, how are you creating and opening your Groovy files? Do you use the context menus or the Grails command prompt tool to issue orders like "create-controller"? If you're creating the files in some other way, try using those methods to generate them, and see if you get the same results.

How to remember the choice of the run type in Eclipse?

Each time I try to run my Scala program in Eclipse it asks me whether it is Scala or Java. I select Scala, it runs, then I try to run it again, and Eclipse again asks me... this is tiresome.
How to make my choice stick, so I would be asked once or even not at all (extension should be recognized, I think)?
Update
See Luigi answer -- I am NOT asking about key assignment. I am asking about remembering my choice of the type of the file when running it. So it has nothing to do with editing the keyboard (actually I don't use any keyboard shortcut to run app).
Check the Launching Preference Page's "Launch Operation" setting and make sure you change it from the default to always launch the previously launched applicattion (or choose it from the Run/Debug button's drop-down menu).
Some parts of the Scala IDE are based on JDT - the Java Development Tools. This means that eclipse is sometimes unable to distinguish between a Scala and a Java application.
Some time ago this problem was discussed on the mailing lists. See the discussion there for some suggestions on how to avoid the upcoming frame.

Keyboard shortcut synchronization with Eclipse and IDEA?

My time spent programming is split between what I do at work, and the programming I do at home in my spare time. At work, we use Vista machines and IntelliJ IDEA 8, whilst at home I use Mac OS X and Eclipse.
As you can imagine, my ability to easily switch between the two is getting more difficult as I find the keyboard shortcuts are different.
Is there a good way to quickly standardize the shortcuts for both Eclipse and IDEA? I see myself mostly using Eclipse in the future, so I would preferably like to switch in that direction.
If not, I'll do it manually (ughh).
To get Eclipse Shortcuts, go to "Settings" and type "keymap".
Then select Eclipse on the list.
Odd, someone had the exact same wish back in 2005!
Intellij is supposed to have an Eclipse Keymap
The IntelliJ FAQ for eclipse user mentions:
IntelliJ IDEA includes a bundled Eclipse keymap, so you can select it in Settings dialog, Keymap if you prefer using shortcuts you're accustomed to.
IntelliJ is supposed to have that Eclipse keymaps since the Demetra 6.0.5 version.
See their Release Notes from that (old) version.
Shortcut to use Eclipse shortcuts in IntelliJ Idea:
Press ctrl+`(also have tilde~ on it, button at the left side of digit 1). Then press 3 (Keymap) and select 2 (Eclipse). Done!
From the Settings dialog box --> select Keymap --> select "eclipse" from keymap dropdown list. Have a look at below link for details:
https://confluence.jetbrains.com/display/IntelliJIDEA/Configure+Keymap
This doesn't directly address your question, but IntelliJ's license allows you to run the application from home. See their faq.
That way you can use IntelliJ both at work, and at home.

How do I use IntelliJ to auto-complete method parameters?

A feature in Eclipse that I really miss is how you can auto-complete method parameters with currently in-scope variables. This feature will, with a single key combo (ctrl+space) fill in all method parameters. As long as my variables were named similarly to the method parameters, I never had a problem with this auto-complete. Is there a plugin or a native way to accomplish this in Intellij?
You might already know that IntelliJ IDEA has the CTRL+P shortcut (Windows) and CMD+P (OX X) that brings up a brief description of which parameters are passed to the method. It's very handy and saves a lot of time that otherwise would have been spent looking up the method declaration.
IntelliJ IDEA 9 now supports what they call "super completion" which matches the behavior you are looking for and is available through their early access program.
(source: jetbrains.com)
IntelliJ IDEA 8 does not allow you to autocomplete more than one parameter at a time. You are forced to use Control-Shift-Space once for each parameter.
Control-Shift-Space (and the completion is based on type, not name)
For more goodness: Help -> Default Keymap Reference
There is also an IntelliJ plugin called 'kotlin-fill-class' that will fill in some default values automagically. Tested the latest snapshot version of the plugin with IntelliJ 2019.1 and it appears to be working.
from this post: https://stackoverflow.com/a/55160515/405749:
The plugin https://plugins.jetbrains.com/plugin/8638-auto-filling-java-call-arguments at least will provide a smart fix to do it when pressing alt+enter.
I have not found a away to do this completely automatically as it works in eclipse.