RobertOstermann / vscode-sqlfluff-extended

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

vscode-sqlfluff

.github/workflows/ci.yml

Notice

Deprecated: This project has been deprecated in favor of the original sqlfluff extension.

The changes from this project have been merged into the original extension.

A linter and auto-formatter for SQLFluff, a popular linting tool for SQL and dbt.

linter in action

You can run Format Document to fix the linting violations. You cannot run Format Selection. Please note that not all linting violations are automatically fixable.

Configuration

The extension expects sqlfluff to be installed and already added to the path. If it is installed but cannot be found, add the path to your preferences as seen below. Find the path by typing which sqlfluff into your terminal.

Edit your VS Code settings.json file manually or through the user interface.

If you want to manually update the settings.json file, open the VS Code command palette and type in settings.json. Select Preferences: Open Settings. Then, you can add any of the following configuration options to settings.json.

  "sqlfluff.config": "",
  "sqlfluff.dialect": "mysql",
  "sqlfluff.excludeRules": ["L009"],
  "sqlfluff.executablePath": "sqlfluff",
  "sqlfluff.format.enabled": true,
  "sqlfluff.format.workingDirectory": "",
  "sqlfluff.ignoreLocalConfig": false,
  "sqlfluff.ignoreParsing": false,
  "sqlfluff.linter.run": "onType",
  "sqlfluff.rules": [],

DBT Configuration

DBT setup requires these settings to lint and format the document.

  "sqlfluff.linter.run": "onSave",
  "sqlfluff.experimental.format.executeInTerminal": true,

Format file

By default you will be able use SQLFluff fix your file by formatting. Same as calling sqlfluff fix --force <path>

plugin configuration

Credits / Links

License

The MIT License (MIT). Please see the license file for more information.