fnando / vscode-linter

Extension for code linting, all in one package. New linters can be easily added through an extension framework.
https://marketplace.visualstudio.com/items?itemName=fnando.linter
MIT License
63 stars 16 forks source link

No linters found for "sql" #16

Closed zephyrpathsofglory closed 1 year ago

zephyrpathsofglory commented 2 years ago

Hello:

I have sqlfluff installed but when I save my postgres migration file with .sql extension, linter reports No linters found for "sql".

Does it need extra configuration? What should I do to work it around? Please lend a hand!

fnando commented 1 year ago

The language matching is not made against file extensions, but rather to how VSCode detects the document (via document.languageId). The problem is that only mysql and postgres languages are mapped to sqlfluff.

Which extension are you using for .sql syntax highlighting?

fnando commented 1 year ago

Ah, one thing you can do is setting file.associations to map .sql files to Postgres.

{
  "file.associations": {
    "*.sql": "postgres"
  }
}

I've been using https://marketplace.visualstudio.com/items?itemName=ckolkman.vscode-postgres for syntax highlighting, so if you save your files as *.psql or *.pgpsql, you won't need to manually map the extension to it.