microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
94.75k stars 8.2k forks source link

Paste with promptable sections (powered by AI) #15104

Open JaiganeshKumaran opened 1 year ago

JaiganeshKumaran commented 1 year ago

Description of the new feature/enhancement

Often times, you copy commands from a website that has placeholders in it, which you are supposed to replace. Currently, on almost all terminals, you either copy the entire thing, move the cursor to where the placeholder is there and overwrite it. Or if you are like me, you copy it into Notepad, replace the placeholder with your parameter and then paste it into the terminal. Both are not very convenient.

Proposed technical implementation details (optional)

Not exactly sure how the syntax should look to distinguish placeholders from actual text, but Windows Terminal could decide one. When a string with placeholders is copied, Windows Terminal should allow you to press Tab and to simply overwrite each placeholder with a parameter you want. The way Visual Studio does small code snippets could be an inspiration.

sylveon commented 1 year ago

How would terminal detect a placeholder? There is no real standard for them, everybody does it differently.

zadjii-msft commented 1 year ago

That would basically be my question. I've seen everything -<placeholder>, {placeholder}, {{placeholder}}, heck, even just placeholder.

Sure, there could be a network effect that might result from us starting to accept one format, that wouldn't replace all the existing documentation that already exists...

Though, I wonder if there isn't some way I could plug this into #12927, more or less. Instead of sendInput with promptable sections - paste with promptable sections. I dunno, something to noodle on.

sylveon commented 1 year ago

I personally like to use $PLACEHOLDER or %PLACEHOLDER% depending on the target audience :P

asklar commented 1 year ago

this feels like either a CMD or a pwsh feature request, IOW the text mode shell, not terminal the host app.

zadjii-msft commented 1 year ago

Okay so we had some discussion about this. I think overall we agreed, yea - this is probably impossible or something that the shell should do.

But then we thought that this actually might be a place where LLMs might be valuable. This is something that you might actually be able to ask a LLM what "placeholder" text is in a string and let us prompt through it. I'm usually pretty reluctant to say "yea this is a good application for AI", but this genuinely seems like a problem that couldn't be solved without it.

That being said, it's not something we're likely to implement any time soon. I'm gonna leave this open as a possible extension idea.