sqlfluff / vscode-sqlfluff

An extension to use the sqlfluff linter in vscode.
https://marketplace.visualstudio.com/items?itemName=dorzey.vscode-sqlfluff
MIT License
156 stars 33 forks source link

`sqlfluff 3.0` release breaks extension `sql` document formatter #126

Closed pep-sanwer closed 8 months ago

pep-sanwer commented 8 months ago

After upgrade to sqlfulff 3.0, I am seeing the following behavior with Settings: Sqlfluff > Format: Enabled set to true:

The line:

The -f/--force option is deprecated as it is now the default behaviour.

is inserted at the top of the file on format.

Based on the extension documentation I am assuming this is a consequence of the extension utilizing sqlfluff fix --force <path> on format, where --force is deprecated as of sqlfulff 3.0

pep-sanwer commented 8 months ago

Patched locally via an executable bash script like below:

#!/bin/bash

modified_args=()
for arg in "$@"; do
    if [ "$arg" != "--force" ]; then
        modified_args+=("$arg")
    fi
done

sqlfluff "${modified_args[@]}"

and feeding this script to the extension by pointing sqlfluff.executablePath to it

levelupatlas-mat commented 8 months ago

Absolutely needs the PR to be merged asap. This is pretty breaking rn.

pep-sanwer commented 8 months ago

xref https://github.com/sqlfluff/vscode-sqlfluff/pull/127

RobertOstermann commented 8 months ago

@pep-sanwer @levelupatlas-mat I have released v3.0.0, which should fix this issue

levelupatlas-mat commented 8 months ago

Lovely, working great now. Thanks for the quick release!