4 ms·
To do this in a way that’s actually useful is hard. Microsoft has had Intellisense, JetBrains have autocomplete in Intellij and other products. Both have big te
by danpalmer 4y ago
To do this in a way that’s actually useful is hard. Microsoft has had Intellisense, JetBrains have autocomplete in Intellij and other products. Both have big teams and decades of work put into them, and still and great, hence the ML approach being tried now.
- amelius 4y agoIs it really that difficult? If I type app.get('/', then looking for literal occurrences and presenting me a menu of all the literal completions I have used before (no ML required at all) would already be a huge win.
- danpalmer 4y agoWhat if it's not called `app` – in larger codebases there's often a layer of indirection with different naming. What if it's not indented the same amount, is it the same? What if it's not a GET, but a POST? Both use the req/res handlers so you'd want the prediction for both. What if it's not for the path /, but for some other path. As you can only have one handler for the root, most handlers will be for different paths. Maybe you can write these edge cases in for the Express situation and get req/res prediction, but that's a bunch of work to automate ~10 characters and it only works for this specific use-case. It doesn't work for any other languages, frameworks, libraries, or use-cases. There are 2 ways to do this well: 1) static analysis of code to understand what is allowed to come next, and predicting based on that (Intellij, Intellisense, etc) or 2) ML or statistical analysis to determine what's likely to come next without knowing much about the rules (Copilot, Tabnine, Intellicode). Both of these approaches are hard to do right, but have a high pay off.
- bsima 4y agoEmacs and vim do this out of the box
- sneak 4y agoVim does not do this "out of the box".
- bbkane 4y agoIt does it on the "word" level: https://stackoverflow.com/a/52635099/2958070 https://stackoverflow.com/a/52635099/2958070
- amelius 4y agoYes, I use this a lot. One problem though is that sometimes I have a sub-folder with lots of (unrelated) files and Vim starts searching it, thereby basically hanging the editor without a possibility to stop the operation.