You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Given that VS Code has a Comments pane, it clearly knows all of the threads/comments contributed by a CommentController. It would be helpful if it were possible to get your own threads/comments back via the CommentController because it appears there are attributes of the comment that only VS Code knows. Specifically, as the content before the thread changes in the file, the range associated with the thread can change [the gutter decoration updates immediately, though it seems you have to click on a comment in the Comments pane before the associated [Ln XXX] text updates there], but I do not believe it is possible to get the updated range for a thread programmatically without tedious bookkeeping.
I tried to maintain my own set of vscode.CommentThread objects to see whether the range property would get updated automatically. I tried to capture every vscode.CommentThread as it was created, but as best I can tell, there is no way to intercept calls to createCommentThread() on a vscode.CommentController because even if I try something like:
I get a runtime error that createCommentThread is read only and cannot be reassigned.
My next best attempt was to instrument the function associated with the command I added to the comments/commentThread/context menu, as the corresponding callback function receives a vscode.CommentReply object, from which I can get the vscode.CommentThread via its thread property. I tried adding logic to capture these and maintain a set of these vscode.CommentThread objects, but their range properties to not appear to get updated as lines shift in the file.
All of this would be considerably simpler if I could just ask CommentController for the threads/comments so I don't have to do my own bookkeeping that will almost inevitably get out of sync with reality.
Before filing this issue, I did look for other closed issues for CommentController, and the most similar one I found was #200371, but that was asking for programmatic access to comments from other extensions whereas I am only asking for access to comments from one's own extension.
The text was updated successfully, but these errors were encountered:
Even if I add a command to the comments/commentThread/title menu where the associated callback receives a vscode.CommentThread directly, the range on that argument is still stale, so it's not even like I can add a "refresh" button to that menu because there is no way to tell at that point that the true range has changed.
Given that VS Code has a Comments pane, it clearly knows all of the threads/comments contributed by a
CommentController
. It would be helpful if it were possible to get your own threads/comments back via theCommentController
because it appears there are attributes of the comment that only VS Code knows. Specifically, as the content before the thread changes in the file, the range associated with the thread can change [the gutter decoration updates immediately, though it seems you have to click on a comment in the Comments pane before the associated[Ln XXX]
text updates there], but I do not believe it is possible to get the updated range for a thread programmatically without tedious bookkeeping.I tried to maintain my own set of
vscode.CommentThread
objects to see whether therange
property would get updated automatically. I tried to capture everyvscode.CommentThread
as it was created, but as best I can tell, there is no way to intercept calls tocreateCommentThread()
on avscode.CommentController
because even if I try something like:I get a runtime error that
createCommentThread
is read only and cannot be reassigned.My next best attempt was to instrument the function associated with the command I added to the
comments/commentThread/context
menu, as the corresponding callback function receives avscode.CommentReply
object, from which I can get thevscode.CommentThread
via itsthread
property. I tried adding logic to capture these and maintain a set of thesevscode.CommentThread
objects, but theirrange
properties to not appear to get updated as lines shift in the file.All of this would be considerably simpler if I could just ask
CommentController
for the threads/comments so I don't have to do my own bookkeeping that will almost inevitably get out of sync with reality.Before filing this issue, I did look for other closed issues for
CommentController
, and the most similar one I found was #200371, but that was asking for programmatic access to comments from other extensions whereas I am only asking for access to comments from one's own extension.The text was updated successfully, but these errors were encountered: