5 ms·
I used to think this way, too, so I don’t think you’re weird. At my old workplace, everyone else was a Java IDE wizard, and I was used to good old-fashioned tex
by cytzol 7y ago
I used to think this way, too, so I don’t think you’re weird. At my old workplace, everyone else was a Java IDE wizard, and I was used to good old-fashioned text editors. Aren’t you distracted by that widget appearing while you’re typing, I thought? Is it really faster for you to hit the Down arrow three times instead of just typing ‘empty’? Do people not learn the libraries they’re using anymore‽
But over time, something changed, and I’m now a big fan of autocomplete interfaces. There was something wrong with my initial assumptions, and I think that’s the same assumption you make when you say this:
> i can type “empty()” on the keyboard faster than I can look at a screen and choose “empty()” from a list
You’re right, I can type ‘empty()’ faster than selecting it from a list. I have the muscle memory already there, and I don’t need to stop and look and think about which method I’m autocompleting.
The reason I still use autocomplete is not that I need my IDE to tell me that there’s an ‘empty’ method there as if that’s something I don’t already know, but to tell me that my assumption that ‘myVector’ has an ‘empty’ method is correct!
I occasionally write code like this:
auto myVector = someFunction();
if (myVector->empty()) {
fillVector(myVector);
}
Only to find that ‘myVector’ is not actually a vector, but an optional<vector> or another type entirely that requires me to do something else to get the vector I want. At this point, if I start typing ‘empty’ and the autocomplete widget does not appear, I immediately know that I’m not dealing with the type I thought I was.
Once I started programming this way, having the window appear was not ever a distraction, because I expected it to appear. In fact, the only distraction was when it stopped appearing, when I’ve made a mistake!
- ehnto 7y ago> The reason I still use autocomplete is not that I need my IDE to tell me that there’s an ‘empty’ method there as if that’s something I don’t already know, but to tell me that my assumption that ‘myVector’ has an ‘empty’ method is correct! Exactly, autocomplete is an excellent discovery tool. I may not even be aware productModel->hasConfigurableOptions was a function, or Product\Model\Configurable\Options was a model until I check with autocompletes.
- bradstewart 7y agoThis. I find it's even more valuable with the explosion of 3rd-party libraries and packages--I'm constantly interfacing with code I didn't write, and autocomplete is _way_ faster than context switching to look at the docs/source of a library.
- jonhohle 7y agoYeah, really! Who would want to read the docs of a library!?
- scarface74 7y agoSo let me introduce you to Boto3.... https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/index.html https://boto3.amazonaws.com/v1/documentation/api/latest/refe...
- bradstewart 7y agoI always read the docs first. And then usually skim the source code (when available). But that doesn't mean I've memorized every method name and signature.
- omaranto 7y agoI think you meant to ask who would want to memorize the docs and never ever need confirmation they are remembering correctly?
- aratakareigen 7y agoInteresting, but why not just have the autocomplete as a pane on the side so that you can focus, in the 99% case where you do have a good grasp of your dependencies?
- bradstewart 7y agoThat would certainly be a viable middle ground, but I simply don't find the in-editor popup to be distracting. I find a good many things distracting while working, but I actually like the autocomplete popups.
- bo1024 7y agoIt sounds like you're using autocomplete as a substitute for a tool you'd like, but doesn't exist.
- thedirt0115 7y agoOk, I'm curious! What might such a tool look like or do? Did you have something specific in mind?
- cdo256 7y agoI could imagine two tools: 1. A tool that parses the text and draws red underlines on all the errors, this exists but (at least for C++ in VS 2017) it is quite slow. 2. A tool that automatically populates and updates types of variables and functions. Both of these could be achieved by somehow decoupling the front-end (as in before semantic analysis) of compilers and making them output the AST in some standardized tree-structured format like XML.
- dr_baba 7y agoDoesn’t the Language Server Protocol already do this, just via JSON instead of XML? I believe at least some LSP backends (e.g. clangd) just reuse a compiler AST and feed the data to your editor?
- ses1984 7y agoYes: what I really want is an autocomplete wired directly into my brain. Then I just have to intend to start working and my code writes itself, without having to lift a finger.
- lubujackson 7y agoWelcome to the management track!
- pushpop 7y agoShouldn’t the fact he’s using it and likes it be proof it exists and not a substitute tool? In addition to his workflow, I want to add that I really appreciate having the parameters and types displayed when calling a function or method. Sometimes it’s unavoidable asking yourself questions like “which way round are those arguments?” or “is that a signed/unsigned integer?” Sure you can look at the code behind the function you want to call but having the IDE prompt that saves you navigating away from the code you’re currently writing. That’s a massive win for me. Particularly for projects that require less active development
- intrepidhero 7y agoVB6 had a feature where if you typed a previously defined name with the incorrect case it would autocorrect it for you. I used to type my identifiers with purposely incorrect casing so that the autoformatter would confirm that I had selected the correct variable or method name. I really liked that feedback. Not that I'm saying that was a great workflow. But I liked the subtle feedback as I typed. I've also used autocompleters in the fashion you describe. Syntax highlighting can also provide this kind of feedback and I feel like these tools could probably morph into a single, more cohesive tool that provides a smoother experience than the pop-up window.
- kall 7y agoI rely on prettier (AST based JS+ formatter) in the same way. I intentionally add to little or too much space to get subtle feedback on if there is a syntax error in my (deeply nested) code.
- gfunk911 7y agoI do the exact same thing with Prettier. I get a little spark of joy every time my code snaps back into place :)
- deleted 7y ago[deleted]