Thanks a lot for the linter, formatter and your courses.
Maybe I am missing something but I did not find any annotation to disable the formatter for a region like we can disable the linter.
A use case when I want to disable the formatter is, when I have lists of vertices that are generated from calculations.
To make the calculations more expressive, I format them as "table".
Example for creating the vertices of a hexagon:
var vertices: PackedVector3Array = [
Vector3(center.x , 0, center.z - outer_radius ), # 0 top
Vector3(center.x + inner_radius, 0, center.z - outer_radius_2), # 1 top right
Vector3(center.x + inner_radius, 0, center.z + outer_radius_2), # 2 bottom right
Vector3(center.x , 0, center.z + outer_radius ), # 3 bottom
Vector3(center.x - inner_radius, 0, center.z + outer_radius_2), # 4 bottom left
Vector3(center.x - inner_radius, 0, center.z - outer_radius_2), # 5 top left
]
The formatter decides this is the correct layout:
var vertices: PackedVector3Array = [
Vector3(center.x, 0, center.z - outer_radius), # 0 top
Vector3(center.x + inner_radius, 0, center.z - outer_radius_2), # 1 top right
Vector3(center.x + inner_radius, 0, center.z + outer_radius_2), # 2 bottom right
Vector3(center.x, 0, center.z + outer_radius), # 3 bottom
Vector3(center.x - inner_radius, 0, center.z + outer_radius_2), # 4 bottom left
Vector3(center.x - inner_radius, 0, center.z - outer_radius_2), # 5 top left
]
While this is correct from style guide view, I'd love to override here because the result is causing more cognitive load than seeing the table structure.
I'd love to have something like:
Example:
var vertexes: PackedVector3Array = [
# gd-formatter:disable
Vector3(center.x , 0, center.z - outer_radius ), # 0 top
Vector3(center.x + inner_radius, 0, center.z - outer_radius_2), # 1 top right
Vector3(center.x + inner_radius, 0, center.z + outer_radius_2), # 2 bottom right
Vector3(center.x , 0, center.z + outer_radius ), # 3 bottom
Vector3(center.x - inner_radius, 0, center.z + outer_radius_2), # 4 bottom left
Vector3(center.x - inner_radius, 0, center.z - outer_radius_2), # 5 top left
# gd-formatter:enable
]
To define a code region that shall not be touched.
Further use case are matrices and the like - in the end, all structured initialization code.
Thanks a lot for the linter, formatter and your courses.
Maybe I am missing something but I did not find any annotation to disable the formatter for a region like we can disable the linter.
A use case when I want to disable the formatter is, when I have lists of vertices that are generated from calculations.
To make the calculations more expressive, I format them as "table".
Example for creating the vertices of a hexagon:
The formatter decides this is the correct layout:
While this is correct from style guide view, I'd love to override here because the result is causing more cognitive load than seeing the table structure.
I'd love to have something like:
Example:
To define a code region that shall not be touched.
Further use case are matrices and the like - in the end, all structured initialization code.