[clang] [clang][Diagnostics] Highlight code snippets (PR #66514)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Sep 20 08:18:32 PDT 2023


Timm =?utf-8?q?Bäder?= <tbaeder at redhat.com>
Message-ID:
In-Reply-To: <llvm/llvm-project/pull/66514/clang at github.com>


erichkeane wrote:

> > This is a really great idea! I like the direction this is going! I think we need to find some way to get the source colors/have them be configurable. Is there some sort of 'source' of terminal coloring that we could use? Or a theme of some sort?
> > At minimum, we need to let these colors be configurable in some way. Is there some sort of prior art in another tool we can copy from?
> 
> Most terminal will let you remap the color escape sequences to something else, IE "white" might become black in a dark theme. Nothing per-application.

I'm thinking something like `LS_COLORS` or `GREP_COLOR`, or `PS1`, all of which are color config options (1st is for `ls`, 2nd is for `GREP`, and 3rd is terminal overall.  But I guess whatever we do for our 'error' 'warning' and 'note' colors we can work with.  Obviously 'black' is a terribad idea since most terminals are black, but reasonable defaults are ok to me (perhaps we can steal a color scheme from a vim theme or something).

> 
> Trying to come up with a way to do that in clang does seems out of scope to me. After all we don't do it for warning. it would be hilarious if we did do support one of the scheme that exist for IDE configurations though. But if we were motivated enough to do that we should also do it for existing colors (ie, warning, etc).

Yeah, perhaps.  If we didn't support customization, stealing colors from an existing 'dark' theme'ed IDE is not a terrible idea.  
 
> > Additionally, this needs to be disabled/disable-able via a command line switch eventually (as we do for our other coloring). It should perhaps be a separate disable switch from how we highlight 'error' or 'warning', but enabled at the same time?
> 
> Agreed
> 
> > WDYT?



https://github.com/llvm/llvm-project/pull/66514


More information about the cfe-commits mailing list