这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@colombod
Copy link
Member

display api returns a displayHandle that can be used to update the output in teh frontend

}

public FormattedValue FormattedValue { get; }
public string Id { get; }
Copy link
Contributor

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.

Copy link
Contributor

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
Copy link
Contributor

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,
Copy link
Contributor

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; }
Copy link
Contributor

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?

Copy link
Member Author

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);
Copy link
Contributor

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)
Copy link
Member

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 =>
Copy link
Member

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>"));
Copy link
Contributor

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.

@colombod colombod force-pushed the feature/update_display branch from 8e7d137 to 0799c88 Compare August 21, 2019 21:43
{
if (isUpdatedValue && valueId == null)
{
throw new ArgumentException("isUpdatedValue cannot be true with a null valueId", nameof(valueId));
Copy link
Contributor

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.

@colombod colombod force-pushed the feature/update_display branch from ffe50aa to 679798f Compare August 22, 2019 08:07
@colombod colombod merged commit f819b22 into dotnet:master Aug 22, 2019
@colombod colombod deleted the feature/update_display branch August 22, 2019 13:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants