code does not insert to the editor always #901
-
Hi everyone, thanks for this great plugin
but it is sometimes working and sometimes not, for example when I touch a file lets call pod.yaml and ask to generate a manifest it creates the manifest in the buffer but when I press the nothing is inserted to my nvim editor I would appreciate it if you can help me thanks 😊 |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 3 replies
-
Does |
Beta Was this translation helpful? Give feedback.
-
wow Tomas thanks interesting now when I press gj then press now the it inserted to the IDE, so but I don't know if I have to do it everytime first gj? or it show work just with |
Beta Was this translation helpful? Give feedback.
-
something funny it creates an open buffer (empty file) with the same name as the Copilot Chat suggest. In this case but I want the generated code to be inserted in the same pod.yaml file I have already created! |
Beta Was this translation helpful? Give feedback.
-
Yea C-y currently has safeguard that requires you to press and for the nginx-pod.yaml and pod.yaml, it looks like you created pod.yaml first, but did not told the chat about pod.yaml so it tries to create But i think the behaviour you are experiencing atm is expected at least, i was worried that it wasnt matching filenames properly but your filenames are different so makes sense (it tries to match the markdown header against files) |
Beta Was this translation helpful? Give feedback.
-
perfect thanks a lot.
as Im pretty beginner in nvim. thanks again |
Beta Was this translation helpful? Give feedback.
-
When configuring the plugin through lazy or just calling .setup, pass context = 'buffer' to the config: I think using lazy.nvim it would look like this: return {
{
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
{ "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions
},
build = "make tiktoken", -- Only on MacOS or Linux
opts = {
context = 'buffer'
},
},
} alternatively you can use return {
{
"CopilotC-Nvim/CopilotChat.nvim",
dependencies = {
{ "github/copilot.vim" }, -- or zbirenbaum/copilot.lua
{ "nvim-lua/plenary.nvim", branch = "master" }, -- for curl, log and async functions
},
build = "make tiktoken", -- Only on MacOS or Linux
opts = {
sticky = '#buffer'
},
},
} I personally have |
Beta Was this translation helpful? Give feedback.
Yea C-y currently has safeguard that requires you to press
gj
first in case it needs to create new buffer first (or switch to different buffer in general). I am considering removing this because safeguarding that probably isnt that useful.and for the nginx-pod.yaml and pod.yaml, it looks like you created pod.yaml first, but did not told the chat about pod.yaml so it tries to create
nginx-pod.yaml
instead. You need to either select something inpod.yaml
so it gets sent like selection or use#buffer
context at least so the chat always knows what file you are working on (setting default context tobuffer
is pretty useful for this)But i think the behaviour you are experiencing atm is expect…