Usually you can just start typing and then use some kind of automatic completion, much more efficient than hunting down multiple variables in code and copying them.
I think code completion is for “I want a list of properties or methods available for this function” and not “I don’t want to have to type the next few characters”.
This is why I'm such a big fan of good code completion. I don't need it that much in my main language, but when I use other languages every once in a while it's much much quicker than googling these things.
For case 2, a modern IDE like IntelliJ has completion suffixes. So you can type:
myfunction().var<TAB>
and it would expand to
object i = myfunction();
where i would be highlighted so you can immediately type the name of the variable and when you press enter the cursor is placed after the completed statement.
Code completion (not auto complete) was always meant for discovery and never to help save on typing, at least in textual environments. The idea of immediately showing you what some symbol can do without using the mouse is very powerful.
Unfortunately, in the real world, typing doesn't always work like in the test.
For example I'm a heavy IDE user and I know exactly what kind of autocompletes it will present me when I write something or what kind of shortcuts I can use, which made this really weird to use.
For example I rarely write 'function', I write 'fun' and press enter because I know 'function' will be the first item in the autocomplete list. When I'm writing a variable for the second time I feel the latency at which the IDE will autocomplete me. If there are more variables with similar names I know which characters to type to make it autocomplete the right one. If I have a variable named weirdNamedLongAssVariableName I will write wNLA and press Enter.
This confused me a lot on a subconscious level when I first tried the examples on the website.
I don't want to argue on your other points but imo the part of auto-complete that saves typing time is the least important thing in a IDE. The really useful part of auto-completion is actually exploring unfamiliar APIs.
If you use it as a programming partner it will simply autofill whatever you're writing line-by-line. You're not forced to use code completion at a whole-function level and it's not even the suggested use-case.
Fair point. I wonder whether this is a good reason to rethink the UI of autocomplete.
1. Instead of operating sequentially as you type, maybe one could type out the variable(s) one wants to use, select them and then have the ask the language analyzer to suggest functions?
2. Another change (possibly more effective) is to stop thinking in terms of data (and completing with functions) and instead start thinking in terms of functions (and completing with data). Just thinking out loud what might be a different thought process… The language (and types/classes) are not there to constrain you; write down the code/functionality you would like, and then find/construct the types you need to have that code be true :-?
I wonder what things would look like if they were to let you type, free-form, and not consider it complete until your code matched that of the sample. That way, you could use copy and paste, or bang things out and then fix them later rather than in-line. (e.g., let me type keywords and then later realize I forgot a 'self' in a Python method.)
With auto complete I rarely type more that a character or two of any single thing. I doubt it takes me much longer to compose a traditional program compared to array language syntax with modern tooling.
reply