CopilotC-Nvim / CopilotChat.nvim

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

Feature request: selection as context #250

Closed GuillaumeDesforges closed 5 months ago

GuillaumeDesforges commented 5 months ago

AFAIK it is possible to send the current buffer or all buffers using @buffer and @buffers.

I'd like to send the visual selection only, e.g. using @selection in the prompt.

When I use @selection in the prompt but there is no visual selection, it'd be nice if I got a warning on submit.

(PS: thanks a lot for making this plugin!)

deathbeam commented 5 months ago

You can just visually select what you want and its being sent by default. Context is specifically made for big amounts of data, so buffer and buffers, there is selection as well which is for more granular data and by default visual selection is being sent

sjonpaulbrown-cc commented 1 month ago

For anyone who comes across this issue, it was also unclear to me that the visual selection is passed. When launching the prompt, the selection is not displayed in the window, but it is being sent.

You can validate/test this by doing a visual selection and launching typing :CopilotChat. Then, just ask it a question regarding the text that you selected.