-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Description
This is like half a showerthought.
Probably refer to
- Feature Request - Scripts Panel #1595
Add action to bring up a Cmd Palette with justsendInputactions #12862 sendInputshould be previewable #12861
What if sendInput could have like, a ${prompt} section in it, that then had the terminal prompt you to complete that section before actually doing the whole sendInput? So you could have like (for trivial example):
"command":
{
"action": "sendInput",
"input": "git checkout ${prompt}"
},Okay now hear me out for where we get extra crazy.
Crazy idea A
You can label these sections, and we'd fill in subsequent ones if you fill in the first:
"command":
{
"action": "sendInput",
"input": "git checkout ${prompt branch} & echo 'switched to branch ${prompt branch}'"
},This part is definitely inspired by macros in Sublime Text, where I know you can label individual bits as being the same thing.
Crazy idea B
We annotate these sections, and try to provide intelligent completions for them. Like say
"command":
{
"action": "sendInput",
"input": "robocopy ${prompt source:dir} ${prompt target:dir} /mir"
},So when we see :dir, we know that we're supposed to autofill a path into there. That could even be tied into the shell location (OSC9;9) to provide context-sensitive completion.
Crazy idea C
Building on B, what if apps could provide their own completions to us?
addenda
- Are these not basically just shell aliases?
- Would this not just make more sense as a shell feature? The shell already knows things about where the CWD is. It can do directories and stuff. Maybe it makes more sense to just let WT conveniently manage your aliases for different shells?
- Obviously CMD is terrible so it'll never get anything like this.
- Could we make them CWD-specific? Like, context sensitive?
Crazy idea D
basically like C, but more scriptable?
I propose to extend sendInput command (#3799) . At present, it allows to pass
Stringinput, which should be displayed on the terminal. I want to execute a code and display the result, instead of static text.For example, I want to insert a current
gitbranch to the current terminal cursor position. I can get the name with helpgit rev-parse --abbrev-ref HEAD. So, I would like to have the following hotkey in the terminal:{ "command": { "action": "sendInput", "input": $(git rev-parse --abbrev-ref HEAD), or ./get-branch-name.exe }, "keys": "ctrl+k" }At present, I cannot do it, because
inputaccepts only strings. There are a few workarounds, like,"input": "git rev-parse --abbrev-ref HEAD| Set-Clipboard\r, but they don't allow to insert needed input in place.
Crazy idea E
What if it was just the .vscode/tasks.json syntax?