venantius / ultra

A Leiningen plugin for a superior development environment
Eclipse Public License 1.0
1.24k stars 35 forks source link

Colors not working on Windows #92

Closed bpringe closed 6 years ago

bpringe commented 6 years ago

I've been trying to use this plugin on Windows and when I add the plugin to my lein user profile and start a repl with lein repl, values are printed with the ANSI escape characters (I think this is what's happening).

image

This happens in powershell (which I use as my VSCode integrated terminal), as well as cmd. I did notice that Console Emulator does display the colors correctly. I don't know if this is an OS issue, a terminal settings issue, or an issue with Ultra (I'm thinking not). Could someone shed some light on how I might be able to allow colors in the powershell terminal?

bpringe commented 6 years ago

I just want to give a solution I just came across with some research and trial and error, in case others using VSCode have this issue. I downloaded ANSICON, then in my VSCode User Settings, I set the following values so that I could run powershell from ansicon for the integrated terminal.

"terminal.integrated.shell.windows": "C:\\Program Files\\ansi184\\x64\\ansicon.exe", // make this your path to ansicon
"terminal.integrated.shellArgs.windows": ["powershell"]

Now the color feature of Ultra works in the integrated powershell terminal in VSCode. However, is there a way to make this work by default on Windows? I'm all about making other avenues of entry for new Clojurians easier (i.e. Windows users). Thanks for the great plugin.

venantius commented 6 years ago

I'm afraid I'm pretty ignorant as to the workings of powershell or most Windows terminal options. However, the color highlighting in Ultra at the terminal level is powered by ANSI escape codes, which Windows supposedly only started supporting fairly recently.

Anyways, to be clear - this isn't an OS issue, it's a specific reader feature present in a terminal emulator that knows how to handle the relevant escape codes (which are otherwise just plain old text characters). Some terminals will support it out-of-the-box, others may require additional plugins or settings to be toggled to turn it on.

As this isn't a bug per say I'm going to close this issue since hopefully the above explanation is sufficient to point anyone having difficulty in the right direction to figuring out a relevant solution for their given terminal of choice. Feel free to comment if you (issue creator or more general future reader) are still having difficulties and I'll try to help.