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
Assigning undefined to commentThread.contextValue doesn't reset the backing context key #120680
Comments
(Experimental duplicate detection) |
@roblourens can you check the context keys for the buttons and share the value of |
I added a second button so I can get the context of the menu, and it seems like
|
@roblourens I didn't quite follow the issues you ran into. Did you mean that after running "hello World", the context key for the comment thread is not set to |
I run the first command |
Steps to Reproduce:
package.json
, have a menu contribution registered forcomments/commentThread/context
to show some command with"when": "commentThread != sentinelForPackageJson"
contextValue
unassigned for nowpackage.json
is currently visible in a comment thread; type a reply and click the button for that commandcontextValue
to"sentinelForPackageJson"
(similar to the example extension inmicrosoft/vscode-extension-samples/blob/main/comment-sample/src/extension.ts
when handlingmywiki.startDraft
). My extension also sets the thread'scanReply
value tofalse
at the same time.canReply
value totrue
and set itscontextValue
toundefined
. Observe that in this case, the command from 1 is not rendered, but the textbox to type a reply has reappeared.I've been playing around with it, and if instead of setting the
contextValue
to undefined in step 6, I set some other random arbitrary value, then the context key is updated correctly and the command does reappear. I believe it has something to do with the slight difference incommentThreadWidget.ts
, specifically around_commentThreadContextValue
:Using the inspect context keys tool, the
commentThread
context key is still set to"sentinelForPackageJson"
, even though the object's property is definitelyundefined
after the command in 6 runs. For some reason, it seems the lifecycle of the comment thread is latching on to"sentinelForPackageJson"
as the default value, even though it wasn't assigned anywhere near the thread's creation time, and was only done so later after user action had taken place + the thread was updated to append a new comment.Does this issue occur when all extensions are disabled?: No
This is an extension I've been writing.
The text was updated successfully, but these errors were encountered: