Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GD-559: add inspector directory collapse toggling #560

Merged
merged 1 commit into from
Aug 25, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions addons/gdUnit4/src/ui/parts/InspectorTreeMainPanel.gd
Original file line number Diff line number Diff line change
Expand Up @@ -906,20 +906,24 @@ func _on_Tree_item_selected() -> void:
func _on_Tree_item_activated() -> void:
var selected_item := _tree.get_selected()
var resource_path: String = selected_item.get_meta(META_RESOURCE_PATH)
var line_number: int = selected_item.get_meta(META_LINE_NUMBER)
var resource := load(resource_path)

if selected_item.has_meta(META_GDUNIT_REPORT):
var reports := get_item_reports(selected_item)
var report_line_number := reports[0].line_number()
# if number -1 we use original stored line number of the test case
# in non debug mode the line number is not available
if report_line_number != -1:
line_number = report_line_number

EditorInterface.get_file_system_dock().navigate_to_path(resource_path)
EditorInterface.edit_resource(resource)
EditorInterface.get_script_editor().goto_line(line_number - 1)
if selected_item.has_meta(META_LINE_NUMBER):
var line_number: int = selected_item.get_meta(META_LINE_NUMBER)
var resource := load(resource_path)

if selected_item.has_meta(META_GDUNIT_REPORT):
var reports := get_item_reports(selected_item)
var report_line_number := reports[0].line_number()
# if number -1 we use original stored line number of the test case
# in non debug mode the line number is not available
if report_line_number != -1:
line_number = report_line_number

EditorInterface.get_file_system_dock().navigate_to_path(resource_path)
EditorInterface.edit_resource(resource)
EditorInterface.get_script_editor().goto_line(line_number - 1)
elif selected_item.get_meta(META_GDUNIT_TYPE) == GdUnitType.FOLDER:
# Toggle collapse if dir
selected_item.collapsed = not selected_item.collapsed


################################################################################
Expand Down