godotengine / godot-vscode-plugin

Godot development tools for VSCode
MIT License
1.47k stars 148 forks source link

Formatter breaks up xor assignment operator #657

Open WesleyClements opened 1 month ago

WesleyClements commented 1 month ago

Godot version

4.2.2

VS Code version

1.89.0

Godot Tools VS Code extension version

2.0.0

System information

Windows 11

Issue description

The formatter will add a space in between the ^ and = in the xor assignment operator. This:

var num = 4
num ^= 20

turns into this:

var num = 4
num^ = 20

This is invalid gdscript and so breaks compilation.

Steps to reproduce

Use the xor assignment operator anywhere and then format the document.

tarwich commented 1 week ago

More examples that bit me this week:


var poweroftwo = 2 ** 4
# Results in the following, which breaks the compiler
# var poweroftwo = 2 * * 4

var inversion = 2 * -1
# Results in the following which is a preference issue alone
# var inversion = 2 * - 1
tarwich commented 1 week ago

Duplicate of #653 #601 #602 #609

Resolved in #605