Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

task runner output doesnt show color for gulp taks with --color switch arg #243

Closed
mlakmal opened this issue Nov 19, 2015 · 51 comments
Closed
Labels
feature-request Request for new features or functionality tasks Task system issues
Milestone

Comments

@mlakmal
Copy link

mlakmal commented Nov 19, 2015

It is important to have color on the task output window to identify errors and success messagess in jasmine/karms test runner through gulp command. without this it is very hard to troubleshoot your unit test issues and identify issues in the code.

@bpasero bpasero self-assigned this Nov 19, 2015
@bpasero
Copy link
Member

bpasero commented Nov 19, 2015

The output control in VS code does not support colors at the moment.

@bpasero bpasero added the feature-request Request for new features or functionality label Nov 19, 2015
@supersonicclay
Copy link

+1

@thojansen
Copy link

+1

6 similar comments
@dzearing
Copy link
Member

dzearing commented Mar 6, 2016

+1

@JonnyFox
Copy link

+1

@evisong
Copy link

evisong commented Apr 14, 2016

+1

@hipstersmoothie
Copy link

hipstersmoothie commented Apr 15, 2016

+1

@vshabelnyk
Copy link

+1

@roryprimrose
Copy link

+1

@felixfbecker
Copy link
Contributor

The VS Code integrated terminal already supports colors in the insider preview. Why not the tasks output / debugger console?

@JonnyFox
Copy link

JonnyFox commented Jun 3, 2016

+1

@nojvek
Copy link
Contributor

nojvek commented Jun 9, 2016

I believe VSCode should have an option in tasks definition whether output should appear in terminal or just normal output window

@felixfbecker
Copy link
Contributor

Actually, I just found out that the debug console supports colors too. It's only the tasks.

@madskristensen
Copy link
Contributor

It would be very helpful if task console output is colorized in the Tasks window just like it is in the Terminal (ctrl+`) window.

@theDiverDK
Copy link

+1

1 similar comment
@Van-Dame
Copy link

+1

@felixfbecker
Copy link
Contributor

Guys there are now buttons for upvoting, please don't comment +1 anymore, it doesn't add any value to the discussion but creates a notification for everyone participating and clutters the thread
image

@nojvek
Copy link
Contributor

nojvek commented Jun 14, 2016

If someone could give me guidance on where to look, I could send a PR for
this. I want this bad for a demo.

@jaime-olivares
Copy link

@nojvek, you just need to open a project and run the build (Ctrl-Shift-B or Ctrl-Command-Build). The 'Output' window will appear in the bottom of the window, showing the 'Tasks' output, similar to Visual Studio's 'Build' output. See sample screenshot here: https://code.visualstudio.com/images/tasks_problemmatcher.png
In that window, it is not possible to see colored text, as it is possible in a VS Code terminal window, which has coloring capability.
Without coloring capability, it is really hard to read the output of multiple tasks/tools, specially when trying to identify error messages.

@jaime-olivares
Copy link

@triceam
Copy link

triceam commented Jul 29, 2016

We just released a language extension that brings colorization to the Output panel. Basically, it is a language extension that adds the text/x-code-output mime type, which is used by the Output panel.

Get it here: https://marketplace.visualstudio.com/items?itemName=IBM.output-colorizer

Source here: https://github.com/IBM-Bluemix/vscode-log-output-colorizer Please help contribute! Bugs, feature requests, contributions all welcome.

@nojvek
Copy link
Contributor

nojvek commented Jul 29, 2016

Why not just fix it in vscode? This seems like a core feature that should
be supported?

@triceam
Copy link

triceam commented Jul 29, 2016

From what I have seen, all language colorization (syntax highlighting) is done with extensions, and it appears that the developer site encourages this approach. The extension could definitely be bundled with VSCode at build time with very little effort. I'd love to see it get in there.

IE: https://code.visualstudio.com/docs/customization/colorizer

@thomasboyt
Copy link

so, poking at the internals, I see that the output window is basically treated as another editor window, with a special MIME type, which is why @triceam was able to add syntax highlighting.

Very naive question here, but let's say that hypothetically the ANSI control codes for colorization weren't removed before the output is streamed to the terminal. Could a syntax highlighter be written that actually matched on these control codes to display colors in the output? It may be easier in the end to use a proper terminal emulator to display task output, but just a thought.

@fredrikaverpil
Copy link

Until the integrated terminal supports this, I'd like to run tasks in an external terminal window. Is this possible?
I can't find anything on that in the tasks runner docs.

@felixfbecker
Copy link
Contributor

@fredrikaverpil set command to the command that starts processes in a new window on your OS, for example start on Windows, then pass in the actual command through args.

@fredrikaverpil
Copy link

Thanks! @felixfbecker

@bartlewis
Copy link

bartlewis commented Jan 24, 2017

@fredrikaverpil I Have been trying to do the same. The lack of colors in output makes tasks quite crippled.

I was able to get this working on Mac, via the following. This opens Terminal, CDs into the current workspace, and then runs an NPM command (lint in this case).

{
  "version": "0.1.0",
  "command": "osascript",
  "suppressTaskName": true,
  "tasks": [
    {
      "taskName": "Lint",
      "args": ["-e", "tell application \"Terminal\" to do script \"cd ${workspaceRoot}; npm run lint\""]
    }
  ]
}

This is not ideal, as it spawns a new Terminal window each time. Ideally I would LOVE to direct this command to the internal terminal, or just have colors in output pane.

@MystK
Copy link

MystK commented Mar 2, 2017

Is it possible to change these windows from a "Read Only Editor" type to a "Terminal" type so the ANSI control codes are supported?

@ChristianMoesl
Copy link

It is possible to run tasks in the integrated terminal by specifying "_runner": "terminal" in the tasks configuration.

@nojvek
Copy link
Contributor

nojvek commented Mar 6, 2017 via email

@osminogin
Copy link

@ChristianMoesl Great solution, thanks.

@geirsagberg
Copy link
Contributor

I am amazed by VSCode and this community... I just now today caught myself thinking how cool it would be to have colored output from tasks, so I found this issue which is well over a year old, and @ChristianMoesl's answer is only from yesterday but solves the problem in a really neat way :)

@tsu1980
Copy link

tsu1980 commented Mar 7, 2017

Release note is here.

http://code.visualstudio.com/updates/v1_9?wt.mc_id=DX_878977#_task-execution-in-terminal

@nojvek
Copy link
Contributor

nojvek commented Mar 7, 2017 via email

@andyneff
Copy link

Thanks @ChristianMoesl.

It does "work", but you either have to select the window, press space, or else it doesn't clear the output every time the task is executed. It's nice to have color output (for GCC) again, but not as smooth as the default output behavior.

@nojvek
Copy link
Contributor

nojvek commented Mar 30, 2017

_runner is still a hack. Color output should be supported in output window that understands ANSI codes. I find the problem matcher very helpful. May be VSCode shouldn't strip out ANSI codes, but parse them and send a tokenized output to watcher window rather than raw text.

@Ciantic
Copy link

Ciantic commented Jun 27, 2017

Problem with running in Terminal is that it breaks the window system, this must be done on output view.

Run on Save fork that runs in terminal for instance always opens the terminal when it runs. This has annoying side effect that the in Zen mode the terminal pops up from nowhere when I save.

@lfaoro
Copy link

lfaoro commented Jun 28, 2017

Use "runner": "terminal" directive.

{
  "version": "0.1.0",
  "runner": "terminal",

  "tasks": [
    {
      "taskName": "Run Go Code",
      "isShellCommand": true,
      "isBuildCommand": true,
      "showOutput": "always",
      "command": "go",
      "args": [
        "run", "*.go"
      ]
    }
   ]
}

image

@mscottx88
Copy link

If this is still an issue for folks, I found a workaround. Set your settings in VS Code to use the short name variant of the path to Git Bash.

"terminal.integrated.shell.windows": "C:/Progra~1/Git/bin/bash.exe"

image

@bpasero bpasero added the tasks Task system issues label Nov 11, 2017
@joggienl
Copy link

I'm curious, what is the current status of this issue and what will be done to solve it? There are some workarounds etc. in this thread, but the main question is, can we get coloured output in the output panel as well? I think this mainly goes for commands that "normally" go through the terminal but could also go through the output window.

For instance, if I run my yarn or npm commands to the output window in stead of the terminal, a line with green color is shown as following:

[32;1mindex.js

You can allow output to the output pannel through setting runInTerminal to false (for npm or yarn or even both if you like).

I have looked at the IBM plugin, the Output Colorizer. It looks nice but I think it does not do what we expect for terminal like commands. The yarn/npm commands (maybe by a package like chalk even!) are intentionally coloured. The Output Colorizer just makes assumptions on colours. Thats not the same imo.

@DavidA2014
Copy link

I have a build task that builds a C++ project using C++. I would like to color the errors reported by gcc.

I have installed the Colorizer plugin (mentioned above) and that plugin does indeed color text in the Output window. However, my build task sends its output to the Terminal window and Colorizer seems to have no effect on Terminal.

Not sure what is going on here. Has the behavior of VS Code changed this year such that task output is now sent to Terminal instead of Output?

Can Colorizer act on Terminal?

Or, is there another way of colorizing the output of Terminal?

@dbaeumer
Copy link
Member

Actually this got implemented by executing tasks in the terminal with task v2.0.0. I will close the issue since the original description is resolved. Please open separate issue if you think something is not working correctly in terms of coloring in the terminal.

@nojvek
Copy link
Contributor

nojvek commented Mar 27, 2018

@dbaeumer do tasks in terminal support problemMatcher and isBackground ?

@dbaeumer
Copy link
Member

Yes, they do.

@vscodebot vscodebot bot locked and limited conversation to collaborators May 11, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality tasks Task system issues
Projects
None yet
Development

No branches or pull requests