-
Notifications
You must be signed in to change notification settings - Fork 323
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
Basic dropdown widget integration #4013
Conversation
6beece1
to
107aaf5
Compare
CHANGELOG.md
Outdated
@@ -79,6 +79,8 @@ | |||
the project is changed from the last saved snapshot and lighter when the | |||
snapshot matches the current project state. | |||
- [Added shortcut to interrupt the program][3967] | |||
- [Added dropdown for node argument value suggestions.][4013] Currently it |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be understandable by the user (user != power user). This sentence is really hard to parse. Can we make it a little bit more elaborate and easier to understand, please?
|
||
/// Possible widgets for a node input. | ||
#[derive(Clone, Debug, CloneRef)] | ||
pub enum NodeWidget { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of such Enum, I'd allow any "widget" to be registered on nodes. Just like visualisations. We should allow for custom widgets in the future (as we allow for custom visualisations). We can leave it for now, but in such a case, we should write in the comment that this is a temporary solution that will be removed in <...> task.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to add a note in the comment in this specific case. But in general I don't like putting comments about uncertain future into the code. The current dynamic widgets design doc lists all initial widget types explicitly, so this is why I went with an enum to begin with, as that was the pragmatic choice.
Given that we have dynamic visualizations, I agree that this is likely to change at some point. But I believe we don't yet have any specific tasks planned for that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The design doc lists all the things in order to make it easy to understand. However, the design in the code should be generic, as we know that we will have user-defined widgets sooner than later. Changing such a fundamental assumption later would make a lot of changes in the code, so it's better to do it in the code beforehand. I'd like to make it the extensible way before all the widgets tasks are finished, so just please take care of that when designing the arch here :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got the static drop down widgets working on the Text.trim
example. Selecting a value for an argument works, but how do I "unselect an argument value"? In the following picture
I have got wrong value for what
(tracked in pivotal) - shouldn't the user be able to click and revert the what
value back to default?
Other than that, I am really glad the drop down feature is coming. It really improves the usability of the IDE.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've done similar QA and have similar comments to Jaroslav - essentially I would like to come back to the default value without deleting the node completely and starting from scratch. How would I do that?
ArgumentInfo::new(t.name.clone(), t.tp.clone(), t.tag_values.clone()), | ||
Self::InsertionPoint(t) => | ||
ArgumentInfo::new(t.name.clone(), t.tp.clone(), t.tag_values.clone()), | ||
_ => return None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a Rust
expert but I find this explicit return rather unexpected. I preferred the previous style even if it was more verbose.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've seen and used this specific pattern (wrapping match in Some
and returning None
in specific branch) many times before, my impression is that it is fairly common. But I agree that for short match blocks like this it is probably not worth. In this specific case, it is allowing the expression to fit into a single line. Given that I'm going to add another parameter here anyway, I might split it into multiple lines and get back to the fully implicit return form.
@Frizi are the names somehow specially formatted already or is that customized for |
According to the original design the idea was:
|
My understanding is that the fully qualified names delivered in It is not possible to deselect the dropdown option right now after selecting it, but It sounds fairly easy to add for arguments that have |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@hubertp the parameters are not gone. There are |
I see, yeah, I had to zoom in the screenshot. But why are there |
Good question. The dropdowns fills in the argument AST position with the given value. It is always treated as a positional argument. That means all arguments in front of it are automatically filled with Using argument names directly leads to all sorts of wrong parsing. I don't think that this syntax is in well supported in IDE now, and certainly it is out of scope of this PR. |
c3ff113
to
5a27ca2
Compare
5a27ca2
to
a6fcebe
Compare
When removing the dropdown could we come back to what was before (i.e. not Kazam_screencast_00005.mp4 |
It is similar reason. Outright removing an argument in first position isn't possible. I am not sure why but it is explicitly disallowed by the spantree logic. This behaves exactly the same as disconnecting an edge would. When a function has more arguments and you unselect the last one, it will be completely removed. |
Pull Request Description
Implements https://www.pivotaltracker.com/n/projects/2539304/stories/184023445
Added a dropdown widget to graph node for all span tree nodes that have tag values present. When an option is selected, the controller receives a partial expression update, which targets specific crumbs of the expression (similar to how edge endpoint updates work).
trim-dropdown.mp4
Important Notes
Right now the dropdown widget is recreated every time the node is edited, including a dropdown option being selected. This causes it to close every time. I wanted to get around that by diffing span trees, but I wasn't able to do it in useful way. Additionally, current implementation of node input expression view heavily relies on being reinitialized from scratch every time. This led to more necessary changes than I was comfortable with for this task. I believe it will be easier to implement it as part of more complete widget support, especially after dynamic data support, as we will have proper widget type information.
Checklist
Please include the following checklist in your PR:
Scala,
Java,
and
Rust
style guides.
./run ide build
and./run ide watch
.