question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Comments API: allow specifying whether reply can / will be Markdown & only style conditionally in reply input box

See original GitHub issue

This is a follow-up from #140967.

The reply input box for comments currently unconditionally interprets and styles input as Markdown, e.g. bolding & italicizing while typing or highlighting. Not all code review systems that interact with VS Code through the API support Markdown, so ideally their extensions would be able to prevent the reply input box from suggesting that content will be interpreted as Markdown after saving, to reduce confusion.

For the most basic approach, this could be a property on CommentController, e.g. CommentController.markdownReplies: boolean.


When these code review system start to support Markdown, they might allow users to opt-in individual comment threads in their respective UIs, e.g. through a [x] Use Markdown checkbox under the input box. For flexibility, it would be great if VS Code provided similar functionality.

To limit UI complexity, this could be governed by a setting on CommentController extending the basic approach above, e.g. CommentController.markdownReplies: 'always'|'never'|'prefer_markdown'|'prefer_plaintext' with the default being always.

  • always – no checkbox shown, comment content is interpreted and styled as Markdown in input box
  • never – no checkbox shown, comment content is interpreted as plain text and not styled
  • prefer_markdown – checkbox shown, default on (i.e. use Markdown)
  • prefer_plaintext – checkbox shown, default off (i.e. use plain text)

CommentReply would need a new property CommentReply.isMarkdown: boolean to transport what the user selected when a checkbox was shown.

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
alexr00commented, Mar 21, 2022

That input box is an editor, and so like most (all?) editors in VS Code it has a language associated with it. It might make sense to instead provide a language property on the CommentController or CommentOptions.

0reactions
alexr00commented, Jul 5, 2022

Here’s what I’m thinking for the proposal:

https://github.com/microsoft/vscode/blob/fc29d4bcdb9890e1d45afe948093b7b197daa47c/src/vscode-dts/vscode.proposed.commentEditorLanguage.d.ts#L10-L29

If anyone is interested in working on this then please comment here first and I will kick off our API review first so that we can make sure the proposal won’t change too much.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Conditionally display a block of text in R Markdown
It uses the block "engine" which seems to run fine although I'm not sure how to make inline R evaluation working.
Read more >
VS Code API | Visual Studio Code Extension API
VS Code API is a set of JavaScript APIs that you can invoke in your Visual Studio Code extension. This page lists all...
Read more >
7 Ways to Implement Conditional Rendering in React ...
In this article, you will examine seven ways to implement conditional rendering in React applications. Prerequisites. To complete this tutorial, ...
Read more >
Reference: Layout blocks - Slack API
The lists of fields and values below describe the JSON that apps can use to generate each block: ... If not specified, a...
Read more >
Pandoc User's Guide
If the input or output format is not specified explicitly, pandoc will attempt to ... Currently this option only affects the Markdown and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found