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

Features compared to cursor editor #34

Closed RobertBrunhage closed 1 month ago

RobertBrunhage commented 1 month ago

I've been evaluating the cursor editor to know what was usable and not and there are a couple of things (some are implemented and some are not).

Below is a table of some of the features I saw myself using either from time to time or often. Not sure if there are any plans to support these different features but thought I would add it anyway. Also, there might be a way to do this already with Parrot that I am just not aware of!

Feature Cursor Parrot
Visual select and ask question to change/implement ✅ cmd+k
Ask a question around the current file ✅ cmd+l Kinda (you have to copy the entire file content and ask with that context)
Full context search (uses the entire context of the project and ask a question) ✅ cmd+l then cmd+enter when asking
frankroeder commented 1 month ago

Hi @RobertBrunhage, thanks for this overview!

  1. Visual select and ask question to change/implement: With PrtRewrite, we can do it inline, or with PrtChatNew, we can open the selection in a new chat.
  2. Ask a question around the current file: You don't have to copy the entire file. This is where we have the templates for: Templates Documentation. They can automatically paste the whole buffer content into a query (see example hook below)
  3. Full context search (uses the entire context of the project and ask a question): Yes, we are working on that in #19. However, we are not planning to send your entire project to the API, only explicitly selected files (fzf makes this easy).

I have added a hook to your previous configuration that allows you to ask questions about the current file content using PrtAskFile.

{
  "frankroeder/parrot.nvim",
  tag = "v0.3.7",
  dependencies = { "ibhagwan/fzf-lua", "nvim-lua/plenary.nvim" },
  config = function()
    require("parrot").setup {
      providers = {
        anthropic = {
          api_key = os.getenv "ANTHROPIC_API_KEY",
        },
      },
      hooks = {
        AskFile = function(parrot, params)
          local template = [[
              I want you to simply answer questions about the content of the provided file.
              Questions:
              {{command}}

              Provided file content: {{filecontent}}
              ]]
          local agent = parrot.get_command_agent()
          parrot.logger.info("Asking agent: " .. vim.inspect(agent.name))
          parrot.Prompt(
            params,
            parrot.ui.Target.popup,
            "🤖 Ask ~ ",
            agent.model,
            template,
            "",
            agent.provider
          )
        end,
      },
    }
  end,
}
RobertBrunhage commented 1 month ago

@frankroeder based! Awesome to see and thanks for the clarifications.

Have you had any plans to potentially add in AI completion as well or is that outside the scope of this plugin?

You can close the issue if you want as well as above answered my actual issue (or if you would like me to fill out the issue with more cursor features to have as a reference for the plugin regarding AI features)

frankroeder commented 1 month ago

I consider completion to be out of scope for this project, as it analyzes your files and tracks the position of your cursor to constantly generate potential completions in the background. This can become very costly, especially for larger projects, when using the usual APIs. Furthermore, I think it is very difficult to implement this well (considering LSP integration, etc.).

With parrot.nvim, I like to focus on inline prompt-based edits and lightweight chats within markdown files that are simply buffers, allowing the user stay in control of the costs and what gets sent. I believe that the custom hooks provide a lot of flexibility, as they can harness the full range of Lua functions for any type of routine, including completions.

For example, I have this experimental feature that generates Git commit messages based on the output of git diff, that I simply trigger inside the commit editor (see here https://github.com/frankroeder/dotfiles/blob/8bf98a5f017ed79dc1b1d6736a73fbbc43df3890/nvim/lua/plugins/parrot.lua#L236)

Feel free to move this to a discussion.

RobertBrunhage commented 1 month ago

I consider completion to be out of scope for this project, as it analyzes your files and tracks the position of your cursor to constantly generate potential completions in the background. This can become very costly, especially for larger projects, when using the usual APIs. Furthermore, I think it is very difficult to implement this well (considering LSP integration, etc.).

With parrot.nvim, I like to focus on inline prompt-based edits and lightweight chats within markdown files that are simply buffers, allowing the user stay in control of the costs and what gets sent. I believe that the custom hooks provide a lot of flexibility, as they can harness the full range of Lua functions for any type of routine, including completions.

For example, I have this experimental feature that generates Git commit messages based on the output of git diff, that I simply trigger inside the commit editor (see here https://github.com/frankroeder/dotfiles/blob/8bf98a5f017ed79dc1b1d6736a73fbbc43df3890/nvim/lua/plugins/parrot.lua#L236)

Feel free to move this to a discussion.

Understood and makes sense!

Do you want me to move the original issue towards a discussion or were you talking about completion?