pasky / claude.vim

Claude vim plugin for AI pair programming - a hacker's gateway to LLMs
MIT License
160 stars 4 forks source link

Handling multiple returned code snippets #10

Open codr1 opened 2 weeks ago

codr1 commented 2 weeks ago

I really like interacting with the plugin, but one thing that I am not sure how to do yet is dealing with multiple code snippets in the returned code.

For example, let's say I get this:

  1. Modify the download_and_extract_repo function to reflect these changes.

    Let's start with updating the safe_extract function:

    def safe_extract(tar, path=".", directory_to_extract="integrations"):

    Now, let's update the download_and_extract_repo function:

    def download_and_extract_repo(settings):
      # Set the working directory to the project root
      script_dir = Path(__file__).resolve().parent

I only get a diff with the second snippet. Is there a button or something I can press to generate a diff with the first one as well?

codr1 commented 2 weeks ago

In this case I requested that Cluaude generate one line comments for functions. I had two buffers open - my code above and Claude.vim below. After Cluade.ai generated the answer, this is what my screen turned into. The two buffers on top are essentially exactly the same. The No Name buffer is identical to my code. And then on the bottom - there are a bunch of floded snippets. Is there a button or a shortcut to turn a snippet into a diff that I can then or ? image

codr1 commented 2 weeks ago

In this example - it worked pretty well, except for the last fold. You can see that the No Name buffer on the right shows that the Main function should be gone, while the actual text that came back from Claude (on the botton) is showing the actual code that should be placed in. Screenshot 2024-08-27 at 23 12 17

Doerge commented 1 week ago

I have had the same experience. [c and ]c doesn't do anything. There is only the last patch in diff mode.

Perhaps a key-combo to "apply" the code snippet under the current fold in the chat window could be a good idea?