Closed FerreiraM12 closed 8 months ago
This should be reported to https://github.com/sql-formatter-org/sql-formatter instead.
cc @nene
And it seems we are outdated now, sql-formatter
v13 has been released, PR welcome to upgrade it and test your failing case.
This seems like a bug in SQL Formatter. However I'd like to see a reference for this syntax in Oracle documentation. For example this page, describing the syntax of placeholders, does not mention $
as a valid character.
At the moment one can pick the PostgreSQL dialect, which supports $
characters, to see how the output from SQL Formatter would look like for this SQL. I can say up front that it doesn't look pretty. That's because SQL Formatter doesn't really support formatting of procedural SQL. It does its best to not crash, but that's pretty much all. There's no plan to support it either as the current architecture of SQL Formatter is not fit for the task. That said, I've been working on a new SQL formatting approach in the form of a Prettier plugin which addresses lots of the shortcomings of SQL Formatter including proper support of procedural SQL. It's still in the early stages of development though, only supporting SQLite and BigQuery.
I'll add a new formatter
option cst
to portal https://github.com/nene/prettier-plugin-sql-cst inside.
I'll add a new
formatter
optioncst
to portal nene/prettier-plugin-sql-cst inside.
Hmm... wouldn't it be kinda strange to package one Prettier plugin inside another one? Just saying... I don't mind. It'll probably bring more exposure to the -cst plugin.
wouldn't it be kinda strange to package one Prettier plugin inside another one?
I rethink about it and it's really weird, so I'll not try it for now.
The following setting will also do the trick.
{
"paramTypes": "{custom:[{regex:':\\w+(\\$\\w+)?'}]}"
}
Hmm... wouldn't it be kinda strange to package one Prettier plugin inside another one? Just saying... I don't mind. It'll probably bring more exposure to the -cst plugin.
I rethink about it and it's really weird, so I'll not try it for now.
Yeah it does seem a bit strange to call a different Prettier plugin from within a plugin, but would not be so strange if the prettier-plugin-sql-cst
project changed to a more generic formatting library (not sure if that's wanted though):
And then if this idea would be acceptable to everyone, prettier-plugin-sql
could maintain the Prettier-specific parts.
Well, the prettier-plugin-sql-cst
is actually more tightly coupled to Prettier than this plugin. It uses the Prettier layout engine to perform the formatting. It can't really be separated from Prettier.
I have valid PL-SQL code and I am getting an error when trying to format it.
This is the code I used:
I am getting the following error:
If I replace all occurrences of
APEX$ROW_STATUS
with some other word the formatting works as expected.