Open cwoongh opened 8 months ago
Can you check if the PR build from https://github.com/godotengine/godot-vscode-plugin/pull/605 resolves this?
Install the VSIX within this ZIP archive from VS Code's command palette: https://nightly.link/godotengine/godot-vscode-plugin/actions/runs/8041615053/godot-tools.zip
Now this issue should be fixed in #605.
There's still some wonky behavior around minus signs in the PR build, sadly. In the examples below first lines are the original code, second lines are the formatter output:
func foo(bar = -1, baz := -2 * Vector2.UP):
func foo(bar=- 1, baz:=- 2 * Vector2.UP):
var foo := -1
var foo := - 1
var foo := -2 * Vector2.UP
var foo := - 2 * Vector2.UP
if -foo > 0: pass
if - foo > 0: pass
var foo := 2 ** -10
var foo := 2 ** - 10
Plus, apparently, the unary plus suffers from the same issues?
var foo := +5
var foo := + 5
var foo := range(-5, +5)
var foo := range(-5, + 5)
Great list, thank you. That helps a lot.
const _path_scene := preload("res://Interface/Path.tscn")
adds space after preload?
const _path_scene := preload ("res://Interface/Path.tscn")
func _target_to(tile: Vector2i, turn := true) -> void:
removes spaces around := when in func?
func _target_to(tile: Vector2i, turn:=true) -> void:
func set_door(p: Vector2i, type = Random.next(Door.size())) -> void:
removes spaces around = when in func?
func set_door(p: Vector2i, type=Random.next(Door.size())) -> void:
mob.scale = Vector2i(-1, 1)
forces spaces before and after -?
mob.scale = Vector2i( - 1, 1)
var dx := -i - 1
in this case the unary - should have a space before but not after and the second - should have spaces on both sides i think?
var dx := - i - 1
Thank you.
@rakkarage These have all been reported and I think all of them have been fixed, but the fix hasn't been released yet.
Thanks. Sorry I attempted test with Fix:605. Some were fixed but these were not. I will wait for next ver.
I definitely appreciate the report. I'll double check that your examples are all covered in the formatter test suite.
Godot version
4.2.1
VS Code version
1.86.2
Godot Tools VS Code extension version
2.0.0
System information
Linux
Issue description
I'm not sure of the exact conditions, but sometimes the formatter adds a space around the minus sign.
Steps to reproduce
Try formatting this code.
It becomes:
The
-PI
on the last line is fine, but-event.relative.x
becomes- event.relative.x
.