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

[Bug]: Missing prompt chats from config in Chat buffer

Open tarjeir opened this issue 2 years ago • 4 comments

Your minimal.lua config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs({ "config", "data", "state", "cache" }) do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
  vim.fn.system({
    "git",
    "clone",
    "--filter=blob:none",
    "--single-branch",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  })
end
vim.opt.runtimepath:prepend(lazypath)

-- Your CodeCompanion setup
local plugins = {
  {
    "olimorris/codecompanion.nvim",
    dependencies = {
      { "nvim-treesitter/nvim-treesitter", build = ":TSUpdate" },
      "nvim-lua/plenary.nvim",
      "nvim-telescope/telescope.nvim",
      {
        "stevearc/dressing.nvim",
        opts = {},
      },
    },
    config = function()
      require("codecompanion").setup({
        adapters = {
          ollama = require("codecompanion.adapters").use("ollama", {
            schema = {
              model = {
                default = "llama3",
              },
              num_predict = {
                default = 500
              }
            },
          }),
        },
        strategies = {
          chat = {
            adapter = "ollama",
          },
          inline = {
            adapter = "ollama",
          },
          agent = {
            adapter = "anthropic",
          },
        },
      })
    end,
  }
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})

-- setup treesitter
local ok, treesitter = pcall(require, "nvim-treesitter.configs")
if ok then
  treesitter.setup({
    ensure_installed = "all",
    ignore_install = { "phpdoc" }, -- list of parser which cause issues or crashes
    highlight = { enable = true },
  })
end

Error messages

There are no error messages

Health check output

codecompanion: require("codecompanion.health").check()

codecompanion.nvim report

  • Log file: /Users//projects/private//.repro/state/nvim/codecompanion.log
  • OK plenary.nvim installed
  • OK nvim-treesitter installed
  • OK telescope.nvim installed
  • OK dressing.nvim installed
  • OK curl installed

Log output

It is Empty

Describe the bug

I expect Chat buffer to open and contain:

  1. Welcome message (intro_message)
  2. Custom prompts from the configuration (default_prompts)

What happens:

  1. Empty chat (seem to work correctly)

Thanks for a great plugin!. I am a bit unexperienced on the codebase (I am not used to the style of writing and lua debug methods) to submit a pull request yet

Reproduce the bug

Steps

  1. Run with minimal configuration (Plugin version 36bac7)
  2. Run :CodeCompanionActions
  3. Prompts -> Senior (XYZ) Developer
  4. Empty Chat opens

Final checks

  • [X] I have made sure this issue exists in the latest version of the plugin
  • [X] I have tested with the minimal.lua config file above and still get the issue
  • [X] I have shared the contents of the log file

tarjeir avatar Aug 03 '24 08:08 tarjeir

Thanks.

Are none of them working? Or do you need to make a visual selection for them to appear?

olimorris avatar Aug 03 '24 09:08 olimorris

Do you mean if I open a chat using visual inspection?

if I do visual inspection and: :'<,'>CodeCompanionActions

Selecting Senior (XYZ) Developer I have the following code:

 <visual selection here>
  1. The selected visual is present in the chat with an added header, however I can not see any messages from "system".
  2. No intro_message

tarjeir avatar Aug 03 '24 09:08 tarjeir

I've just pushed a change (d8c88f9dc54a0d43c8e6cde71d66996e47b466fd) which affects the palette. Could you let me know if you're still facing this issue?

olimorris avatar Aug 03 '24 12:08 olimorris

It may have fixed it. #buffer was helpful. Managed to solve the issue with a proper cold restart of everything

tarjeir avatar Aug 03 '24 15:08 tarjeir