Closed christopher-caldwell closed 8 months ago
No. This style is not supported and there's currently no plan of supporting it.
Also the indentStyle:tabularLeft/Right
is deprecated and will be removed in a future release.
@nene Oh, I see that in GIANT CAPITAL LETTERS lol. My bad.
Thanks for the response. What's the reason for this not being a configuration option?
If you mean, "why is the identStyle
option going to be removed"...
...you can already see it from your own example that the output of it looks pretty bad. There was no clear vision of what sort of formatting style this feature is meant to support. Plus it was implemented as one big hack, so it has lots of problems.
If you mean, "why don't we add a config option for the style you're suggesting"...
...all such tabular alignment styles are problematic. They might look nice in a simple case, but if you try to generalize it, you'll bump into all sorts of strange cases. For example, if on has several column constraints... I really don't know how one should format this in this tabular style:
CREATE TABLE project (
id SMALLINT NOT NULL,
initial_temporary_creator_id BIGINT NOT NULL CHECK (initial_temporary_creator_id > 0) NO INHERIT REFERENCES company_user (user_id)
);
...it also means one needs to reindent the whole statement when the name of the longest column name changes. Which is a bad characteristic of any code formatting style.
...and it's pretty hard to implement with the current architecture of sql-formatter which doesn't really reliably distinguish between column names, data types and doesn't even a understand the concept of column constraint.
@nene Understood! Thank you. My question of why was aimed at your second response.
Thanks for taking the time to explain, I appreciate it!
Apologies if this is answered somewhere, but I have not been able to find it.
Is there a way to apply formatting inside of the table definition?
Result
Want
I'm not sure if this supported, but figured I'd ask.
indentStyle: tabularLeft
does a version of this, but it doesn't extend to inside the parenthesis of the definition