nene / prettier-plugin-sql-cst

Prettier SQL plugin that uses sql-parser-cst

Home Page:https://nene.github.io/prettier-sql-playground/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apply format for inline SQL string

peterHakio opened this issue · comments

In our applications we write raw sql queries like:

const query = `
    UPDATE "my_table"
    SET "base" = tmp.new_valu....
`

We would love to be able to apply sql formating on these.

A suggestion for a way to detect such queries could be if the string starts with-- sql. like this:

const query = `-- sql
    UPDATE "my_table"
    SET "base" = tmp.new_valu....
`

It could be enabled as a opt in feature, where the trigger string could be a variable the user could set in the config.

Other solution ideas would be appreciated :)

Please see the embed plugin, as mentioned in the FAQ.