File tree Expand file tree Collapse file tree 1 file changed +21
-0
lines changed
Expand file tree Collapse file tree 1 file changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -221,6 +221,27 @@ extension is no more maintained by its author.
221221Please use the official [ SQL Formatter VSCode] ( https://marketplace.visualstudio.com/items?itemName=ReneSaarsoo.sql-formatter-vsc )
222222extension to get the latest fixes from SQL Formatter library.
223223
224+ ### My SQL contains templating syntax which SQL Formatter fails to parse
225+
226+ For example, you might have an SQL like:
227+
228+ ``` sql
229+ SELECT {col1}, {col2} FROM {tablename}
230+ ```
231+
232+ While templating is not directly supported by SQL Formatter, the workaround
233+ is to use [ paramTypes] ( docs/paramTypes.md ) config option to treat these
234+ occurances of templating constructs as prepared-statement parameter-placeholders:
235+
236+ ``` js
237+ format (' SELECT {col1}, {col2} FROM {tablename};' , {
238+ paramTypes: { custom: [{ regex: String .raw ` \{\w +\} ` }] },
239+ });
240+ ```
241+
242+ This won't work for all possible templating constructs,
243+ but should solve the most common use cases.
244+
224245## The future
225246
226247The development of this formatter is currently in maintenance mode.
You can’t perform that action at this time.
0 commit comments