Fix auto-completed YAML string for ros2service#1201
Fix auto-completed YAML string for ros2service#1201leander-dsouza wants to merge 2 commits intoros2:rollingfrom
ros2service#1201Conversation
Signed-off-by: Leander Stephen D'Souza <[email protected]>
… characters Signed-off-by: Leander Stephen D'Souza <[email protected]>
|
@leander-dsouza thanks for coming back to fix this up, i will give it a shot and do review! |
fujitatomoya
left a comment
There was a problem hiding this comment.
ros2 topic pub <tab><tab>now suggests the available topics, this is unexpected behavior. i do not understand why we need to fixros2 topic pubbehavior here, can you explain why? see #1195 (comment)
root@tomoyafujita-B760M-Pro-RS-D4:~/ros2_ws/colcon_ws# ros2 topic pub <tab><tab>
/parameter_events /rosout ros2 service call <tab><tab>prints the all service types. i think it should print the available service list 1st. this is broken because #1194 (comment).
root@tomoyafujita-B760M-Pro-RS-D4:~/ros2_ws/colcon_ws# ros2 service call <tab><tab>
action_msgs/srv/CancelGoal map_msgs/srv/SaveMap rosbag2_interfaces/srv/Snapshot
/add_two_ints map_msgs/srv/SetMapProjections rosbag2_interfaces/srv/SplitBagfile
/add_two_ints_server/describe_parameters nav_msgs/srv/GetMap rosbag2_interfaces/srv/StartDiscovery
/add_two_ints_server/get_parameters nav_msgs/srv/GetPlan rosbag2_interfaces/srv/Stop
/add_two_ints_server/get_parameter_types nav_msgs/srv/LoadMap rosbag2_interfaces/srv/StopDiscovery
/add_two_ints_server/get_type_description nav_msgs/srv/SetMap rosbag2_interfaces/srv/TogglePaused
/add_two_ints_server/list_parameters rcl_interfaces/srv/DescribeParameters rosbag2_test_msgdefs/srv/BasicSrv
/add_two_ints_server/set_parameters rcl_interfaces/srv/GetLoggerLevels rosbag2_test_msgdefs/srv/ComplexSrvIdl
/add_two_ints_server/set_parameters_atomically rcl_interfaces/srv/GetParameters rosbag2_test_msgdefs/srv/ComplexSrvMsg
composition_interfaces/srv/ListNodes rcl_interfaces/srv/GetParameterTypes rviz_resource_interfaces/srv/GetResource
composition_interfaces/srv/LoadNode rcl_interfaces/srv/ListParameters sensor_msgs/srv/SetCameraInfo
composition_interfaces/srv/UnloadNode rcl_interfaces/srv/SetLoggerLevels std_srvs/srv/Empty
diagnostic_msgs/srv/AddDiagnostics rcl_interfaces/srv/SetParameters std_srvs/srv/SetBool
diagnostic_msgs/srv/SelfTest rcl_interfaces/srv/SetParametersAtomically std_srvs/srv/Trigger
example_interfaces/srv/AddTwoInts ros2cli_test_interfaces/srv/ShortVariedMultiNested test_msgs/srv/Arrays
example_interfaces/srv/SetBool rosbag2_interfaces/srv/Burst test_msgs/srv/BasicTypes
example_interfaces/srv/Trigger rosbag2_interfaces/srv/GetRate test_msgs/srv/Empty
lifecycle_msgs/srv/ChangeState rosbag2_interfaces/srv/IsDiscoveryRunning tf2_msgs/srv/FrameGraph
lifecycle_msgs/srv/GetAvailableStates rosbag2_interfaces/srv/IsPaused turtlesim_msgs/srv/Kill
lifecycle_msgs/srv/GetAvailableTransitions rosbag2_interfaces/srv/Pause turtlesim_msgs/srv/SetPen
lifecycle_msgs/srv/GetState rosbag2_interfaces/srv/Play turtlesim_msgs/srv/Spawn
logging_demo/srv/ConfigLogger rosbag2_interfaces/srv/PlayNext turtlesim_msgs/srv/TeleportAbsolute
map_msgs/srv/GetMapROI rosbag2_interfaces/srv/Record turtlesim_msgs/srv/TeleportRelative
map_msgs/srv/GetPointMap rosbag2_interfaces/srv/Resume type_description_interfaces/srv/GetTypeDescription
map_msgs/srv/GetPointMapROI rosbag2_interfaces/srv/Seek visualization_msgs/srv/GetInteractiveMarkers
map_msgs/srv/ProjectedMapsInfo rosbag2_interfaces/srv/SetRateros2 service call /add_two_ints <tab><tab>does not suggest service types nor default values at all. this is also still broken.
root@tomoyafujita-B760M-Pro-RS-D4:~/ros2_ws/colcon_ws# ros2 service call /add_two_ints <tab><tab>
build/ example_qos_overrides.yaml param_ok.yaml test-policy.xml
DEFAULT_FASTRTPS_PROFILES.xml install/ .pytest_cache/ test.py
demo_keystore/ log/ ros2/ test.sh
dump.yaml param_ng.yaml src/ yaml_sample.py
What's wrong with this? You often want to publish on an existing topic... |
|
@peci1 yeah what was i thinking... 😓 and behavior seems to be same, please ignore that comment, sorry! |
|
I can confirm @fujitatomoya observations in current rolling branch. I can't confirm the failure from the initial message but I get a different one (similar I'd say): DetailsWhat I can confirm that the prototype autofilled for ros2 service call is now the much friendlier multiline one without backslashes, and the prototype can be right away used. So I think this PR can be merged and then we'll have to fix the service type suggestions separately. |
Thank you for the initial review, Tomoya :) This PR fixes the incorrect formatting of the YAML string for default values once the service name and service type are known. For instance, tabbing at the specified location now renders - $ ros2 service call /add_two_ints example_interfaces/srv/AddTwoInts <tab> |
|
Pulls: #1201 |
fujitatomoya
left a comment
There was a problem hiding this comment.
lgtm with green CI. thanks for the explanation.

Basic Info
Description
Renamed
YamlCompletionFindertoUnescapedCompletionFinderto better indicate intent.This function is further simplified to return the unedited completions to the terminal on all conditions, which would otherwise be filled with special characters from
argcomplete.Moved
UnescapedCompletionFinderto thehelpers.pyscript for reusability with other methods.Configured
ros2serviceto use this custom completion finder in the same way as configured in Custom Completion Finder for fetching topic prototype. #995 forros2topic.How to test
Run an example node that hosts a demo service -
/add_two_ints:demo_service.py:On a separate terminal, execute the test script:
Before this addition, the autocomplete would fail as follows:
After the addition of this PR, this is the expected output:
Is this user-facing behavior change?
Yes, the user-facing behavior change is described in the testing section.
Did you use Generative AI?
No
Additional Information
For distros semantically lower than
rolling, a check for^Jis still needed:For instance, tabbing the given example in
kiltedorjazzyresults in the following: