godotengine / godot-vscode-plugin

Godot development tools for VSCode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GDScript formatter removes spaces around "=" in default params

dmitrijbes opened this issue · comments

Godot version

v4.1.1.stable.official [bd6af8e0e]

VS Code version

1.86.2

Godot Tools VS Code extension version

2.0.0

System information

Windows 10

Issue description

First of all, Thank You for 2.0.0 update and especially for GDScript formatter!
Absolutely essential, a little bit more and I would write it myself)

Now to the issue, formatter removes spaces around "=" in default params.

Steps to reproduce

Before:

func _init(_name: String = ""):
	name = _name

After:

func _init(_name: String=""):
	name = _name

That's intentional.

I considered making it an option, but a configurable formatter is at least twice as much work as a non-configurable one.

At some point, I'm going to throw this formatter away and write a new one that's not a pile of dirty, dirty hacks, and that formatter will probably have options.

Oh, all right then. Is there some special reason for such a choice, or it's just a personal preference?

I actually think non-configurable formatter, like Python popular Black can also be a good choice, especially for starting Godot users.
Although in my opinion, formatter should adhere to official GDScript style guide, which, it seems to me, recommends to use spaces around operators.