gp.nvim icon indicating copy to clipboard operation
gp.nvim copied to clipboard

rewrite and append with full file context

Open tommyengstrom opened this issue 1 year ago • 8 comments

This adds support for including the whole file in addition to the selected text in rewrite and append selection.

I don't expect this to be merged as is. Mostly wanted to ask if you'd like to add this if I clean it up a bit. Let me know what you think.

tommyengstrom avatar Jun 19 '24 12:06 tommyengstrom

@Robitx this looks awesome, could you merge?

quolpr avatar Jun 23 '24 13:06 quolpr

hehe. yeah, this is not intended as a final PR, just checking if there's interest.

Should I go ahead an clean it up a bit? I.e. mostly doing what @quolpr suggested.

tommyengstrom avatar Jun 24 '24 12:06 tommyengstrom

Definitely interested! Thank you for creating this PR!

Looks like there are conflicts to be resolved.

1orZero avatar Jun 25 '24 10:06 1orZero

+1 interested in this, and @quolpr suggestions such as extracting the 4o model change to a new PR.

gonzaloserrano avatar Jun 27 '24 10:06 gonzaloserrano

@Robitx Any thoughts on this?

tommyengstrom avatar Jul 16 '24 07:07 tommyengstrom

@tommyengstrom Hey, sorry for not looking into it sooner.

Yes this is heading in a good direction, but I would like to prevent combinatorial explosion for commands based on the context, there are many possible contexts people might want to use:

  • no context
  • .gp.md repo instructions
  • current file
  • all visible buffers
  • all open buffers
  • context build from LSP/Treesitter analysis
  • ...

So I would go in the direction of a separate set of commands similar to https://github.com/Robitx/gp.nvim?tab=readme-ov-file#agent-commands for switching the type of context which will be used by the commands such as GpRewrite.

Robitx avatar Jul 16 '24 09:07 Robitx

I suspect most of those examples are not really going to be used, thus making the "combinatorial explosion of commands" a non issue. I considered adding LSP output in this command but haven't done so. If done I don't see a point in having a separate command without it.

Either way, I'm not interested in spending time on implementing that.

tommyengstrom avatar Jul 16 '24 13:07 tommyengstrom

I would also be interested in having the option to include the current file as context for visual append and rewrite commands.

alivault avatar Aug 07 '24 23:08 alivault