gdharness 1.1.42 → 1.1.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -76,9 +76,21 @@ func reload_script(args: Dictionary) -> Dictionary:
76
76
  if reader == null:
77
77
  return {"ok": false, "error": "Could not read " + path + ": " + str(FileAccess.get_open_error())}
78
78
  var previous: String = script.source_code
79
- script.source_code = reader.get_as_text()
79
+ var text: String = reader.get_as_text()
80
80
  reader.close()
81
81
 
82
+ # Godot keeps one parse of each script for other scripts to resolve its class through, and a
83
+ # reload drops that parse only when the text it compiles differs from the text that was parsed.
84
+ # A parse that failed because a class it names was not yet known has the file's own text, so it
85
+ # outlived every reload: the class answered with all its methods while each script naming it read
86
+ # "because of a parser error" until the editor restarted, for as long as anything held the parse,
87
+ # such as a file open in an editor's language server. Compiling once with a line more makes the
88
+ # texts differ, which drops that parse and those of the scripts that resolved through it; the
89
+ # file's own text is compiled below.
90
+ script.source_code = text + "\n"
91
+ var _dropped: Error = script.reload(true)
92
+ script.source_code = text
93
+
82
94
  # A reload that fails is still answered as a call that ran, because the readings are what a
83
95
  # caller needs then: a failure travels back as its message alone, and a project met one and
84
96
  # could not tell whether the copy had been damaged by it or before it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gdharness",
3
- "version": "1.1.42",
3
+ "version": "1.1.43",
4
4
  "mcpName": "io.github.Aureliolo/gdharness",
5
5
  "description": "A harness for driving a Godot 4 project from an agent: editor addons, a runtime bridge into the running game, an MCP server in front of them, and a CLI that installs and diagnoses the Godot side.",
6
6
  "type": "module",