-
Notifications
You must be signed in to change notification settings - Fork 37.3k
feat: introducing new hover focus options for editor.action.showHover #196891
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
Conversation
|
@microsoft-github-policy-service agree |
|
cc: @aiday-mar @alexdima Thanks ;) |
|
Hi @aeschli, what do you think about this proposal? |
|
After looking at the PR, I find the text descriptions confusing with the new option. Perhaps instead of introducing a new option we could add a new state to the existing focus option. Currently it is a boolean, but it could take one of the following three string values:
In your case you would set the value of |
|
Hey @aiday-mar , I appreciate your detailed suggestion. It indeed presents a more comprehensive solution. I like the idea of extending the current Thanks for your rigorous and thoughtful input. Looking forward to discussing this further with you, @aeschli , and @alexdima . |
|
Hi @idootop, apologies for the delay in answering and thanks for the work so far. I discussed with the team and we think it would be a good change to indeed use the enum with the three possible states We will also do a hidden check within the code to verify if |
|
Hi @aiday-mar, thanks for the update. I agree, using the enum with the three states sounds like a good solution. I'll make sure to implement this later. Thanks again for your help! |
|
Hi @aiday-mar, I have completed the implementation of the enum with the three possible states (immediately, never, and ifVisible) as per our discussion. I have also thoroughly tested all the options to ensure everything works as expected. Could you please review the changes at your earliest convenience? Thanks ;) |
Background
The behavior of the
editor.action.showHoveraction in vscode was changed in version 1.73.0 (#176057). Previously, it would show a hover, but now it only shows the hover if it is not already visible, and focuses on it if it is visible.However, this change has caused issues for some third-party extensions, particularly translation plugins. These plugins rely on user text selection and use the
editor.action.showHoveraction to display translation results in a hover.Unfortunately, the new behavior introduced in vscode version 1.73.0 causes the editor to lose focus when subsequent
showHoveractions are triggered, preventing users from deleting or editing code and negatively impacting the user experience.Related issues: #176640, intellism/vscode-comment-translate#181
The known affected extensions include:
What's this PR
This PR introduces a resolution for the following issues:
A new enum has been integrated, offering three distinct hover
focusstates to enhance user control over theshowHoveraction's behavior:noAutoFocus: The hover will not automatically take focus.focusIfVisible: The hover will take focus only if it is already visible.autoFocusImmediately: The hover will automatically take focus when it appears.This enhancement provides developers with more flexibility and improves the user experience by allowing for customizable hover focus behavior.