Extension development: commenting ranges not shown when commentingRangeProvider added after a delay #126475
Labels
bug
Issue identified by VS Code Team member as probable bug
comments
Comments Provider/Widget/Panel issues
insiders-released
Patch has been released in VS Code Insiders
verified
Verification succeeded
Milestone
Does this issue occur when all extensions are disabled?: No, this issue is related to extension development
Version: 1.57.0-insider
Commit: b4c1bd0
Date: 2021-06-09T10:41:06.148Z
Electron: 12.0.9
Chrome: 89.0.4389.128
Node.js: 14.16.0
V8: 8.9.255.25-electron.0
OS: Darwin x64 19.6.0
CommentController
can havecommentingRangeProvider
assigned. This provider is responsible for indicating where commenting ranges should be shown.If the assignment happens after a delay (e.g. after API call), the commenting ranges are not shown in the active editor.
In the following video, I demonstrate the issue. I used the yeoman generated example extension and replaced the extension.ts with:
The video shows how having a delay between
vscode.comments.createCommentController
andcommentController.commentingRangeProvider
causes the active editor not to have commenting ranges.commenting-ranges-bug.mp4
I pushed the example extension to a public repository: https://gitlab.com/viktomas/demonstrate-commenting-ranges-bug/-/blob/master/src/extension.ts
This issue is an edge case and the fix could probably be just mentioning this bug in the JS Doc: https://github.com/microsoft/vscode/blob/main/src/vs/vscode.d.ts#L13448 I'm happy to create a PR.
The best fix would be either to make VS Code react to
commentingRangeProvider
being set on theCommentController
or addcommentingRangeProvider
as an argument to thevscode.comments.createCommentController
function call to signal that the commenting range provider must be ready at the time of creationThe text was updated successfully, but these errors were encountered: