Skip to content
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

stubborn merge segment after a singleton operator #203

Closed
Tracked by #210
tconbeer opened this issue Jul 14, 2022 · 5 comments
Closed
Tracked by #210

stubborn merge segment after a singleton operator #203

tconbeer opened this issue Jul 14, 2022 · 5 comments
Labels
bug Something isn't working

Comments

@tconbeer
Copy link
Owner

Describe the bug
If an operator ends up on a line by itself (after splitting), we don't try hard enough to merge the segment after that operator into the operator's line, which can result in ugly output (for somewhat pathological input)

To Reproduce
From gitlab's project:

{{column|lower}} || 
ENCRYPT_RAW(
    to_binary('{{ get_salt(column|lower) }}', 'utf-8'), 
    to_binary('{{ env_var("SALT_PASSWORD") }}', 'HEX'), 
    to_binary('416C736F4E637265FFFFFFAB', 'HEX')
)

Expected behavior

{{ column | lower }} || encrypt_raw(
    to_binary('{{ get_salt(column|lower) }}', 'utf-8'),
    to_binary('{{ env_var("SALT_PASSWORD") }}', 'HEX'),
    to_binary('416C736F4E637265FFFFFFAB', 'HEX')
)

Actual behavior

{{ column | lower }} ||
encrypt_raw(
    to_binary('{{ get_salt(column|lower) }}', 'utf-8'),
    to_binary('{{ env_var("SALT_PASSWORD") }}', 'HEX'),
    to_binary('416C736F4E637265FFFFFFAB', 'HEX')
)

Additional context
What is the output of sqlfmt --version?
Commit 88617d2 (v0.10)

@tconbeer tconbeer added the bug Something isn't working label Jul 14, 2022
@tconbeer
Copy link
Owner Author

@tconbeer
Copy link
Owner Author

closed by fd66993

@tconbeer
Copy link
Owner Author

closed in #210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant