Comments API: allow specifying whether reply can / will be Markdown & only style conditionally in reply input box
See original GitHub issueThis 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 boxnever
– no checkbox shown, comment content is interpreted as plain text and not styledprefer_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:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top GitHub Comments
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 theCommentController
orCommentOptions
.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.