-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add syntax highlight to datafusion-cli #8918
Conversation
The current implementation is not the best. If the input string is invalid, e.g., unterminated: I am happy to go down that path too. Let me know :) On that note, can we add |
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 really love this one, thanks @trungda
I checked it in the codespace, it has some bugs mostly on when you type a key word and then press left arrow.
Thanks for the feedback @comphead . What is your terminal setup? I am not able to repro yet. The current approach is to take the whole input string and tokenize the input as a whole, the arrow keys shouldn't matter. |
Awesome feature! Thanks, @trungda 👍 . I am wondering if could make the default color lighter because the current version is hard to track. Maybe you could consider the DuckDB setting. |
That would be great -- thank you @trungda (this is somewhat related); apache/datafusion-sqlparser-rs#1094
The reason it is not part of the workspace is that as This is not clear I will add it to the README BTW what I do is to "open" the Update: #8938 |
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.
Thank you @trungda -- I tried this out and it was great.
Once CI passes I think we could merge it.
In terms of changing the default colors / improving the highlighting, it would be great to improve this PR but also I think we can iterate in the future as well
Another feature that would be neat would be a CLI flag to enable/disable the highlighting so people who find the color scheme not to their liking could turn it off
Thanks @alamb ! I've updated the license + changed the color to be lighter as suggested.
This is great! I'll look into that. It'd be easier if somehow we know the position in the original string where the tokernization fails just so we can just copy from that position to the highlighted string.
Sounds great! Let me look into that after this PR. |
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.
LGTM! Thanks @trungda
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.
LGTM thanks @trungda We can fix highlighting in following PRs
Which issue does this PR close?
#8701
Rationale for this change
More user-friendly and readability when using
datafusion-cli
.What changes are included in this PR?
Add SQL syntax highlighting capability for
datafusion-cli
:SyntaxHighlighter
.Are these changes tested?
Are there any user-facing changes?
Users of datafusion-cli.