Vscode: Support command links in notifications

Created on 26 Mar 2018  路  5Comments  路  Source: microsoft/vscode

Now that notifications support links via markdown (which should be documented), it would be great if there was support for command links.

Can probably reuse MarkdownString if these will need to be trusted in the same way as hovers.

//cc @jrieken @bpasero

feature-request verification-needed verified workbench-notifications

Most helpful comment

It would be great if not only command: links were supported but also registered uri handlers. I attempted to register a Uri handler to provide a link from a notification, but it looks like only http|https is supported.

All 5 comments

I am not sure about MarkdownString because that might draw the wrong assumption that notifications support any markdown. Currently we only support links (http / https) and I would stay away from opening that too much to ensure notifications always have a consistent look.

I agree though that currently the fact that links are supported is a bit magic and hidden.

Yeah, definitely agree on the look/styling (although bold and italic might be nice), but command links could be valuable. For example, I am adding a notice to GitLens if you have the old set of keyboard shortcuts (which are known to conflict with other keyboard layouts), and I attempted to provide a link to open the GitLens Settings editor if someone wanted to jump there.

Something like this:
image

It would be great if not only command: links were supported but also registered uri handlers. I attempted to register a Uri handler to provide a link from a notification, but it looks like only http|https is supported.

So if I wanted to submit a PR for this -- I assume just adding vscode and vscode-insiders to this regex would be fine. https://github.com/Microsoft/vscode/blob/b2a361e9899cd20679a7592e1050487292c9a094/src/vs/workbench/common/notifications.ts#L328

But for command: links, I know when we talked about getting them in hovers there was security concerns and MarkdownString was added with the isTrusted property. Does the same thing need to be done here? Is that the right approach?

This is now possible using the following syntax: [link name](command:<command id> "Title")

@eamodio if you still feel we should support other link handlers, I suggest you open a separate feature request.

Was this page helpful?
0 / 5 - 0 ratings