gdharness 0.13.39 → 0.13.40
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.
- package/build/cli.js +244 -74
- package/build/godot/addons/gdharness_editor/bridge_client.gd +53 -0
- package/build/index.js +235 -72
- package/package.json +1 -1
|
@@ -31,6 +31,11 @@ const ELSEWHERE_CLOSE_CODE: int = 4001
|
|
|
31
31
|
const LSP_SETTING: String = "network/language_server/remote_port"
|
|
32
32
|
const DAP_SETTING: String = "network/debug_adapter/remote_port"
|
|
33
33
|
const DEBUGGER_SETTING: String = "network/debug/remote_port"
|
|
34
|
+
## Whether the editor shares its breakpoints with a debug adapter session as it opens, or clears
|
|
35
|
+
## them. Off by default in Godot, and off means every breakpoint in the editor is removed the
|
|
36
|
+
## moment any session sends `initialize`, which a server does for its first breakpoint or its
|
|
37
|
+
## first stack read. Turned on by [method _keep_breakpoints_through_sessions] when this loads.
|
|
38
|
+
const SYNC_BREAKPOINTS_SETTING: String = "network/debug_adapter/sync_breakpoints"
|
|
34
39
|
## What a server that opened this editor put in the environment, matching the ports it named on
|
|
35
40
|
## the command line. Kept in step with `editorArguments` in src/launch.ts.
|
|
36
41
|
const LSP_ASKED: String = "GDHARNESS_LSP_PORT"
|
|
@@ -87,6 +92,7 @@ var _connecting_for: float = 0.0
|
|
|
87
92
|
func _ready() -> void:
|
|
88
93
|
_project_path = ProjectSettings.globalize_path("res://")
|
|
89
94
|
version_at_load = _loaded_version()
|
|
95
|
+
_keep_breakpoints_through_sessions()
|
|
90
96
|
|
|
91
97
|
_reconnect_timer = Timer.new()
|
|
92
98
|
_reconnect_timer.one_shot = true
|
|
@@ -281,6 +287,9 @@ func _handle_connect() -> void:
|
|
|
281
287
|
"lsp_port": _serves(LSP_ASKED, LSP_SETTING),
|
|
282
288
|
"dap_port": _serves(DAP_ASKED, DAP_SETTING),
|
|
283
289
|
"debug_port": _serving(DEBUGGER_SETTING),
|
|
290
|
+
# Whether a session opening on the adapter is told this editor's breakpoints or takes
|
|
291
|
+
# them away, so a server can say which before it sets one.
|
|
292
|
+
"syncs_breakpoints": _syncs_breakpoints(),
|
|
284
293
|
# Whether a server started this editor, which is the only kind that can be started again
|
|
285
294
|
# as itself: the engine hands back none of the arguments it was given, so the arguments
|
|
286
295
|
# have to come from whoever wrote them. See `restart_editor` in play_tools.gd.
|
|
@@ -329,6 +338,50 @@ static func _asked_for(variable: String) -> int:
|
|
|
329
338
|
return port if port >= 1 and port <= 65535 else 0
|
|
330
339
|
|
|
331
340
|
|
|
341
|
+
## Turns breakpoint syncing on, so a debug session opening does not clear the editor's breakpoints.
|
|
342
|
+
##
|
|
343
|
+
## With the setting off, Godot's adapter answers `initialize` by clearing every breakpoint in the
|
|
344
|
+
## script editor, open and cached, and telling every session so; with it on, it tells the new
|
|
345
|
+
## session what is set and clears nothing. A server opens a session for its first breakpoint or
|
|
346
|
+
## its first stack read, so off meant a harness session took the user's breakpoints away on its
|
|
347
|
+
## first debug call, silently. The adapter reads the setting again the moment it changes, so this
|
|
348
|
+
## holds for the editor that is running and not only the next one.
|
|
349
|
+
##
|
|
350
|
+
## An editor setting rather than a project one, the way the debugger port this addon moves is,
|
|
351
|
+
## and left alone when it already reads true or does not exist.
|
|
352
|
+
func _keep_breakpoints_through_sessions() -> void:
|
|
353
|
+
if not Engine.is_editor_hint():
|
|
354
|
+
return
|
|
355
|
+
var settings: EditorSettings = EditorInterface.get_editor_settings()
|
|
356
|
+
if settings == null or not settings.has_setting(SYNC_BREAKPOINTS_SETTING):
|
|
357
|
+
return
|
|
358
|
+
if Read.as_bool(settings.get_setting(SYNC_BREAKPOINTS_SETTING)):
|
|
359
|
+
return
|
|
360
|
+
settings.set_setting(SYNC_BREAKPOINTS_SETTING, true)
|
|
361
|
+
# Stored is not the same as noticed. The adapter reads this setting again on the editor-wide
|
|
362
|
+
# settings notification, which the settings dialog sends after Apply and set_setting does not
|
|
363
|
+
# send at all, so without this the running adapter went on clearing breakpoints until the
|
|
364
|
+
# editor was restarted. Sent from the editor's root, which is where the dialog sends it from.
|
|
365
|
+
var editor_root: Node = get_tree().root.get_child(0)
|
|
366
|
+
editor_root.propagate_notification(EditorSettings.NOTIFICATION_EDITOR_SETTINGS_CHANGED)
|
|
367
|
+
print(
|
|
368
|
+
(
|
|
369
|
+
"[gdharness] turned on %s, so a debug session opening keeps the editor's breakpoints"
|
|
370
|
+
% SYNC_BREAKPOINTS_SETTING
|
|
371
|
+
)
|
|
372
|
+
)
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
## Whether the editor shares its breakpoints with a session as it opens. See the setting.
|
|
376
|
+
func _syncs_breakpoints() -> bool:
|
|
377
|
+
if not Engine.is_editor_hint():
|
|
378
|
+
return false
|
|
379
|
+
var settings: EditorSettings = EditorInterface.get_editor_settings()
|
|
380
|
+
if settings == null or not settings.has_setting(SYNC_BREAKPOINTS_SETTING):
|
|
381
|
+
return false
|
|
382
|
+
return Read.as_bool(settings.get_setting(SYNC_BREAKPOINTS_SETTING))
|
|
383
|
+
|
|
384
|
+
|
|
332
385
|
## What the settings say this editor serves on, or 0 when there is nothing to ask.
|
|
333
386
|
func _serving(setting: String) -> int:
|
|
334
387
|
if not Engine.is_editor_hint():
|