CopilotC-Nvim / CopilotChat.nvim

Chat with GitHub Copilot in Neovim
https://copilotc-nvim.github.io/CopilotChat.nvim/
GNU General Public License v3.0
1.44k stars 67 forks source link

Please add a command to clear the highlights produced by :CopilotChatReview #362

Open Tebro opened 2 months ago

Tebro commented 2 months ago

When using :CopilotChatReview it will print its suggestions in chat, but also highlight them in the buffer. Would be nice to be able to clear this highlights.

masakiq commented 1 month ago

This is a workaround.

By defining the following Lua function, you can clear the review highlights:

function CopilotChatReviewClear()
  local ns = vim.api.nvim_create_namespace('copilot_review')
  vim.diagnostic.reset(ns)
end

vim.api.nvim_create_user_command(
  'CopilotChatReviewClear',
  CopilotChatReviewClear,
  {}
)

Then, run the command:

:CopilotChatReviewClear

Alternatively, if you don't need the highlights, you might also consider using the keymap below to silence the function callbacks:

require("CopilotChat").setup {
  prompts = {
    Review = {
      callback = function(_, _)
        -- do nothing
      end,
    },
  },
end