Skip to content

Prototype a GDExtension for the formatter #282

Description

@khellste

(Revised based on discussion in this thread)

We can use godot-rust to expose the formatter as a library to @tools in the Godot editor. This would be an improvement for developers who want to focus on the native Godot editor experience and want a plug-and-play addon that doesn't need an internet connection to download additional dependencies on first use. It would probably also provide a slight performance improvement for Godot editor users, because the addon would not need to shell out to a separate process to format scripts.

Maintainer edit: This also means when people update the extension, they will automatically get the latest version of the formatter and they won't need to update the add-on and the formatter separately, because this will compile the formatter library into the extension.

Previous proposal Now that the project no longer depends on Topiary, there is less reason for the formatter to be implemented as an external binary.

I propose a full rewrite in GDExtension/C++, which would have the following advantages:

  • The formatter can be distributed as a single Godot addon. No need to download and install a separate binary.
  • It runs natively in the Godot editor without shelling out to a separate process. (Though we should still support external editors using godot --headless -s some_cli_wrapper.gd.)
  • Formatter primitives (like perhaps the GDScript AST) can be exposed to @tools in the Godot scripting environment, allowing users to more easily build custom tooling on top of the formatter.

I realize it's a big undertaking, but I think having the formatter as a standalone Godot addon would be worth it. I'm willing to take a stab at it if others on the project see value in it too.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions