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.
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.
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.
Especially since I'm working in proprietary niche language, it would be so great to have my own code to be the corpus of the model.
It could be so easy: stuff your codebase into a model generator and out comes some sensible autocomplete. Well, at least I hope we will see something like this soon.
I think it used to be kind of usable also in VB6 also, at least that is how I remember it.
Golang and Typescript seems to have good support too now.
But for just the thing you mention above you could go a long way with live templates or what it is called in different IDEs, or just text templates with variables like the Rails guys used to use in their demos.
It's a relatively new feature - within the last year I think.