-
Notifications
You must be signed in to change notification settings - Fork 228
feat: Highlight in prqlc #4755
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
feat: Highlight in prqlc #4755
Conversation
Very cool! I will look tomorrow more. We could instead instead enable this by default for |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is great! Nice work!
Can you push a version with a test? If the color stuff breaks then I will take a look and try to fix; but we do need a test.
I added some notes — let's have the linewrap passing. The TODO you don't need to do now, but let's leave it in the code for the future.
Something we could do is run this automatically on the output of prqlc fmt
, rather than have this behind the experimental option. We could even add a --no-fmt
option there which only does highlighting.
Co-authored-by: Maximilian Roos <[email protected]>
@vanillajonathan this is really nice, for example: ![]() I refactored some related code (maybe I should have done it in a separate PR, sorry to use yours...). Take a look at the changes and then hit the button if you're happy |
Do want it to still reside under The changes look fine. I think you should merge it! |
Let's merge now as experimental and then we can refactor in into
Yes, another advantage of merging with I'll hit the button now. If you want to add a Changelog as a separate PR that would be nice, so people know about it |
This PR adds a command called
highlight
(underexperimental
) toprqlc
which does syntax highlighting on the terminal.Example:
It works pretty good but single quotes becomes double quotes because that's what the lexer does.
I couldn't get the test to work because somehow it still includes the ANSI escape sequences even though the test sets the environment variable
NO_COLOR
and passes in the--color=never
argument. It shows a diff between what is returned and what is expected that is identical.Later maybe we can use this in
prqlc compile
too.