sourcegraph / sg.nvim

Experimental Sourcegraph + Cody plugin for Neovim

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Completion without nvim-cmp?

heygarrett opened this issue Β· comments

I use the built-in omnicompletion. Is there way to use Cody's completion without nvim-cmp, a la copilot.vim?

I don't think copilot.vim uses omnicomplete, right? It has it's own completion that it uses (otherwise I don't think it's possible to do multi-line completions, or at least not very easily).

I could provide a separate function that you could manually invoke though, if that works for you?

That would be great!

Sorry, I didn't mean to imply that it should use omnicompletion, only that copilot.vim doesn't rely on nvim-cmp (to my knowledge).

Yes, copilot.vim uses something else.

So basically just something you could bind to a key to do something like

vim.keymap.set("i", "<c-space>", require"sg.complete".complete)
vim.keymap.set("i", "<tab>", require"sg.complete".accept)

What would your expectation be for what shows up next? Do you want it to be like it puts in some virtual text of what would get inserted and then you press <tab> to accept it? Any other character drops the virtual text?

Yep, spot on; no notes. πŸ‘

OK, excellent πŸ˜„ let me see what I can do this week

heh, sorry, took a bit longer than a week (I actually left sourcegraph but am doing some work on sg.nvim for them now as a contractor πŸ˜… ), but I have a PR that might solve at least an initial version of your issue:

#222

Does this work for you? It doesn't add it in automatically. Are you looking for it to autocomplete or via a request?

Oh, I totally forgot about this! I'm so sorry, but I'm no longer using sourcegraph. I feel like an absolute jerk; I should have come back to update the issue. 😞