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

Improve notification APIs #44121

Closed
mattacosta opened this issue Feb 21, 2018 · 3 comments
Closed

Improve notification APIs #44121

mattacosta opened this issue Feb 21, 2018 · 3 comments
Assignees
Labels
api *out-of-scope Posted issue is not in scope of VS Code under-discussion Issue is under discussion for relevance, priority, approach workbench-notifications Notification widget issues

Comments

@mattacosta
Copy link
Contributor

mattacosta commented Feb 21, 2018

Summary
The current notification API does not currently provide a distinction between notifications (these don't require user interaction) and prompts (these do require user interaction) or implement the required functionality for additional notification features that have been requested. This also results in instances where the wrong UI element is used, which hinders the workflow of some users.

Proposal

Add a notification manager containing related notification methods to the window object.
Ex: window.notifications.addError('Something bad happened.');

The manager would provide the following methods and events:

  • addInfo(): accepts a message and options parameters, returns a notification object
  • addWarning(): accepts a message and options parameters, returns a notification object
  • addError(): accepts a message and options parameters, returns a notification object
  • getNotifications(): returns a list of notifications
  • onDidAddNotification: event that invokes a callback that receives a notification object
  • removeNotification(): accepts a notification, tag, or extension id

 
The NotificationOptions object would also contain the following properties:

  • title: string
  • details/source: markup?
  • buttons: array
  • tag/group: string
  • isExpanded: boolean (for backward-compatibility)

 
The Notification object contains information about the added notification and an onDismiss event. This object would also be required for other features, such as #44122.

Add a generic showDialog method to the window object.

// TODO: This method would... accept simple message parameters, or an object that implements an abstract Dialog class? Could these dialogs also show custom markup?

Backwards compatibility
The current APIs should be marked deprecated.

If desired, an "adapter" class or service could also redirect deprecated API calls to the most appropriate (notification or dialog box) action, thereby allowing use of updated UI elements by deprecated code in most cases.

@jrieken jrieken added api under-discussion Issue is under discussion for relevance, priority, approach workbench-notifications Notification widget issues labels Feb 28, 2018
@jrieken
Copy link
Member

jrieken commented Feb 28, 2018

Well, there is a little known flag to make messages modal, so enforce user to act on them.

@jrieken jrieken added the *out-of-scope Posted issue is not in scope of VS Code label Feb 26, 2019
@vscodebot
Copy link

vscodebot bot commented Feb 26, 2019

This issue is being closed to keep the number of issues in our inbox on a manageable level, we are closing issues that are not going to be addressed in the foreseeable future: We look at the number of votes the issue has received and the number of duplicate issues filed. More details here. If you disagree and feel that this issue is crucial: We are happy to listen and to reconsider.

If you wonder what we are up to, please see our roadmap and issue reporting guidelines.

Thanks for your understanding and happy coding!

@vscodebot vscodebot bot closed this as completed Feb 26, 2019
@ORESoftware
Copy link

I have a question - is there documentation on how to ping VSCode from another process on the same machine and tell VSCode to display a notification? Is VSCode listening on localhost?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api *out-of-scope Posted issue is not in scope of VS Code under-discussion Issue is under discussion for relevance, priority, approach workbench-notifications Notification widget issues
Projects
None yet
Development

No branches or pull requests

3 participants