Thread overview
Does Visual D support colorization output?
Sep 01, 2017
EntangledQuanta
Sep 01, 2017
Rainer Schuetze
Sep 01, 2017
EntangledQuanta
September 01, 2017
I do not get any colorized output from the new dmd. I'm curious if it is on my end or if visual D/visual studio needs to support this?

Also, Visual Studio doesn't allow capturing of the console output and for programs that terminate quickly(due to an error, say), it is difficult to know what happened. Is it possible for Visual D to capture the standard output and error output and dump it to a window? The output window or intermediate window would be nice.

Thanks.

September 01, 2017

On 01.09.2017 05:14, EntangledQuanta wrote:
> I do not get any colorized output from the new dmd. I'm curious if it is on my end or if visual D/visual studio needs to support this?

Visual D needs to redirect the compiler output to display it in the output window, and dmd disables colorization output in that case (you would end up with control codes when redirecting into a text file otherwise). So I don't think it's possible ATM (I'm unsure if VS supports this in the output window to begin with).

> 
> Also, Visual Studio doesn't allow capturing of the console output and for programs that terminate quickly(due to an error, say), it is difficult to know what happened. Is it possible for Visual D to capture the standard output and error output and dump it to a window? The output window or intermediate window would be nice.

If you don't run it via the debugger, you can enable "Pause when program finishes" on the "Debugging" options page.

There is also "Redirect stdout to output window" for the VS debug engines, but it doesn't seem to work anymore (just tried in VS2015). I suspect that happened when VS switched to a new debug engine.

You could still set a breakpoint at the end of main (for the usual exit) and enable "break when exception is thrown" (see bottom of http://rainers.github.io/visuald/visuald/Debugging.html)
September 01, 2017
On Friday, 1 September 2017 at 08:19:43 UTC, Rainer Schuetze wrote:
>
>
> On 01.09.2017 05:14, EntangledQuanta wrote:
>> I do not get any colorized output from the new dmd. I'm curious if it is on my end or if visual D/visual studio needs to support this?
>
> Visual D needs to redirect the compiler output to display it in the output window, and dmd disables colorization output in that case (you would end up with control codes when redirecting into a text file otherwise). So I don't think it's possible ATM (I'm unsure if VS supports this in the output window to begin with).
>

Yes, dmd disables coloring when not attached to an interactive terminal, however there shouldn't be any control codes on Windows, as dmd uses the Win32 Conosole API: https://github.com/dlang/dmd/blob/v2.076.0-rc1/src/ddmd/console.d#L122 so yes, there's no way to get colored error messages outside of the console on Windows.
September 01, 2017
On Friday, 1 September 2017 at 08:19:43 UTC, Rainer Schuetze wrote:
>
>
> On 01.09.2017 05:14, EntangledQuanta wrote:
>> I do not get any colorized output from the new dmd. I'm curious if it is on my end or if visual D/visual studio needs to support this?
>
> Visual D needs to redirect the compiler output to display it in the output window, and dmd disables colorization output in that case (you would end up with control codes when redirecting into a text file otherwise). So I don't think it's possible ATM (I'm unsure if VS supports this in the output window to begin with).

Could a simple proxy wrapper not be used that captures the output and redirects it to a new window or even to the output window by recolorizing it? The output window does support colors because there are visual studio extensions that colorize it in a generic way.

It might just be the color syntax needs to be translated to what visual studio supports?

I guess the question is, how does Visual D capture the output? Does it do something like a redirection or something more complex? If not, maybe there could be a switch that prevents dmd from disabling the color disabling so it will work? Sometimes you might want the color info in a text file so that when you dump it back to the console you get colored output.



>> 
>> Also, Visual Studio doesn't allow capturing of the console output and for programs that terminate quickly(due to an error, say), it is difficult to know what happened. Is it possible for Visual D to capture the standard output and error output and dump it to a window? The output window or intermediate window would be nice.
>
> If you don't run it via the debugger, you can enable "Pause when program finishes" on the "Debugging" options page.
>
> There is also "Redirect stdout to output window" for the VS debug engines, but it doesn't seem to work anymore (just tried in VS2015). I suspect that happened when VS switched to a new debug engine.
>
> You could still set a breakpoint at the end of main (for the usual exit) and enable "break when exception is thrown" (see bottom of http://rainers.github.io/visuald/visuald/Debugging.html)

Sometimes when the program segfaults it just abruptly exists without any exceptions and such.