Hacker Read top | best | new | newcomments | leaders | about | bookmarklet login

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.


sort by: page size:

I thought about this, but realised that I don't spend that much time typing when coding.

Maybe when defining a new variable/class/etc. the first time, then IDE autocomplete fills it in the next.


That gets messy fast though. You start having to escape strings in your code, and potentially have a trickier time with autocompletion etc.

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”.

I just meant copying and pasting long function and variable names out of my own code elsewhere, should autocomplete somehow not apply.

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.


Sure, auto-completion makes the code easier to write. But you can't make it easier to read.

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.

Are you coding without any form of auto completion?

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.


And it's not like anyone is typing these words out. IDEs have auto-completion for that purpose.

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.

Sure, but at least, auto completion works automatically.

With dynamically typed languages, you get cryptic (and vague) errors and auto completion just can't work.


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.

Actually, this doesn't seem helpful at all. Rarely am I typing the entire program without any autocompletion and intellisense based assists.

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 :-?


This sounds a lot like auto-completion in a good IDE.

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.)

Probably less about typing, then, though.


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.
next

Legal | privacy