Skip to content
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

Implement modal message API #19717

Merged
merged 5 commits into from
Feb 3, 2017
Merged

Implement modal message API #19717

merged 5 commits into from
Feb 3, 2017

Conversation

joaomoreno
Copy link
Member

Related to #18790

@joaomoreno joaomoreno added api feature-request Request for new features or functionality labels Feb 2, 2017
@joaomoreno joaomoreno added this to the February 2017 milestone Feb 2, 2017
@joaomoreno joaomoreno self-assigned this Feb 2, 2017
@joaomoreno joaomoreno requested review from bpasero and jrieken February 2, 2017 15:15
Copy link
Member

@bpasero bpasero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

function parseMessageArguments(args: any[]): { options: vscode.MessageOptions; items: any[]; } {
const [first, ...rest] = args;

if (first && (typeof first === 'string' || first.title)) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if first === ''? The first check would fail even though it is a string

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great catch

@@ -58,4 +67,27 @@ export class MainThreadMessageService extends MainThreadMessageServiceShape {
});
});
}

private showModalMessage(severity: Severity, message: string, commands: { title: string; isCloseAffordance: boolean; handle: number; }[]): Thenable<number> {
let closeAffordanceIndex = -1;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just keep a boolean? I do not see closeAffordanceIndex being used for anything but that. Or is that an oversight?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leftover...

@joaomoreno
Copy link
Member Author

Pushed changes.

} else {
return { options: first || emptyMessageOptions, items: rest };
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the code but I don't like that it is placed here. Instead I'd propose to move it into the extHostMessageService and make its showMessage-function like: showMessage(sev, message, optionOrFirstItem, ...restItem). That would encapsulate things better IMO

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not entirely convinced. Made rest not a spread param. Pushed for extra review.

* Indicates that this message should be modal.
*/
modal?: boolean;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we already imagine having other options here? If not we should think about a naked boolean instead

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Timeout, icon?

Copy link
Member

@bpasero bpasero Feb 2, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer option bags simply because it is so easy to add stuff to them later without having yet another overload. Also, there is a lot more you can do in electron dialog API (for example master/detail message) and we could also revisit our message UI to support them eventually.

@jrieken
Copy link
Member

jrieken commented Feb 3, 2017

ok to 🚢 tho I don't understand the backticks?

@joaomoreno
Copy link
Member Author

:shipit:

@joaomoreno joaomoreno merged commit 7a9470d into microsoft:master Feb 3, 2017
@joaomoreno joaomoreno deleted the modal-message-api branch February 3, 2017 10:19
@joaomoreno joaomoreno mentioned this pull request Feb 21, 2017
3 tasks
@mike-lischke
Copy link

Even though this is scheduled for the February milestone it doesn't seem to be available in the April update yet. I installed the latest vscode.d.ts but still there is no message options yet. Has this been missed, replanned or am I doing something wrong?

@bpasero
Copy link
Member

bpasero commented Apr 17, 2017

@mike-lischke read https://code.visualstudio.com/docs/extensions/debugging-extensions#_common-questions

@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants