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

Allow comments to include command links #93034

Closed
lostintangent opened this issue Mar 19, 2020 · 3 comments
Closed

Allow comments to include command links #93034

lostintangent opened this issue Mar 19, 2020 · 3 comments
Assignees
Labels
comments Comments Provider/Widget/Panel issues *question Issue represents a question, should be posted to StackOverflow (VS Code)
Milestone

Comments

@lostintangent
Copy link
Member

lostintangent commented Mar 19, 2020

Currently, the comments API allows comments to include links to HTTP-based resources, but it would be great if they could also include references to VS Code commands (using the [](command:commandName) syntax). As part of building out the CodeTour extension, I'd like to be able to have tour steps include links to automate workbench actions such as starting the debugger/etc. (as opposed to telling the user to do it), which would help create a more interactive/guided experience.

To ensure this experience is secure/predictable, maybe the CommentController could introduce a new setting that determines whether command links are enabled or not? The WebViewOptions type already include a enableCommandUris setting, and so maybe we could add the equivalent to the CommentController? That way, the GitHub PR extension doesn't need to support them/etc. if it doesn't make sense.

// CC @rebornix

@rebornix rebornix added feature-request Request for new features or functionality comments Comments Provider/Widget/Panel issues labels Apr 6, 2020
@rebornix rebornix added this to the April 2020 milestone Apr 6, 2020
@rebornix
Copy link
Member

rebornix commented Apr 8, 2020

Hey @lostintangent , I just realized this is already supported as we allow using MarkdownString for Comment.body, all you need to do in the extension is when you create a Comment object, make sure that isTrusted is set on vscode.MarkdownString.

let markdownBody = new vscode.MarkdownString(reply.text);
markdownBody.isTrusted = true;

let newComment = new NoteComment(markdownBody, vscode.CommentMode.Preview, { name: 'vscode' }, thread, thread.comments.length ? 'canDelete' : undefined);

@rebornix rebornix added the *question Issue represents a question, should be posted to StackOverflow (VS Code) label Apr 8, 2020
@lostintangent
Copy link
Member Author

Ah OK awesome! Thanks for that tip 👍

@rebornix rebornix removed the feature-request Request for new features or functionality label Apr 29, 2020
@github-actions github-actions bot locked and limited conversation to collaborators May 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
comments Comments Provider/Widget/Panel issues *question Issue represents a question, should be posted to StackOverflow (VS Code)
Projects
None yet
Development

No branches or pull requests

3 participants
@lostintangent @rebornix and others