Option Details
Name: Closing Bracket Position
If this is a new option, please fill out the below
Type (boolean, multi-select, number, etc): multi-select
Values (if applicable):
If this is to update an existing option, please describe what should be updated
Additional context
From what I think, there are 3 logical possible places to put the closing bracket
1. Common (after the last line of the block, at the same indentation level as the block's opening)
create table A (
id serial primary key,
title varchar(50) not null
);
create table B (
id serial primary key,
title varchar(50) not null
);
create table C (
id serial primary key,
title varchar(50) not null
);
const A = {
name: "John Doe",
age: 30
};
const B = {
name: "John Doe",
age: 30
};
const C = {
name: "John Doe",
age: 30
};
pros
- easy to read the last line in block
- easy to add new line into the last line in block
cons
- > or nested like structure. Thus a blank line is usually required to separate each blocks.
- There are 6 articles at the 0th indentation level compared to only 3 for the other options, adding clutters when trying to find the starts of each blocks
2. Condensed (at the end of the last line of the block)
create table A (
id serial primary key,
title varchar(50) not null);
create table B (
id serial primary key,
title varchar(50) not null);
create table C (
id serial primary key,
title varchar(50) not null);
const A = {
name: "John Doe",
age: 30};
const B = {
name: "John Doe",
age: 30};
const C = {
name: "John Doe",
age: 30};
pros
- the shortest of all style
- less clutter. There are only 3 articles in the 0th indentation level, each for the start of a block
- every blocks have a silhouette of a pan or a line so that it is easy to find the start of each block even without spaces between each blocks
cons
- harder to read the last line of each block
- harder to add new line to the last line of each block
3. Hybrid (after the last line of the block, at the same indentation level as the block's children)
create table A (
id serial primary key,
title varchar(50) not null
);
create table B (
id serial primary key,
title varchar(50) not null
);
create table C (
id serial primary key,
title varchar(50) not null
);
const A = {
name: "John Doe",
age: 30
};
const B = {
name: "John Doe",
age: 30
};
const C = {
name: "John Doe",
age: 30
};
pros
- less clutter. There are only 3 articles in the 0th indentation level, each for the start of a block
- every blocks have a silhouette of a pan or a line so that it is easy to find the start of each block even without spaces between each blocks
- easy to read the last line of each block
- easy to add a new line to the end of each block
cons
- longer than the condensed style
Right now, I have to turn off autoformatting for sql file (postgresql) because I find it easier to identify create table blocks and understand a complicated select statement with hybrid style bracket.
I still use autoformatting for js, ts, etc. because I find the convenience of autoformatting outweigh the cost of > structure of the blocks.
Option Details
Name: Closing Bracket Position
If this is a new option, please fill out the below
Type (boolean, multi-select, number, etc): multi-select
Values (if applicable):
If this is to update an existing option, please describe what should be updated
Additional context
From what I think, there are 3 logical possible places to put the closing bracket
1. Common (after the last line of the block, at the same indentation level as the block's opening)
pros
cons
2. Condensed (at the end of the last line of the block)
pros
cons
3. Hybrid (after the last line of the block, at the same indentation level as the block's children)
pros
cons
Right now, I have to turn off autoformatting for sql file (postgresql) because I find it easier to identify create table blocks and understand a complicated select statement with hybrid style bracket.
I still use autoformatting for js, ts, etc. because I find the convenience of autoformatting outweigh the cost of > structure of the blocks.