What’s changed in completion

Recently completion was improved, so I want to describe most significant changes:

  • Basic completion works as Class Name completion in case if nothing found. If something is found, you can invoke second basic completion to observe classes, which you want to import.
    So if you want to import for example HashMap you can just type HashMap and choose appropriate variant (in case if autopopup completion is enabled).
  • Completion after ‘@’ is smarter now. Both class name and basic completions show only annotations (scala and java).
  • Added false, true, this and prefixed this to smart completion. Added prefixed this and super to basic completion (so now it’s much simpler to type such code).
  • String.length, String.hashCode, String.trim has no side effects, so it’s always completing without unnecessary, annoying parentheses.
  • Class name completion after point tries to find possible implicit conversions (with fixing imports), for example:
  • Basic completion can filter inappropriate variants after implicit conversions in case if there are two implicit conversions, which lead to two elements with same signature. It means that this is impossible to use such variant, because of implicit ambiguity. For example parameter ‘x’ in class ‘Ensuring’ and parameter ‘x’ in class ‘ArrowAssoc’, these variants are bad, so it can be filtered.
  • All completion can choose variants of same name, which have the biggest priority in place, where completion was invoked, so you will see only variant, to which actually will be resolved reference after completion. So it means that shadowing is supported by completion.
  • classOf completion always inserts ‘[]‘.
  • Class name completion supports aliased imports.
  • Improved completion from Java for Scala keywords like ‘Thread.yield’ (it suggests only back-ticked variant).
  • Added smart completion for eta expanded functions:
  • Added smart completion for enum elements (Java and Scala).
  • Added smart completion for factory methods (static methods for Java classes, methods from companion object for Scala classes).
  • Name completion for classes. On toplevel if there is no class matching to file name, it suggests file name as class name. For all possible companion classes it suggests name of these classes (to make creation of companion objects faster and less error-prone).
  • Some completion now works on first invocation (http://blog.jetbrains.com/scala/2011/09/16/some-smart-completion/).
  • Second smart completion searches chains of methods:
  • Fixed many bugs and usability problems.
This entry was posted in Uncategorized. Bookmark the permalink.

7 Responses to What’s changed in completion

  1. Pavel Shatskikh says:

    Thank you, guys!

  2. Alain O'Dea says:

    Well done folks. I am always impressed by the pace and quality of improvements to the Scala Plug-in :). These improvements to code completion really boost my productivity and enhance the value of IntelliJ IDEA substantially.

  3. Great work!

    It would be good if you update the Wiki for the plugin to reflect this changes, otherwise people new to Scala + Idea will get the wrong impression:

    http://confluence.jetbrains.net/display/SCA/Getting+Started+with+IntelliJ+IDEA+Scala+Plugin
    ” last edited by Irina Megorskaya on Sep 03, 2010 ”

    Are there plans to be a more integral part of IDEA, the way Groovy is, in future releases?

  4. Alexander Podkhalyuzin says:

    Yes, I have in mind that we should update wiki pages (and have it up to date), actually I’m planning to complete this task before IDEA 12 release, not now.
    As for more integral part of IDEA it’s good idea, but we haven’t such plans yet.

    Best regards,
    Alexander Podkhalyuzin.

  5. I second the call for updating the Wiki pages for getting the Scala setup correct in IDEA. I have the latest IDEA (11.1), I have the latest Scala plugin, but the Hello World example does not work, so I’m probably going back to using Emacs + ENSIME, which does work. It feels like such a waste not to be able to use IntelliJ and the Scala plugin.

    • Michael says:

      As a rule, assume the latest version of IDEA (such as 11.1) won’t have working Scala support for a couple of weeks.

      The reality is simply you have to ensure they have a working Scala plugin before upgrading, and even then keep both versions of IDEA installed until you can check the latest verison as regression bugs are quite common.

      Having said that, I still use Intellij over Eclipse (for the moment at least), though both have come long way in the past 2 years.

  6. Pingback: Hongtium » 2012-04 Scala新资源

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">