godot-vscode-plugin icon indicating copy to clipboard operation
godot-vscode-plugin copied to clipboard

Auto Formatter Incorrectly Adding Spaces Around Dot Notation

Open sivercone opened this issue 1 year ago • 1 comments

Godot version

4.3.stable

VS Code version

1.91.1

Godot Tools VS Code extension version

2.2.0

System information

macOS 14.6.1

Issue description

Description

When using the auto formatter feature, it incorrectly inserts spaces around the dot notation, which leads to syntax errors in the code. This issue occurs consistently in scripts when saving them, affecting the proper functionality of the code.

Steps to reproduce

Steps to Reproduce

  1. Write the following function in a Godot script:

    func handleDeath() -> void:
        var signalConnections: Array[Dictionary] = self.get_incoming_connections()
        for connection in signalConnections:
            connection.signal.disconnect(connection.callable)
    
    
  2. Save the file or trigger auto formatting.

Expected Behavior

The formatter should retain the original spacing without inserting any additional spaces, preserving the integrity of the code:

func handleDeath() -> void:
    var signalConnections: Array[Dictionary] = self.get_incoming_connections()
    for connection in signalConnections:
        connection.signal.disconnect(connection.callable)

Current Behavior

After formatting, the script incorrectly introduces spaces around the dot notation, which can potentially lead to syntax errors:

func handleDeath() -> void:
    var signalConnections: Array[Dictionary] = self.get_incoming_connections()
    for connection in signalConnections:
        connection. signal .disconnect(connection.callable)

sivercone avatar Sep 28 '24 12:09 sivercone

This should be fixed in the next release.

DaelonSuzuka avatar Nov 03 '24 16:11 DaelonSuzuka