Open ewrogers opened 4 months ago
I don't think we should add bespoke integrations for third-party tools in the script editor. If this is to be implemented, this should be done in a generic way so that a specific Godot version isn't bound to specific tools only. Remember that third-party tools evolve over time (and so do their command line interfaces).
Describe the project you are working on
Any Godot 3.x or 4.x project would benefit from this.
Describe the problem or limitation you are having in your project
We are currently using
gdformat
andgdlint
via Gitpre-commit
and CI/CD actions respectively but it requires additional steps and is not always something develops want to set up.It would be nice to have this feature that most modern IDE (VS Code / JetBrains) have where the code can be automatically formatted on save.
Describe the feature / enhancement and how it helps to overcome the problem or limitation
Add settings either at the Editor or per-project level that would allow automatic reformatting of GDScript files on save, using
gdformat
(or another user-defined tool).Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams
This section of the Editor Settings has
FileSystem->OnSave
options. Logically, it would belong here for external format tools likegdformat
(assuming it is installed).Alternatively, the
Text Editor
could have a newOn Save
section if it should be more obvious.It would be a combination of two additional settings:
off
)gdformat
)When enabled, a command would be issued (ex:
gdformat just_saved_script.gd
) and the script file would be automatically reloaded in the editor. It should be transparent to the user and not prompt "file changed, reload?" confirmation modals.If this enhancement will not be used often, can it be worked around with a few lines of script?
It can be worked around with various Git actions but that also hinges on Git being the VCS of choice (however popular it may be).
Is there a reason why this should be core and not an add-on in the asset library?
Most IDEs offer things like this so it seems logical that Godot could to make it feel more cohesive as an "all-in-one" environment.