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

Allow leading indentation for queries #56

Open
pcmantz opened this issue Oct 30, 2024 · 0 comments
Open

Allow leading indentation for queries #56

pcmantz opened this issue Oct 30, 2024 · 0 comments

Comments

@pcmantz
Copy link

pcmantz commented Oct 30, 2024

It is common in editors to highlight a specific line or region of code, pass it through a formatter, and replace the highlighted region with the output of the formatter. If sqlformat-rs can support preserving the leading indentation of an expression, then it'd be possible to format nested subsections of a larger block of code without touching the rest of the file. This would make it easier to edit SQL where there are structural elements that sqlformat-rs doesn't support as well.

I am a pretty new rust programmer, but it looks like implementing this would involve adding a preserve_indent flag to FormatOptions, have the parser read in the amount of whitespace on the first line, and call increase_top_level with the right amount of indentation when reading the first line. Would that be correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant