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

Make default color mapping support OSX Clang #23

Open
kavika13 opened this issue Aug 16, 2016 · 6 comments
Open

Make default color mapping support OSX Clang #23

kavika13 opened this issue Aug 16, 2016 · 6 comments

Comments

@kavika13
Copy link

kavika13 commented Aug 16, 2016

Clang on OSX outputs escape sequences that look like this:

<ESC>[0;1;31m

I don't know escape sequences well enough to know if clang is just flat out wrong, or if it is expecting more complete ANSI support. Either way, the default settings only match color escape sequences with two values.

Here's a mapping that seemed to work for me:

{"scope": "black", "code": "\\x1b\\[(0;(0;)?)?30m", "color": "#000000"},
{"scope": "black_light", "code": "\\x1b\\[(0;)?1;30m", "color": "#686868"},
{"scope": "red", "code": "\\x1b\\[(0;(0;)?)?31m", "color": "#c71e12"},
{"scope": "red_light", "code": "\\x1b\\[(0;)?1;31m", "color": "#ff6f6b"},
{"scope": "green", "code": "\\x1b\\[(0;(0;)?)?32m", "color": "#00c120"},
{"scope": "green_light", "code": "\\x1b\\[(0;)?1;32m", "color": "#67f86f"},
{"scope": "yellow", "code": "\\x1b\\[(0;(0;)?)?33m", "color": "#c7c327"},
{"scope": "yellow_light", "code": "\\x1b\\[(0;)?1;33m", "color": "#fffa72"},
{"scope": "blue", "code": "\\x1b\\[(0;(0;)?)?34m", "color": "#0a2fc4"},
{"scope": "blue_light", "code": "\\x1b\\[(0;)?1;34m", "color": "#6a76fc"},
{"scope": "magenta", "code": "\\x1b\\[(0;(0;)?)?35m", "color": "#c839c5"},
{"scope": "magenta_light", "code": "\\x1b\\[(0;)?1;35m", "color": "#ff7cfd"},
{"scope": "cyan", "code": "\\x1b\\[(0;(0;)?)?36m", "color": "#01c5c6"},
{"scope": "cyan_light", "code": "\\x1b\\[(0;)?1;36m", "color": "#68fdfe"},
{"scope": "white", "code": "\\x1b\\[(0;(0;)?)?(37)?m", "color": "#c7c7c7"},
{"scope": "white_light", "code": "\\x1b\\[(0;)?1;37m", "color": "#ffffff"},
{"scope": "_bold", "code": "\\x1b\\[(0;(0;)?)?1m", "color": "#ffffff", "font_style": "bold"}
@kavika13
Copy link
Author

This file is not perfect though :) I think it has problems with bold/unbold. I can upload a sample clang output if that is useful.

@PurplePowder
Copy link

If someone is interested, I made a fork without regular expressions but with a really simple ANSI parser. It solves problem with clang output. You can find it here https://github.com/PurplePowder/SublimeANSI

@kavika13
Copy link
Author

kavika13 commented Aug 19, 2016

It works pretty well out of the box. This also looks like way less of a headache to understand and configure.

I had user settings already, and it puked on them, even if I emptied the file and saved it. Is there something you can do to make error recovery on a bad user (not default) settings file slightly better? It seems to default to an "all grey" theme when it dies on user configuration, instead of falling back.

Of course, once I copied the default settings to the user settings path it worked :)

I have about 3 feature requests now, but I think it makes more sense to focus on verifying if your branch is stable before worrying about that.

@PurplePowder
Copy link

PurplePowder commented Aug 19, 2016

I had user settings already, and it puked on them, even if I emptied the file and saved it. Is there something you can do to make error recovery on a bad user (not default) settings file slightly better?

Fixed. Now when plugin founds out that some required color isn't described in settings, it simply doesn't colorize it, so default color is used

@heyer2
Copy link

heyer2 commented Jul 15, 2020

This is still an issue.

@jfcherng
Copy link
Collaborator

You can file a PR or use https://packagecontrol.io/packages/Terminus instead nowadays.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants