-
Notifications
You must be signed in to change notification settings - Fork 30
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
Possible to provide an escape hatch for expressions? #15
Comments
@max-sixty That's a good question. I'm wondering how to handle SQL statements that don't need formatting. Should we add line breaks before and after such SQL statements, or should we also consider the preceding and following context? |
The immediate thing that would be really useful is to be able to say "between these comments, don't format the expression". Other code formatters do this, such as black's Then questions such as
...are quite minor for the user, I think (if I'm understanding your questions correctly)
I just added a comment to PRQL/prql#965 (comment). The motivating case would be to format: SELECT
*
FROM
sometable
WHERE
-- fmt: off
json:first_key.second_key = 1
-- fmt: on
AND
-- fmt: off
json:first_key.second_key = 1
-- fmt:on ...without adding a space in Thanks for responding! |
Good idea! I will try to solve this problem. |
Firstly thanks for the awesome library. We use it in https://github.com/prql/prql to format SQL once our compiler has produced it, from sqlparser-rs.
A couple of times we've wanted to not format an expression, maybe because it's not standard SQL. Here's an example that just came up: PRQL/prql#965
Do you have any thoughts for how best to manage that? We could use a sentinel and then replace it afterwards? Or would this library be open to something like a
<ignore>
tag /-- format-ignore
comment?The text was updated successfully, but these errors were encountered: