GDQuest / zed-gdscript

Zed support for the GDScript language
MIT License
37 stars 10 forks source link

Add support for Scony's code formater #18

Open NathanLovato opened 3 months ago

NathanLovato commented 3 months ago

There's a formatter made by a member of the community while waiting for the official one: https://github.com/Scony/godot-gdscript-toolkit

It's a command line tool that can format GDScript files. We could add support for it in the extension.

moomerman commented 3 months ago

Hi @NathanLovato glad to see you've taken over the project ❤️, I worked on the initial integration with @grndctrl.

I use the following config in Zed for formatting which can act as a workaround until the extension supports it directly, just thought I'd share in case it helps:

  "languages": {
    "GDScript": {
      "format_on_save": {
        "external": {
          "command": "gdformat",
          "arguments": ["-"]
        }
      }
    }
  },
NathanLovato commented 3 months ago

Thanks! It's probably a better solution than what could be provided by the extension. One reason being gdformat will fail on some syntax (e.g. lambdas in Godot 4), and also format some things in ways you may not want currently (the line splitting tends to wrap many short elements vertically, the algorithm cannot balance all lists of things).