Hacker News new | ask | show | jobs
by jordache 2233 days ago
> I imported a new logging mechanism and called a specific method from it in one of my class's methods. Repeat for four similar classes.

How would an IDE know the local variable you've declared, that is a suitable match to the logging method's parameter?

1 comments

How indeed. I think basically a rudimentary version might guess and then ask you if its mapping is right.

i.e. a modal asking:

"As done to MethodA, do to MethodB?" "As done to VariableNameA, do to VariableNameB?"

And the B values would just be dropdowns that would let you correct it. Idk.

I'm just imagining what you could do with some decent speech-to-text, NLP, and an engine that understands code conceptually on a basic level.

"Create a new enum on line 14 called SuchAndSuchCategories, with the values A, B, and C. Replace the string literal on line 27 with SuchAndSuchCategories.B."

"Move method A above method B."

"Add a new method to class X called doSomething() that accepts three parameters: a string called A, a generic called B, and a SomethingClass called C. Inside the method, start a for-loop...."

Like, idk. These aren't repeat-after-me tasks but they're complimentary to them. It would just be great to be able to just talk code into existence.

>"As done to MethodA, do to MethodB?"

Don't know about you, I would have no idea of a method name's exact spelling from a declaration multiple folders and files away.

Well, I mean you wouldn't really need to know the spelling. It would be picking the methods from the code, having parsed it. There would be no spelling involved. It's just a matter of it checking that its target is correct-- "Is this the one you wanted to change?" And if the dev doesn't know the answer to that, then they couldn't have made the change without the tool, either.