-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Allow Code Lenses to only Provide a Title and no Backing Command #24469
Conversation
src/vs/vscode.d.ts
Outdated
@@ -1617,7 +1617,7 @@ declare module 'vscode' { | |||
/** | |||
* The command this code lens represents. | |||
*/ | |||
command?: Command; | |||
command?: Command | string; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jrieken I'm not a huge fan of this API design. Let me know if you have any suggestions on a better way to express this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A command is not a string, the Command | string
signature is a no-go
Instead of these changes, a simple fix for #24209 could be to use a no-op command that does nothing |
The code-lens code is ready for this which makes this somewhat a problem with strict null and our command signature
|
@jrieken The problem with using a noop command is that it still renders the lens as a clickable element. I was also hesitant to update the
None of these seem great |
I'll check but #24469 (comment) tells me that we have been using |
Fixes microsoft#24209 **Bug** Currently, for the js/ts references code lens, even if there are zero references you can click on the lens. This display an empty peek view **Fix** Allow code lenses to only register a title for the lens with no actual backing command
149d89c
to
a0cb432
Compare
Ok, I've switched to using an empty string for the case when there is no command. This works with the existing api and minimizes the number of changes we need to make |
Fixes #24209
Bug
Currently, for the js/ts references code lens, even if there are zero references you can click on the lens. This display an empty peek view. The root cause is that we always have to provide a command for these lenses, even if no action can really be taken
Fix
Allow code lenses to only register a title for the lens with no actual backing command. This lets a code lens display info to the user while not potentially incorrectly suggesting that more information is available by clicking