Reuse never show again logic - work in progress#73968
Reuse never show again logic - work in progress#73968bpasero merged 8 commits intomicrosoft:masterfrom
Conversation
|
@bpasero I'll appreciate your thought on the general approach, so I know if to polish it further and make it ready for code review. Thanks in advance. |
|
@YisraelV yeah keep on going |
|
@bpasero this is ready for code review. Thanks! |
|
@YisraelV your solution is not preserving existing storage keys if I see correctly? We cannot break users that already made a choice by inventing new storage keys, we have to respect the current ones. If we introduce options to control this behaviour, I think we should make them available to both |
|
@bpasero totally missed breaking the current keys thanks! I see two ways around this:
What worries me about this solution is that it could cause collisions if client code provides too generic keys. If I was using the "never show again" functionallity in my code, and didn't know my key was saved directly to stoeage, I would probably think "fileTooBig" was a specific enough key.
Please tell me what you think. Regarding the notify method - will do. |
|
I think storing the key "as is" is OK, I mean we have been doing this today as well right? With the chance of collisions too. |
|
@bpasero that's right but until now the prompt caller was dealing with the storage directly, so there might have been more awareness to the need of very specific keys, whereas now the client code doesn't know the key is stored in storage, and therefore might provide too generic keys. Anyway if you don't think it's something to worry about I'll carry on. |
|
Understood, but I think we can document this and probably call this property " |
|
@bpasero I addressed the issues you pointed out. Thought it was better to add a second parameter to notify method since the first one is supposed to be passed forward to the model. Let me know if anything needs changing. Maybe it's best to use the new option of notify so we can make sure it works correctly? |
bpasero
left a comment
There was a problem hiding this comment.
@YisraelV I think we need to preserve today's behaviour where the "Do not show again" action can either show as primary or secondary action, right? Your solution seems to only put it as secondary option.
Also, for the notify() case I would have expected the neverShowOptions as part of INotificationProperties
|
@bpasero fixed let me know of any other changes. |
bpasero
left a comment
There was a problem hiding this comment.
@YisraelV some feedback provided. On top of that can we rethink if this "Do not show again" action appears as first or last choice? I feel like we should preserve todays behaviour where this action seems to appear as first entry and not last, simply because the most important buttons are typically more towards the right, but maybe you could check with our current usage and see what fits best.
There was a problem hiding this comment.
Move this into INotificationProperties you do not need it both here and in IPromptOptions
There was a problem hiding this comment.
Where is best to document the different default behaviors?
There was a problem hiding this comment.
The default in the prompt method is to show the "never show again" as primary action, while in the notify method the default is secondary (I thought that's what you suggested. Or maybe you meant secondary in both?)
the different behavior is documented separately in each interface.
There was a problem hiding this comment.
I think it is OK that the option is implemented differently depending on where it is being used.
There was a problem hiding this comment.
I prefer to not use underscores unless there is a public get access.
There was a problem hiding this comment.
I prefer to inline messages, not have them as variables.
There was a problem hiding this comment.
It's for the sake of reuse in "prompt" and "notify".
There was a problem hiding this comment.
Yeah don't worry about that, we are good as long as the key used for NLS is the same.
There was a problem hiding this comment.
Do you mean to make the key a member or just remove the member variable completely?
There was a problem hiding this comment.
No simply repeat the same nls.localize call twice, i prefer to read the english label in code where it is being used.
|
@bpasero thank you very much for the feedback. Please see my last commit. |
There was a problem hiding this comment.
| neverShowOptions?: INeverShowOptions; | |
| neverShowAgainOptions?: INeverShowAgainOptions; |
There was a problem hiding this comment.
Please correct the formatting and be a bit more descriptive
There was a problem hiding this comment.
| export interface INeverShowOptions { | |
| export interface INeverShowAgainOptions { |
There was a problem hiding this comment.
Suggest to add a comment explaining the purpose.
There was a problem hiding this comment.
I suggest to inline this method since it is very simple.
There was a problem hiding this comment.
I suggest to inline this method since it is very simple.
There was a problem hiding this comment.
The default cannot be secondary if the option is called isSecondary and is optional. Also it would change the way we used to do it for the large fie optimization case.
There was a problem hiding this comment.
How about:
appearance: 'primary' | 'secondary';
?
There was a problem hiding this comment.
@YisraelV I think the name isSecondary?: boolean; is fine, we use it for IPromptChoice as well but if not provided, it needs to default to being primary.
There was a problem hiding this comment.
@YisraelV I would make it consistent with the prompt choice, not sure what I thought back then.
There was a problem hiding this comment.
I would suggest to add the "Don't show again" as last entry to the secondary actions.
There was a problem hiding this comment.
I am sorry I forgot what you said about it in your comment. Will fix.
There was a problem hiding this comment.
I would suggest to add the "Don't show again" as first entry to the primary actions so that it appears first and the most important button is to the right.
4f32f7c to
7b8051b
Compare
|
@bpasero please see changes. Thank you. |
|
@YisraelV thanks, I will go ahead and merge it in with a few cosmetic changes. Since this is only the first half of the desired changes, how about you continue to adopt the new support around the places where today we still manually add a "Don't show again" button? I am not sure if we persist this choice in global storage scope everywhere, so we may need to beef up the options a little bit to allow for persisting the choice on the workspace scope too. |
|
@bpasero thanks for your guidance! I'll see if someone wants to take this up and if not I will. |
Solving #72417
@bpasero this is a work in progress, too early for a thorough code review, but the main api is there. Please let me know if you like the way this is going.
The main 2 points to emphasize:
The caller of "prompt" doesn't even know "never show again" was selected. They just call prompt and leave this logic to the service.
The "never show again" selections are persisted once when the program shuts down, and under a single key.