timkmecl / chatgpt-vscode

VSCode extension that allows you to use ChatGPT or GPT4 inside the IDE
331 stars 81 forks source link

Update: add vimdiff format in refactor default #2

Closed mefengl closed 1 year ago

mefengl commented 1 year ago

ChatGPT sometimes does some small refactoring and it is not easy to know where it is. After adding this prompt, it will show the changes in vimdiff format and explain those changes.

timkmecl commented 1 year ago

Thank you for the PR!

I like the idea, however I am not sure about adding this as the default option. The AI should already explain the changes, and as for some small ones you can see them after you click on them to replace the original selection in the editor if you use some version control system. It can be useful, but I think that's what the ability to change the queries in the settings is for.

In the future, I may be adding some Tips and tricks section to the readme, and am considering showing this there.

I am open to other opinions though, any thoughts?

mefengl commented 1 year ago

It will show the changed code first, followed by the vimdiff format. That is to say, like the explain, if you don't want to see them, just ignore them.

for example: now it is like:

this pr is like this:

do you think following a vimdiff format code with explanations inside near the code can be better? like this:

I don't know how to balance the complexity and the convenience of the default, but to me, the vimdiff format is necessary while the explanation isn't.

mefengl commented 1 year ago

maybe can make the prompt text setting from string to string[], then can simply select and unselect the function we want, in that case, we may be able to give as many options as possible and only a few is selected as default like

timkmecl commented 1 year ago

This is an interesting idea, I will look into it after the weekend.

timkmecl commented 1 year ago

Hi, since the extension currently doesn't work due to changes to the API, I am closing the pull request. Thank you anyway for trying to help:)