-
Notifications
You must be signed in to change notification settings - Fork 298
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
Feature Flag: Hover Commands #3585
Conversation
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.
This is an awesome idea, and I totally agree that there's a lot of value to be unlocked by catering for mouse-only users.
I have left some comments, I think as this is a really high-visibility change we should be super careful to nail the UX so it's not annoying for users.
WDYT about starting v1 of the experiment for just "Document" and then we can add enhancements onto it? I think we'll need a couple of tree-sitter changes to support some of the other cases without it possibly being annoying for users (e.g. explain)
Excited to see where this goes and happy to pair on this to help!
// Display Chat & Edit commands when the current position is empty | ||
commandsOnHovers.chat.enabled = true | ||
commandsOnHovers.edit.enabled = true |
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.
Hmm, this means that the user will see this all the time. It feels quite aggressive compared to other cases where we only show if we think there's a good chance that the user will find value in it.
Should we consider removing this for V1 of this experiment? I worry that it could be annoying for users, especially as they'll immediately just see our logo!
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.
I'm actually more inclined to be more aggressive on v1 so we can get more data first before we make any adjustments like we did with ghost text v.1.
Moreover, the hover provider shows up when users specifically hover on a piece of code or symbol, so I think the hover actions is much more intentional here.
I hear your concerns though! we can update it so that it will only show on hover with a delay (if user has hovered over the code for x seconds vs showing up on any mouse moves), but I'd like to keep the commands to show up on non-symbol codes to make the commands more discoverable and accessible.
And maybe for v1 we can just roll out to a smaller group of users (10%?), and add an option to turn off the feature right on the hover, Wdyt?
Cc @chillatom @chenkc805 does this sound ok to you all? (I'll move the discussion to slack)
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.
+1 we chatted about this live. Making this more aggressive helps test the discoverability hypothesis, so I'm supportive of it.
For power users, let's include a checkbox in the user settings where users can turn this off if they want.
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.
@chenkc805 We chatted about this with @chillatom too. We agreed to show this where there are existing hovers for now, rather than add lots of new ones from Cody. This will still be aggressive and get loads of visibility, but has less chance of being annoying to users. We can look at the idea of showing them everywhere as a follow up
When hovering over multiple lines and choosing 'New Chat' will these lines
One potential downside could be, that users use the web version of VSCode (and if it is a non-PWA) that hovering will mostly not work. |
Co-authored-by: Tom Ross <tom@umpox.com>
I’d love a chance to properly review this. At a glance from the description, don’t experimental settings get filtered out by the production build? (so there’d be no visible way for users to disable this in settings if they didn’t like it) |
The setting is undocumented so they can still set it in their User settings JSON file to disable it. I've tested and confirmed that'd work 👍 After discussing with @umpox @chenkc805 @chillatom , we have agreed to show the commands on existing hovers so that it'd be less likely for users to find it distracting and want to disable it. They still can though! |
Users should be able to see it in settings so they can disable it if they wish. Can we make sure they have a visible way to disable (in user settings)? I’d still like a chance to review this please! |
(Given its feature flagged, can review on main before a user rollout too) |
@toolmantim @abeatrix Let’s catch up next week and discuss, I think we’re getting to a good place but would be good to get your eyes from a design POV. We can discuss how this can work alongside the ghost text too |
@toolmantim @umpox @chenkc805 Yea i'll also start a thread on Slack so we can do this async since i'm not sure if we can find a time that would work for everyone. I'll make sure not to enable the feature flag for users until then. In the meantime, we can still roll this out to main so that we can test this internally (I've enabled this feature flag for all Sourcegraph teammates). @umpox At least for phase 1 (v1), IMO this experiment should be treated independently from ghost text, as any additional changes to existing features would add new variables to the outcome, and the main goal of this experiment is to see how users behave with mouse v.s. keyboard shortcuts. We should then use the data we get back from phase 1 to make further improvements and adjustments to the experiment and features accordingly if that makes sense. |
@umpox ive updated the behavior to match what we discussed earlier:
On telemetry side:
Let me know if I missed anything 😃 |
@toolmantim added status bar toggle |
Similarly to how Opt-k works now, can we make sure not to mess with people's selections when they run Edit Code or New Chat? Currently it changes your selection, and doesn't restore when you hit escape, whereas Opt-K doesn't seem to change it. CleanShot.2024-04-02.at.14.13.53.mp4 |
@toolmantim updated. |
BusyDoc.mov@abeatrix @toolmantim This can get pretty busy with GitLens and other extensions 🤔 Maybe not an issue for the experiment but possibly something to consider for the future |
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.
Feels good! Left some comments I think we should address
const activeSymbolRange = document.getWordRangeAtPosition(position) | ||
const activeSymbol = activeSymbolRange && document.getText(activeSymbolRange) | ||
if (activeSymbolRange && this.symbolStore.some(s => s.name === activeSymbol)) { | ||
this.currentHoverSymbol = activeSymbol | ||
commandsOnHovers.chat.enabled = true | ||
commandsOnHovers.edit.enabled = true | ||
return Object.values(commandsOnHovers) | ||
} |
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.
I don't think we should use name
as an identifier for a symbol, as it's not unique for symbols. E.g. you can have const name
in two different functions in JS, and they are not the same.
Can we just use the range instead?
const activeSymbolRange = document.getWordRangeAtPosition(position) | |
const activeSymbol = activeSymbolRange && document.getText(activeSymbolRange) | |
if (activeSymbolRange && this.symbolStore.some(s => s.name === activeSymbol)) { | |
this.currentHoverSymbol = activeSymbol | |
commandsOnHovers.chat.enabled = true | |
commandsOnHovers.edit.enabled = true | |
return Object.values(commandsOnHovers) | |
} | |
if (this.symbolStore.some(s => s.range.contains(position))) { | |
commandsOnHovers.chat.enabled = true | |
commandsOnHovers.edit.enabled = true | |
return Object.values(commandsOnHovers) | |
} |
It looks like "currentHoverSymbol" is only used for the "Explain symbolName
" on click of "New Chat". But if we make "New Chat" behaviour the same as it is for when there is a selection (just opens a chat), then we might not need 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.
Can we make "New Chat" start a new chat with the message input containing the line range? e.g. "@some-file.ts:42-43" if you clicked "New Chat" from a const statement on line 42
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.
I won't be able to get it to work in v1, but i added a workaround for now where we just start a new chat and say I have a question about @file
so that users can just ask questions after that.
Co-authored-by: Tom Ross <tom@umpox.com>
Just re-adding my comment from above: Can we include "New Chat | Edit Code" on all hovers, I think this makes sense given these actions are always available, whereas documentation and explain is dependent on the active symbol. I immediately noticed that I went to edit a function but this action wasn't available cc @toolmantim for thoughts here |
…ags (#3662) Co-authored-by: Tom Ross <tom@umpox.com>
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.
Looks great, thank you for being so thorough with these changes!
🚀 |
@umpox thank you for sharing your feedback and for your through review as well <3 |
Description
CONTEXT: Hover Commands A/B test.
This pull request introduces a new feature to display Cody commands in a pop-up window when hovering over code. The feature is controlled by a new feature flag
cody-hover-commands
and can be enabled/disabled via user configuration.The feature is currently controlled by a new feature flag,
cody-hover-commands
on DotCom; however, users with the feature flag enabled can turn off this feature via VS Code configuration with:NOTE: Configuring this setting alone will not enable the feature as it depends on the feature flag.
New events:
hover
.Test plan
Expected Behavior
Doc
andExplain
commands will show up.Chat
andEdit
command will show up.Explain Code
command will show up.Configurable for users with feature flag enabled
Users without the feature flag shouldn't be able to see this option.
Ghost Text
Users with the hover commands feature flag will have Ghost Text disabled.
Telemetry Events
CodyVSCodeExtension:experiment:hoverCommands:enrolled
Requirement: "They should be fired as soon as possible for the user and ideally once in the user's lifetime."
All users will log this event the first time they initiate the extension that has this feature built-in.
Users who are part of the experiment are logged as the "treatment" variant (v.s. "control")