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
Split TS' AI-backed code actions into separate entries #201140
Conversation
Lets the user decide whether to add AI to their code action, which shows intent, which is good for us to learn whether people actually want this. Related: this should be unflagged for insiders. To do this, do I just delete the flags?
@@ -336,7 +346,7 @@ class TypeScriptQuickFixProvider implements vscode.CodeActionProvider<VsCodeCode | |||
expand = { kind: 'code-action', action }; | |||
} | |||
else if (action.fixName === fixNames.fixMissingFunctionDeclaration && vscode.workspace.getConfiguration('typescript').get('experimental.aiCodeActions.missingFunctionDeclaration')) { | |||
title += `Implement missing function declaration '${document.getText(diagnostic.range)}' using Copilot`; | |||
title = `Implement missing function declaration '${document.getText(diagnostic.range)}' using Copilot`; |
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 like a few of these messages could be marked to be localized
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.
Good point. I'm working with the JS/TS team to share resources with an eventual VS version of these code actions, which will make it more complex, because the title will likely be loaded from a json file or something.
Quick note: don't merge this yet; my current testing still shows it replacing the original codefix. Not sure what I was doing when I tested it 3 weeks ago. Edit: Looks like it's because both the original code action and the |
It's a workaround--I'm not sure of the right way to do this.
I pushed a hacky workaround for quickfixes -- refactors are already fine, which must have been what I actually tested when I wrote this in December. Edit: I guess that the code action for refactors doesn't set an edit until the action is resolved, so it's not available for deduping. I still haven't figured out how to mark actions with |
I modified the CodeActionSet class, but the change is only worthwhile if I have access to isAI so that I can skip the deduping code when isAI=true. @mjbvz, you linked me to a commit with a proposed change -- is this available on main? How do I get access to it in the typecript extension? |
@sandersn I've pushed the changes to use |
Sorry, I'm not sure how I missed this. I'll rewrite my change to use isAI and push another commit. |
I couldn't get the codeActionAI proposal to compile, and it's not compiling on CI either, but I changed the code to use |
Compiles on my (mac) laptop, so I pushed a small fix + a merge from main. Edit: But not on CI machines. =( |
It's possible to have copilot installed without copilot-chat.
I removed the experimental flag for AI code actions and instead check for github.copilot-chat. |
Lets the user decide whether to add AI to their code action, which shows intent, which is good for us to learn whether people actually want this.
Related: this should be unflagged for insiders. To do this, do I just delete the flags? But I think the code should check whether github copilot chat is installed then, instead of checking for the flag.