Skip to content

Proposal: Integrate or Support External GDScript Formatters in Godot-IDE #19

@kyrosle

Description

@kyrosle

Summary

Godot 4.5 has improved the script editing experience but still lacks a built-in code formatter. To unify code style and improve readability, I propose integrating or supporting external GDScript formatters in Godot-IDE.

Candidate solutions (simple comparison)

  • gdtoolkit(gdformat)

    • Advantages: old-fashioned tools, stability, easy installation of pip, uniform style.
    • Disadvantages: Python dependency, high integration cost; slow update, occasional syntax corner issues; few configuration items.
  • GDQuest's Tree-Sitter Formatter

    • Advantages: Rust implementation, fast; support for organizing according to the official style, with indentation; multi-platform binary, low integration threshold; active projects.
    • Weaknesses: Still being refined, some syntax omissions; custom rules require knowledge of Tree/Sitter queries.

Want to ask for advice

  1. Integration method: Which one is more suitable to support first? Or support both and choose for the user?
  2. Dependencies and Compatibility: Is it possible to call external executables directly? Is it necessary to provide path/parameter configuration in the plugin?
  3. Experience: Supports automatic formatting when commands/shortcuts/saves, which is more commonly used? Do you need "select area format only" and change preview?

My initial idea (minimal implementation)

  • Add the "Format Document" action to the editor.
  • The optional formatter and executable file path in the settings provide basic parameters (such as indentation, length).
  • Optional "Auto-format when saving" (off by default).
  • When an error occurs, a prompt is given without damaging the file content.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions