-
Notifications
You must be signed in to change notification settings - Fork 1
feat: strip indentation from source code #151
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
Conversation
e80a738 to
4b7b7e6
Compare
|
I think this needs a clean rebase |
41ea1b4 to
7eab741
Compare
query/tests/integration.rs
Outdated
| #[tokio::test(flavor = "multi_thread")] | ||
| async fn test_strip_indentation_empty_lines_not_indented() { | ||
| let query = r#" | ||
| CREATE FUNCTION add_one() |
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.
The fact that the empty line is indented or not is impossible to see in this diff. I suggest that for the indentation tests you don't use multi-line strings but rather an array like this:
let query = &[
"CREATE FUNCTION add_one()",
// or
" CREATE FUNCTION add_one()",
...
// this is an non-indended empty line:
"",
// and this one would be indended:
" ",
];
query/src/format/mod.rs
Outdated
| } | ||
|
|
||
| /// Default implementation that returns code unchanged | ||
| #[derive(Debug, Clone, Copy)] |
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.
For both it probably also makes sense to derive Default
6280c11 to
250ee6a
Compare
Closes #141
This creates a
UdfCodeFormattertrait that allows us to format UDF code how we see fit before compiling it. AStripIndentationFormatterimplementation is also provided that strips indentation from source code.