zig
zig copied to clipboard
feat: prettify compile log output
Before
The "Compile Log Output" currently looks very plain and unconnected to the pretty messages before it with all the colors and stuff. The purpose of this PR is to make it look prettier and more connected to what's before it and it's also supposed to make the values easier to read if you have many values in a single line separated by commas.
Currently it kinda blends in with the error: x...
stuff below that no one reads so that's not very good.
After
In addition to the previous one,
- It dims the dashes and the commas and makes the values bold.
- It uses cyan to make the compile log output stick out further. Currently cyan seems to be used only for
note:
s but I think the compile log output is similar. They're also notes that you wrote during comptime. Another reason I think cyan makes sense is that@compileError
is "worse" and it uses red and then@compileLog
is not as bad and uses cyan, if you know what I mean.
This may not look complicated but it's significantly more complicated to do because color is not available in Sema
. The way I do this is I concatenate the strings in Sema
and use unprintable characters as terminators and then in main
I mem.split
comp.getCompileLogText()
and add color. This is supposed to avoid using an unnecessarily complicated structure like a ArrayListUnmanaged(ArrayListUnmanaged(u8))
or something.
In regards to distinguishing multiple values in one line, this is probably a lot better.
So currently this is version 2. If people don't like it (I like it), we can go with version 1 and remove the second commit.
I simplified the PR and made it mergeable again.
Here is once more what this looks like:
I heard @compileLog
is going to change again anyway so it may be a bit premature to focus on styling its output yet, but I guess this is just for the meantime. I'm not sure. So otherwise feel free to close this too.
is it a good idea, is it a bad idea? I don't know, maybe the plain text is better. It seems kind of unimportant to me right now. Closing to focus on other things.