mirror of
https://github.com/godotengine/godot-vscode-plugin.git
synced 2025-12-31 13:48:24 +03:00
Implement Godot-in-the-loop test suite and fix debugger errors (#788)
Fixes for get variables issues
1. Same reference but different variable override fix, which resulted in variables being lost
** Now different GodotVariable instances are used for different variables with same reference
** const replacement = {value: rawObject, sub_values: sub_values } as GodotVariable;
2. 'Signal' type handling crash and string representation fix
** value.sub_values()?.map
3. Empty scopes return fix
** if (this.ongoing_inspections.length === 0 && stackVars.remaining == 0)
4. Various splice from findIndex fixes (where findIndex can return -1)
5. Added variables tests
** updated vscode types to version 1.96 to use `onDidChangeActiveStackItem` for breakpoint hit detection in tests
1 & 3 should fix https://github.com/godotengine/godot-vscode-plugin/issues/779
This commit is contained in:
40
test_projects/test-dap-project-godot4/.vscode/launch.json
vendored
Normal file
40
test_projects/test-dap-project-godot4/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "GDScript: Launch ScopeVars.tscn",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "${workspaceFolder}",
|
||||
"scene": "ScopeVars.tscn"
|
||||
// "debug_collisions": false,
|
||||
// "debug_paths": false,
|
||||
// "debug_navigation": false,
|
||||
// "additional_options": ""
|
||||
},
|
||||
{
|
||||
"name": "GDScript: Launch ExtensiveVars.tscn",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "${workspaceFolder}",
|
||||
"scene": "ExtensiveVars.tscn"
|
||||
},
|
||||
{
|
||||
"name": "GDScript: Launch BuiltInTypes.tscn",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "${workspaceFolder}",
|
||||
"scene": "BuiltInTypes.tscn"
|
||||
},
|
||||
{
|
||||
"name": "GDScript: Launch NodeVars.tscn",
|
||||
"type": "godot",
|
||||
"request": "launch",
|
||||
"project": "${workspaceFolder}",
|
||||
"scene": "NodeVars.tscn"
|
||||
}
|
||||
]
|
||||
}
|
||||
39
test_projects/test-dap-project-godot4/BuiltInTypes.gd
Normal file
39
test_projects/test-dap-project-godot4/BuiltInTypes.gd
Normal file
@@ -0,0 +1,39 @@
|
||||
extends Node
|
||||
|
||||
signal member_signal
|
||||
signal member_signal_with_parameters(my_param1: String)
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var int_var = 42
|
||||
var float_var = 3.14
|
||||
var bool_var = true
|
||||
var string_var = "Hello, Godot!"
|
||||
var nil_var = null
|
||||
var vector2 = Vector2(10, 20)
|
||||
var vector3 = Vector3(1, 2, 3)
|
||||
var rect2 = Rect2(0, 0, 100, 50)
|
||||
var quaternion = Quaternion(0, 0, 0, 1)
|
||||
var simple_array = [1, 2, 3]
|
||||
var nested_dict = {
|
||||
"nested_key": "Nested Value",
|
||||
"sub_dict": {"sub_key": 99}
|
||||
}
|
||||
var byte_array = PackedByteArray([0, 1, 2, 255])
|
||||
var int32_array = PackedInt32Array([100, 200, 300])
|
||||
var color_var = Color(1, 0, 0, 1) # Red color
|
||||
var aabb_var = AABB(Vector3(0, 0, 0), Vector3(1, 1, 1))
|
||||
var plane_var = Plane(Vector3(0, 1, 0), -5)
|
||||
|
||||
var callable_var = self.my_callable_func
|
||||
|
||||
var signal_var = member_signal
|
||||
member_signal.connect(singal_connected_func)
|
||||
|
||||
print("breakpoint::BuiltInTypes::_ready")
|
||||
|
||||
func my_callable_func():
|
||||
pass
|
||||
|
||||
func singal_connected_func():
|
||||
pass
|
||||
11
test_projects/test-dap-project-godot4/BuiltInTypes.tscn
Normal file
11
test_projects/test-dap-project-godot4/BuiltInTypes.tscn
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://d0ovhv6f38jj4"]
|
||||
|
||||
[ext_resource type="Script" path="res://BuiltInTypes.gd" id="1_2dpge"]
|
||||
|
||||
[node name="BuiltInTypes" type="Node"]
|
||||
script = ExtResource("1_2dpge")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "Built-in types"
|
||||
38
test_projects/test-dap-project-godot4/ExtensiveVars.gd
Normal file
38
test_projects/test-dap-project-godot4/ExtensiveVars.gd
Normal file
@@ -0,0 +1,38 @@
|
||||
extends Node2D
|
||||
|
||||
var self_var := self
|
||||
@onready var label: ExtensiveVars_Label = $Label
|
||||
|
||||
class ClassA:
|
||||
var member_classB
|
||||
var member_self := self
|
||||
|
||||
class ClassB:
|
||||
var member_classA
|
||||
|
||||
func _ready() -> void:
|
||||
var local_label := label
|
||||
var local_self_var_through_label := label.parent_var
|
||||
|
||||
var local_classA = ClassA.new()
|
||||
var local_classB = ClassB.new()
|
||||
local_classA.member_classB = local_classB
|
||||
local_classB.member_classA = local_classA
|
||||
|
||||
# Circular reference.
|
||||
# Note: that causes the godot engine to omit this variable, since stack_frame_var cannot be completed and sent
|
||||
# https://github.com/godotengine/godot/issues/76019
|
||||
# var dict = {}
|
||||
# dict["self_ref"] = dict
|
||||
|
||||
print("breakpoint::ExtensiveVars::_ready")
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
var local_label := label
|
||||
var local_self_var_through_label := label.parent_var
|
||||
|
||||
var local_classA = ClassA.new()
|
||||
var local_classB = ClassB.new()
|
||||
local_classA.member_classB = local_classB
|
||||
local_classB.member_classA = local_classA
|
||||
pass
|
||||
12
test_projects/test-dap-project-godot4/ExtensiveVars.tscn
Normal file
12
test_projects/test-dap-project-godot4/ExtensiveVars.tscn
Normal file
@@ -0,0 +1,12 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://bsonfthpqa3dx"]
|
||||
|
||||
[ext_resource type="Script" path="res://ExtensiveVars.gd" id="1_fnilr"]
|
||||
[ext_resource type="Script" path="res://ExtensiveVars_Label.gd" id="2_jijf2"]
|
||||
|
||||
[node name="ExtensiveVars" type="Node2D"]
|
||||
script = ExtResource("1_fnilr")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
text = "Extensive Vars scene"
|
||||
script = ExtResource("2_jijf2")
|
||||
metadata/_edit_use_anchors_ = true
|
||||
14
test_projects/test-dap-project-godot4/ExtensiveVars_Label.gd
Normal file
14
test_projects/test-dap-project-godot4/ExtensiveVars_Label.gd
Normal file
@@ -0,0 +1,14 @@
|
||||
extends Label
|
||||
|
||||
class_name ExtensiveVars_Label
|
||||
|
||||
@onready var parent_var: Node2D = $".."
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
pass
|
||||
3
test_projects/test-dap-project-godot4/GlobalScript.gd
Normal file
3
test_projects/test-dap-project-godot4/GlobalScript.gd
Normal file
@@ -0,0 +1,3 @@
|
||||
extends Node
|
||||
|
||||
var globalMember := "global member"
|
||||
8
test_projects/test-dap-project-godot4/Node1.gd
Normal file
8
test_projects/test-dap-project-godot4/Node1.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends Node
|
||||
|
||||
@onready var parent_node: Node2D = $".."
|
||||
@onready var sibling_node2: Node = $"../node2"
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
pass # Replace with function body.
|
||||
9
test_projects/test-dap-project-godot4/NodeVars.gd
Normal file
9
test_projects/test-dap-project-godot4/NodeVars.gd
Normal file
@@ -0,0 +1,9 @@
|
||||
extends Node2D
|
||||
|
||||
@onready var node_1: Node = $node1
|
||||
@onready var node_2: Node = $node2
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
print("breakpoint::NodeVars::_ready")
|
||||
pass
|
||||
17
test_projects/test-dap-project-godot4/NodeVars.tscn
Normal file
17
test_projects/test-dap-project-godot4/NodeVars.tscn
Normal file
@@ -0,0 +1,17 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://xrjtth0d2nc5"]
|
||||
|
||||
[ext_resource type="Script" path="res://NodeVars.gd" id="1_6eeca"]
|
||||
[ext_resource type="Script" path="res://Node1.gd" id="2_bl41t"]
|
||||
|
||||
[node name="NodeVars" type="Node2D"]
|
||||
script = ExtResource("1_6eeca")
|
||||
|
||||
[node name="node1" type="Node" parent="."]
|
||||
script = ExtResource("2_bl41t")
|
||||
|
||||
[node name="node2" type="Node" parent="."]
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "NodeVars"
|
||||
8
test_projects/test-dap-project-godot4/ScopeVars.gd
Normal file
8
test_projects/test-dap-project-godot4/ScopeVars.gd
Normal file
@@ -0,0 +1,8 @@
|
||||
extends Node
|
||||
|
||||
var member1 := TestClassA.new()
|
||||
|
||||
func _ready() -> void:
|
||||
var local1 := TestClassA.new()
|
||||
var local2 = GlobalScript.globalMember
|
||||
print("breakpoint::ScopeVars::_ready")
|
||||
11
test_projects/test-dap-project-godot4/ScopeVars.tscn
Normal file
11
test_projects/test-dap-project-godot4/ScopeVars.tscn
Normal file
@@ -0,0 +1,11 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://g5gqewj2i2xs"]
|
||||
|
||||
[ext_resource type="Script" path="res://ScopeVars.gd" id="1_wtcpp"]
|
||||
|
||||
[node name="RootNode" type="Node"]
|
||||
script = ExtResource("1_wtcpp")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
offset_right = 40.0
|
||||
offset_bottom = 23.0
|
||||
text = "Godot test project"
|
||||
5
test_projects/test-dap-project-godot4/TestClassA.gd
Normal file
5
test_projects/test-dap-project-godot4/TestClassA.gd
Normal file
@@ -0,0 +1,5 @@
|
||||
class_name TestClassA
|
||||
|
||||
var testclassa_member1 := "member1"
|
||||
|
||||
var testclassa_member2: Node
|
||||
19
test_projects/test-dap-project-godot4/project.godot
Normal file
19
test_projects/test-dap-project-godot4/project.godot
Normal file
@@ -0,0 +1,19 @@
|
||||
; Engine configuration file.
|
||||
; It's best edited using the editor UI and not directly,
|
||||
; since the parameters that go here are not all obvious.
|
||||
;
|
||||
; Format:
|
||||
; [section] ; section goes between []
|
||||
; param=value ; assign values to parameters
|
||||
|
||||
config_version=5
|
||||
|
||||
[application]
|
||||
|
||||
config/name="Test DAP project godot4"
|
||||
run/main_scene="res://ScopeVars.tscn"
|
||||
config/features=PackedStringArray("4.3", "Forward Plus")
|
||||
|
||||
[autoload]
|
||||
|
||||
GlobalScript="*res://GlobalScript.gd"
|
||||
Reference in New Issue
Block a user