Skip to content
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

Code Action: Allow enabling/disabling and improve ranking of explain #1211

Merged
merged 6 commits into from
Sep 29, 2023

Conversation

umpox
Copy link
Contributor

@umpox umpox commented Sep 27, 2023

Description

  • Group the fix and explain actions
  • Allow enabling/disabling the actions all together

Enabled:
image

Disabled:
image

Interface:
image

Test plan

Tested locally, enabling and disabling through interface and manually in VS Code settings

@@ -36,7 +36,6 @@ export class FixupCodeAction implements vscode.CodeActionProvider {
title: 'Ask Cody to Fix',
}
action.diagnostics = diagnostics
action.isPreferred = true
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't affect our ranking, just means users can't trigger this automatically with a keyboard shortcut (wasn't happening anyway AFAICT)

@@ -27,6 +27,7 @@ export class ExplainCodeAction implements vscode.CodeActionProvider {
arguments: [instruction, range],
title: 'Ask Cody to Explain',
}
action.diagnostics = diagnostics
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Means that the code action will appear right alongside the fix action, no other impact

@umpox umpox marked this pull request as ready for review September 27, 2023 17:58
@umpox umpox requested a review from a team September 27, 2023 17:58
Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently Ask Cody to Explain does nothing when inline chat is disabled. Should we show a pop-up or fall back to sidebar chat when inline chat is not enabled?

pull.1211.mov

When inline chat is enabled again:

image

@umpox umpox requested a review from abeatrix September 29, 2023 02:01
createFeatureToggle(
'Code Actions',
undefined,
'Enable Cody to fix or explain errors and warnings, directly in your code.',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'Enable Cody to fix or explain errors and warnings, directly in your code.',
'Enable Cody fix and explain options in the Quick Fix menu',

or:

Suggested change
'Enable Cody to fix or explain errors and warnings, directly in your code.',
'Enable Cody in the Quick Fix menu for fixing and explaining code errors and warnings',

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I like the first suggestion, will update

Copy link
Contributor

@abeatrix abeatrix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!
Not a block: is this a good place to register code action to listen for inline cofig change?

vscode.workspace.onDidChangeConfiguration(e => {
const config = vscode.workspace.getConfiguration('cody')
if (e.affectsConfiguration('cody')) {
// Inline Chat
const enableInlineChat = config.get('inlineChat.enabled') as boolean
if (enableInlineChat) {
this.commentController = this.init()
return
}
this.commentController?.dispose()
this.commentController = null
this.dispose()
}
})

@umpox
Copy link
Contributor Author

umpox commented Sep 29, 2023

@abeatrix Thought about it but I think it's OK to just keep the basic implementation for now. Doesn't feel like users will often enable/disable inline chat, and the extra overhead of having to register/deregister the action to ensure we don't have duplicate code actions isn't worth it IMO. We can adjust if we get feedback from users that we need this

@umpox umpox merged commit afe3fe9 into main Sep 29, 2023
12 checks passed
@umpox umpox deleted the tr/allow-disabling-code-action branch September 29, 2023 14:47
@umpox umpox self-assigned this Nov 13, 2023
@umpox umpox assigned umpox and unassigned umpox Nov 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants