by ninkendo · 4y ago · 0 comments
This gives me an idea: somebody should make an inverse intellisense that lets you type as if a function exists that you haven’t created yet, and instead of using a bunch of red squigglies and making you feel like a fool for typing broken code, offers you a shortcut to create the code that doesn’t exist yet.
Bonus points if it uses the language’s type inference to inform what to create, like:
String s = foo.bar(someInt);
Would offer a quick way to make the stub: // (class of foo)
String bar(int someInt) {
// TODO
}
There’s probably tons of ways to make this super ergonomic too, maybe with an easy keyboard shortcut (maybe if ctrl+space triggers intellisense, ctrl+enter could trigger the “make stub” functionality) and could work quickly and with no fuss. The method just gets added in the background, you don’t even see it, you just get to keep typing out your train of thought.This could be extended to more than just methods, but whole classes/structs/etc.
I know IDE’s have lots of affordances for creating new code from templates/quick actions, but there would be something magical about being able to just type out your mental model at the current abstraction layer, all at once without distraction, and have the IDE better help you “make real” the code you just referenced.
The tweaking of allowing possible results in the dropdown is a very very interesting idea - imagine if you let copilot suggest possible methods based on the domain context of the current project.
I haven’t used VS in over 10 years - what does “at the class level” mean? Does it only create stubs for the current class, or any class that’s in the current project?
It is interesting that VS has this at all though, as a daily Xcode user I’m jealous. Especially because ObjC and Swift have first class (and popular) ways to add methods to classes you don’t own via extensions… the concept of adding new methods automatically as you type is even more attractive in this ecosystem.
https://www.jetbrains.com/help/resharper/Code_Generation__Ge...
It's been a hot minute since I used it, but it really is exceptional.
The Haskell Language Server allows this. On the other hand, its autocomplete doesn’t seem to work so well yet (at least on Emacs), so I guess it’s not really comparable.