-
Notifications
You must be signed in to change notification settings - Fork 757
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
Remove empty line in required-properties snippet insertion #3721
Conversation
@@ -493,7 +493,6 @@ public async Task VerifyResourceBodyCompletionWithDiscriminatedObjectTypeContain | |||
azCliVersion: $3 | |||
retentionInterval: $4 | |||
} |
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.
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.
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.
Actually, final tab stop was always before the last '}'. So added it back without the newline as part of:
ee8fa54
Let me know if you have any questions/concerns.
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 think the answer depends on what the most likely action is after tab stopping through the snippet. If most of the time, the user doesn't add more properties, then we could actually put $0 after the last curly.
If we we think the user will most often add another property, then we might have to put $0 at the end of the value of the last property we inserted because pressing enter would let them add the property easily.
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.
Makes sense. Should we wait for more customer feedback regarding placement of final tab stop($0)? @MarcusFelling, @alex-frankel do you have any inputs?
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 thought about it some more. My guess is the following:
- Adding more top-level properties to resources is rare, so it's probably ok to assume that the user isn't going to do it.
- There are only 1-2 top-level writable properties in modules (
name
andparams
), so users will not be adding more. - Many swaggers don't mark all the inner (not top-level) properties as required, so I'm guessing users are more likely to add properties inside the resource.
- I don't know how likely the users are to provide values for optional module params.
Thoughts? This could get pretty complex, so I'm definitely open to keeping the logic simple. Just wanted to discuss first.
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 think the answer depends on what the most likely action is after tab stopping through the snippet. If most of the time, the user doesn't add more properties, then we could actually put $0 after the last curly.
I agree with this solution - it feels impossible to really predict what the user's next action is going to be, so putting a $0
after the last curly feels like the most agnostic option.
Inserting a $0
into the 'top-level' object (the current behavior) feels like we're attempting to make a prediction that inserting another top-level property is important - but who's to say the user cares about adding top-level properties, or perhaps the property they actually want to insert isn't actually a top-level property. IMO it feels best to offer a consistent experience that doesn't make significant predictions that are potentially incorrect.
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.
Had an offline discussion with @anthony-c-martin. Does anyone object to having the final tab stop to be outside the resource after last } at ln9 in above screenshot?
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.
Sounds good to me.
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.
2f7985a
to
cb14e64
Compare
Fixes #3632