Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Scony's code formater #18

Open
NathanLovato opened this issue Aug 10, 2024 · 3 comments
Open

Add support for Scony's code formater #18

NathanLovato opened this issue Aug 10, 2024 · 3 comments
Labels
documentation Improvements or additions to documentation enhancement New feature or request

Comments

@NathanLovato
Copy link
Contributor

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.

@NathanLovato NathanLovato added the enhancement New feature or request label Aug 10, 2024
@moomerman
Copy link
Contributor

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
Copy link
Contributor Author

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).

@NathanLovato NathanLovato added the documentation Improvements or additions to documentation label Aug 24, 2024
@grndctrl
Copy link
Contributor

grndctrl commented Dec 5, 2024

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": ["-"]
        }
      }
    }
  },

Hmm, this doesn't seem to be working for me anymore, I'm quite sure it did work before.
log:

2024-12-05T13:23:59.880028+01:00 [ERROR] Formatting failed: failed to format via external command "gdformat": No such file or directory (os error 2)
2024-12-05T13:23:59.880292+01:00 [ERROR] failed to format via external command "gdformat"

Caused by:
    No such file or directory (os error 2)

EDIT: Weird, adding the full path to gdformat solves it, even though I add it to PATH and can call it on a terminal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants