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

Disable the default SQL formatter #1323

Closed
azdanov opened this issue Jan 18, 2025 · 8 comments · Fixed by #1336
Closed

Disable the default SQL formatter #1323

azdanov opened this issue Jan 18, 2025 · 8 comments · Fixed by #1336
Labels
enhancement New feature or request

Comments

@azdanov
Copy link
Contributor

azdanov commented Jan 18, 2025

Is your feature related to a problem?

Should the default formatting be disabled for the SQL pack?

It uses sqls, which hasn't been maintained for a while, and there is an ongoing issue that causes some SQL statements to be broken by the formatter: sqls-server/sqls#149

Describe the new feature

Either update the readme and add an example of how to disable the formatting, leaving a warning note that this issue occurs, or disable the formatting by default in the SQL pack.

An alternative would be to find a replacement formatter.

Additional context

In the comments of the sqls, someone mentioned https://github.com/nrempel/sleek for formatting, but I couldn't find it in Mason.

@azdanov azdanov added the enhancement New feature or request label Jan 18, 2025
@azdanov
Copy link
Contributor Author

azdanov commented Jan 18, 2025

There are also (available on Mason):

But I've never used any of them before, so don't know which one is better suited.

@Uzaaft
Copy link
Member

Uzaaft commented Jan 18, 2025

sleek also seems unmaintained.

@Uzaaft
Copy link
Member

Uzaaft commented Jan 18, 2025

The best candidate seems to be sqlfluff

@azdanov
Copy link
Contributor Author

azdanov commented Jan 19, 2025

Would it be better to create another pack just with sqlfluff and leave the current SQL pack as is (maybe mention this formatting issue in the readme)? Since sqlfluff can be used both as a linter and a formatter: https://github.com/LazyVim/LazyVim/blob/4e8d75144de92e62eb58c87f61938118d3b1e37c/lua/lazyvim/plugins/extras/lang/sql.lua#L144C1-L171C5

@Uzaaft

@Uzaaft
Copy link
Member

Uzaaft commented Jan 19, 2025

Would it be better to create another pack just with sqlfluff and leave the current SQL pack as is (maybe mention this formatting issue in the readme)? Since sqlfluff can be used both as a linter and a formatter: LazyVim/LazyVim@4e8d751/lua/lazyvim/plugins/extras/lang/sql.lua#L144C1-L171C5

Id vote against it. We could change it and just mark it as a breaking change and get on with it.

@azdanov
Copy link
Contributor Author

azdanov commented Jan 22, 2025

I'm having a slight issue configuring sqlfluff. It doesn't have a default lspconfig config, but when using none-ls, I can't seem to provide a default SQL dialect option. I set it as described in the documentation, but it doesn't apply. Without it, nothing works. I've used https://github.com/AstroNvim/astrocommunity/blob/main/lua/astrocommunity/pack/nix/init.lua as an example of configuring none-ls and the rest.

https://github.com/nvimtools/none-ls.nvim/blob/main/doc/BUILTINS.md#sqlfluff

@Uzaaft Could you please give some hints on how to proceed? I'm having skill issues here 😄

@azdanov
Copy link
Contributor Author

azdanov commented Jan 23, 2025

@Uzaaft
Copy link
Member

Uzaaft commented Jan 23, 2025

I am drowning in work this week, but I will try and take a look during the weekend @azdanov

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

Successfully merging a pull request may close this issue.

2 participants