ChatGPT: Modify Selection: Appendix GPT Answer

I often use GPT and find this action very useful, but I have a question.

It’s very convenient to ask GPT for a request on the selected text and have it returned by GPT, but the fact that the original selected text is replaced can be convenient at times and inconvenient at others.

If I were to rewrite this script, where would I need to touch to make it so that “the answer result is appended after the original selected text”? :upside_down_face:

Untested, but I think changing the following…


… to …

answer  = editor.getSelectedText() +"\n\n" + answer

… will do it.


It works, thank you!!!