-
Notifications
You must be signed in to change notification settings - Fork 162
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
Message template autocompletion broken #742
Comments
ROS 1 completion resulted in: rostopic pub /cmd_vel geometry_msgs/Twist "linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"
|
So this isn't ideal, but at least in bash if you start with a
It would be fantastic to figure out how to do that by default, so we don't need those beginning two letters. |
We could also use something without newlines (maybe json), as this most likely breaks the autocomplete. It seems like most autocompletion systems don't play well with long multi line strings. Maybe the autocompletion could be dropped for this argument, and we add an "interactive mode" where the user is able to edit the msg after sending the command. |
One could just leave the values field empy and a https://github.com/prompt-toolkit/python-prompt-toolkit multiline prompt is shown. |
Editing the msg like this would be fancy, try the snipped: from prompt_toolkit import prompt
from pygments.lexers.data import YamlLexer
from prompt_toolkit.lexers import PygmentsLexer
prompt("> ", multiline=True, default=
"""header:
stamp:
sec: 0
nanosec: 0
frame_id: ''
height: 0
width: 0
distortion_model: ''
d: []
k:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
r:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
p:
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
- 0.0
binning_x: 0
binning_y: 0
roi:
x_offset: 0
y_offset: 0
height: 0
width: 0
do_rectify: false""", lexer=PygmentsLexer(YamlLexer)) Both deps are commonly used, in the Ubuntu repos and cross platform, but the syntax highlighting is not that nessesary if you want to keep the deps low. |
True. This even seems to work in Windows. I'd be for adding a mode like this; I think it would be easier to use. I don't necessarily think we should make it the default (it is not useful for scripting), but for manual interaction it would be pretty cool. |
When publishing a topic via
ros2 topic pub
or calling a service viaros2 service call
the tab completion for the fields of the message is broken. The completion for the topic and message type works fine. The issue seems to be different between zsh and bash.In zsh:
The field of the message are all handled are possible cli parameters that can be autocompleted pressing tab iterates through the fields. Each of the fields has its escaped indentation in the beginning and is individually selectable. Creating a valid message is impossible even for small msgs.
Example:
In bash:
Bash looks overall better as the message template is printed as one piece, but contains many escape characters.
Example:
I observed this behavior on all ros2 machines I have used so far, making the cli unusable for publishing topics.
Bug report
Required Info:
Steps to reproduce issue
ros2 topic pub /camera_info sensor_msgs/msg/CameraInfo
and pressTAB
Expected behavior
A nicely formatted and editable string containing the message fields with their defaults should appear.
Actual behavior
Either the message is split and autocompleted in pieces (zsh) or cleaner (like in ros1) (bash)
Implementation considerations
I am not familiar with terminal formatting.
The text was updated successfully, but these errors were encountered: