microsoft / vscode

Visual Studio Code
https://code.visualstudio.com
MIT License
163.71k stars 29.08k forks source link

Tasks echoCommand does not show command in Terminal #22377

Closed wgj closed 7 years ago

wgj commented 7 years ago

When using echoCommand in tasks.json, the command isn't echoed in the Integrated Terminal.

harmlessunhappyfeline

Steps to Reproduce:

  1. Run Task "echoTest" with echoCommand.
      {
            "taskName": "echoTest",
            "command": "echo",
            "isShellCommand": true,
            "args": ["Hello World"],
            "showOutput": "always",
            "echoCommand": true
        }
  2. Observe that output to Integrated Terminal does not prepend the underlying command of Task "echoTest" per documentation.
Tyriar commented 7 years ago

@dbaeumer is this as designed under tasks v2?

dbaeumer commented 7 years ago

@Tyriar yes and no. I simply couldn't find a way to print something to the terminal. The command itself is started with the runTerminal and therefore it is not printed. Would it be possible for the terminal to echon that if I asked it to do so.

Tyriar commented 7 years ago

@dbaeumer it's not possible now, would this make sense as a member on IShellLaunchConfig that is parsed and written to the terminal front end before the process starts (including escape sequences)?

dbaeumer commented 7 years ago

Yes, would make perfect sense on IShellLaunchConfig

Tyriar commented 7 years ago

I added IShellLaunchConfig.initialText which you can set with escape sequences so you can style if you wish. Tested by setting: _shellLaunchConfig.initialText = 'abc foo \x1b[33mbar\x1b[0m adsa';, here's the result:

image

Note my prompt has an empty line at the start so only the first line was added. See comment in https://github.com/Microsoft/vscode/commit/848157095a77ac6a5baac0d0aa6ffecf4f65920a for more usage details.

Passing to you @dbaeumer :smiley:

wgj commented 7 years ago

Hey everyone,

I think we may have missed the usecase on this one. I have many tasks defined in tasks.json, and when I run them, I'd like visual feedback on what command, with which parameters, was ran.

8481570 appears to prepend a hardcoded string to every shell instance, without a reference to a given task (as in tasks.command and tasks.argsfrom tasks.json)

dbaeumer commented 7 years ago

@wgi this needs adoption in the task framework this is why I opened #22655

wgj commented 7 years ago

Alright :)

I don't understand the process, and I had a mild panic when I saw this issue had been closed. Thank you.