aws-toolkit-vscode icon indicating copy to clipboard operation
aws-toolkit-vscode copied to clipboard

amazonq: Translate a piece of code into another code language

Open tverney opened this issue 2 years ago • 4 comments

Problem

We have the ability to highlight a piece of code and send it to the prompt, but we don't have any functionality that allow quick translate that piece of code into another language.

For example, I have a selected code in JS and I ask to create the same idea in a PY or Java code. I think this would give users a lot of flexibility and use.

Screenshot 2024-07-23 at 1 22 15 PM

PS: If I ask in the prompt, it already does that, but its verbose, and I think a quick action would make a lot of sense.

Expected behavior

Have a quick action to send selected code into context that user can select which language wants translate to.

tverney avatar Jul 23 '24 17:07 tverney

Choose Send to prompt, then type translate to python in the prompt and hit enter.

Do you have ideas on how this can be improved?

justinmk3 avatar Jul 24 '24 14:07 justinmk3

Choose Send to prompt, then type translate to python in the prompt and hit enter.

Do you have ideas on how this can be improved?

Maybe we add the selected code in the answer and a dropdown to select which language we want to translate to?

tverney avatar Jul 24 '24 15:07 tverney

By the way, this would be really useful if Q give me the code answer in a language that I'll not be using or don't have in the project.

Majority of the code here is in js|ts|tsx (just few in py) and the answer its given in py. I would like to be able to quickly transform to JS for example. This requires I alter my original question and ask to translate to another. Sounds OK, but if its an easy win instead of making users ask again would be cool.

@justinmk3

Screenshot 2024-07-25 at 1 09 16 PM

tverney avatar Jul 25 '24 17:07 tverney

We consider this out of scope. Using chat commands is the recommended way to achieve this.

justinmk3 avatar Sep 03 '24 21:09 justinmk3