frankroeder / parrot.nvim

parrot.nvim 🦜 - the plugin that brings stochastic parrots to Neovim. This is a gp.nvim-fork focused on simplicity.
Other
219 stars 14 forks source link

Add entire_file templating value #18

Closed MrGrinst closed 2 months ago

MrGrinst commented 2 months ago

It'd be helpful in a lot of cases for the LLM to get the context of the whole file for completions/replacements. This PR adds an {{entire_file}} value that can be used in a template.

Example prompt I have it working with:

            I have the following code from {{filename}}:

            ```{{filetype}}
            {{entire_file}}
        Please look at the following section specifically:

        ```{{filetype}}
        {{selection}}
        ```

        Please rewrite just that section according to the contained instructions.
        Respond exclusively with the snippet that should replace that section.
        Please consider indentation level.
        DO NOT RETURN ANY EXPLANATION OR COMMENTS, ONLY RETURN CODE.
        DO NOT WRAP CODE IN BACKTICKS.
eterps commented 2 months ago

Hi @MrGrinst , is this the same functionality as the PR by @quolpr ?

https://github.com/frankroeder/parrot.nvim/pull/17

frankroeder commented 2 months ago

Yes, I prefer this method because it's easier to implement and use. I'm currently working on it and will integrate it as a completely optional feature within a few minutes.

frankroeder commented 2 months ago

Thank you very much, @MrGrinst, for this pull request. To avoid confusion with the system template, I have limited it to user templates. Users can now utilize the {{filecontent}} in their templates to inject file content. I also included a brief example in the readme.

MrGrinst commented 2 months ago

This looks great, thanks for updating and merging!