What’s changed in completion
Posted on by
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 (https://blog.jetbrains.com/scala/2011/09/16/some-smart-completion/).
- Second smart completion searches chains of methods:
- Fixed many bugs and usability problems.