-
Notifications
You must be signed in to change notification settings - Fork 563
enable display update #388
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
Conversation
| } | ||
|
|
||
| public FormattedValue FormattedValue { get; } | ||
| public string Id { get; } |
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.
For consistency, DisplayId would be better.
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.
Although I think this identifies a "value", not a "display", so here an in UpdateDisplayValue maybe we should rename this to ValueId?
|
|
||
| namespace Microsoft.DotNet.Interactive.Commands | ||
| { | ||
| public class UpdateDisplayValue : KernelCommandBase |
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.
Maybe UpdateDisplayedValue?
| bool isLastValue = false, | ||
| IReadOnlyCollection<FormattedValue> formattedValues = null) : base(command) | ||
| IReadOnlyCollection<FormattedValue> formattedValues = null, | ||
| string id= null, |
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.
ValueId?
|
|
||
| public string Id { get; } | ||
|
|
||
| public bool IsUpdatedValue { get; } |
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.
It seems like this should implicitly be true if an id is set. Would it not be a coding error if this is set to true while id is set to null?
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.
is false if id is not set, but can be false even if Id is set
| { | ||
| public interface IDisplayHandle | ||
| { | ||
| void Update(object value); |
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.
Maybe UpdateDisplayedValue?
| { | ||
| public class UpdateDisplayedValue : KernelCommandBase | ||
| { | ||
| public UpdateDisplayedValue(FormattedValue formattedValue, string valueId = null) |
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.
valueId is required, right? I don't think it should default to null.
| return Task.CompletedTask; | ||
| }; | ||
|
|
||
| displayedValue.Handler = invocationContext => |
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.
Doesn't this just over-write the Handler set in the line above this?
| .And | ||
| .ContainSingle(v => | ||
| v.MimeType == "text/html" && | ||
| v.Value.ToString().Contains("<b>world</b>")); |
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 assertion doesn't check that they're also in the correct order.
8e7d137 to
0799c88
Compare
| { | ||
| if (isUpdatedValue && valueId == null) | ||
| { | ||
| throw new ArgumentException("isUpdatedValue cannot be true with a null valueId", nameof(valueId)); |
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.
Please use nameof for the referenced parameter names.
ffe50aa to
679798f
Compare
display api returns a displayHandle that can be used to update the output in teh frontend