leave formatting to sqlfmt rather than processing sqlfmt diff output #315
Unanswered
ozgenbaris1
asked this question in
General
Replies: 1 comment 6 replies
-
Does this only happen if you save very quickly? I think you can just enable autosave in vscode as well, I don't remember having this issue. Applying the diff is how formatters should work in vscode. See https://code.visualstudio.com/blogs/2016/11/15/formatters-best-practices |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello!
I have a bad habit of saving files by pressing ctrl + s rapidly. When I do that, formatting behaves weirdly. Some lines are swapped, some of the lines are deleted etc.
I suppose it is because of processing the
sqlfmt --diff
output manually here. Is there a specific reason for choosing this approach rather than not directly runningsqlfmt <file>
and leaving the formatting job to sqlfmt itself?For further details, I have a simple sql file as below:
When I run the command
sqlfmt ./foo.sql
here is the formatted file:However, if I save the file and leave the formatting to the extension itself. Here is the result:
I don't know if it's a bug. I'd appreciate your answers.
Beta Was this translation helpful? Give feedback.
All reactions