Skip to content

Plugin doesn't see gdformat installed in /opt/homebrew/bin (formerly "My GDScript file does not get formatted on save") #2

@beetrootpaul

Description

@beetrootpaul

Hey, I just installed "Format on Save" and made my script wrongly formatted to see if the plugin works. Then I saved the script, but no change happened.

Context

So, to give you more context:

  • I on macOS Sonoma 14.1.1 on the Apple M1 Max CPU
  • I installed gdtoolkit in my iTerm2 in Zsh with pip3 install "gdtoolkit==4.*". When I run gdformat --version, I get gdformat 4.2.2 printed out
  • I run Godot v4.2.1.stable.official [b09f793f5]
  • I downloaded the plugin within Godot and chose to not "Ignore asset root" (but the same lack of formatting was happening when I clicked the otherwise)
  • I modified the script to look unformatted (see code pasted below)
  • I press Cmd+S to save, no formatting happens
  • But when I run gdformat manually, it formats OK (I run gdformat day23/day_23_part_1.gd from inside godot folder of my repo)

Source code: https://github.com/beetrootpaul/advent-of-code-2023/tree/godot-format-on-save-issue -> folder godot -> script day23/day_23_part_1.gd (note the script is supposed to read day23/example1_in.txt which is ignored in the repo; you can put any txt file there)

My unformatted script:

extends Node2D
func _ready()   :
	var filePath       = "res://day23/example1_in.txt"
	#var filePath = "res://day23/puzzle1_in.txt"

	var input =        FileAccess.open(filePath, FileAccess.READ).get_as_text()
	print_debug(input)
	var lines = input.split("\n")







func       _process(delta):
	pass

Script as formatted by gdformat day23/day_23_part_1.gd outside the Godot / plugin:

extends Node2D


func _ready():
	var filePath = "res://day23/example1_in.txt"
	#var filePath = "res://day23/puzzle1_in.txt"

	var input = FileAccess.open(filePath, FileAccess.READ).get_as_text()
	print_debug(input)
	var lines = input.split("\n")


func _process(delta):
	pass

How to debug?

I wonder if it is something with my gdtoolkit installation or some macOS related issues 🤔 Is there a way in Godot (I am new to the engine) to debug "Format on save" plugin? Can I for example add some print_debug statements to it and see its output somewhere?

Screenshots

The plugin I installed:

screenshot 2023-12-28 at 10 58 23

gdformat version:

screenshot 2023-12-28 at 11 04 59

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions