-
Notifications
You must be signed in to change notification settings - Fork 1
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
Format on save configuration bug #15
Comments
Hi ShaneMazur Thanks for the Issue! I need to investigate what configuration usage is in sqlfmt. |
Config discovery is dependent on the current working directory; if for some reason that isn't the project directory, you may need to add your own config for users to point to their config files. |
To confirm, the "shandy-sqlfmt.args": [
"-l 120"
], With hardcoded line length in
|
Hi, I have investigated this problem. The cause is that the VSCode extension performs formatting on temporary files. There are cases where the formatter is executed on an incomplete SQL file on the editor, and this implementation is to ensure that the file data on the editor is not lost. Is it possible to add one of the following options on the shandy-sqlfmt side?
|
sqlfmt will process stdin, so you can pipe the file through that if you want. Or you can use the Python API: format_string. I can add a config path option. |
Sorry. I missed the document. |
@yassun7010 I think a bug was introduced in this fix. Seems that you are now adding additional newlines at the end of formatted files on save. When the extension formats the code below on save it adds 2 new lines (3 lines total): select 'testing some stuff on save' as test Testing with v1.11 of your extension this was not the case 👀 Only 1 newline is added This means that using See screenshots for additional details:
|
Added process for removing the last line break, and release v0.1.13. |
Describe the bug
Formatting on save in vscode doesn't respect line length provided in
pyproject.toml
vscode
settings.json
pyproject.toml
Expected behavior
Same behaviour as when running
sqlfmt
from cliActual behavior
Uses default line length of 88 despite line length defined as 120 in toml config
Additional context
What is the output of
sqlfmt --version
?sqlfmt, version 0.24.0
What is the output of
pip list
(orpipx list
if you installed using pipx)?Cross posted here
The text was updated successfully, but these errors were encountered: