Writing a source for nvim-compe?

Hello Neovimmers,

I am trying to create a new source for compe to auto-complete Vlime suggestions, but I am utterly at a loss here. I wrote sources for completion-nvim and NCM2 (here and here), so I know what to do on the Vlime end, but I have no idea what to do on the compe end.

The documentation barely exists and what is there is in broken English. It lists functions which need to be implemented, but it does not list what arguments those functions take and what they return. I have tried to piece together something from other sources, but to no effect. Has someone the experience with Vlime to help me out? Or at least help improve the documentation of compe.

Other people have created sources, so either I’m too stupid to use compe, or they have some sort of super power.

Here are some examples that may be useful for you:

This is my custom implementation that uses ripgrep to find matching words:

This one just calls the vim implementation: vim-dadbod-completion/compe.vim at master · kristijanhusak/vim-dadbod-completion · GitHub

Thank you for the feedback, but I must be doing something wrong because nothing is happening. I have the following code:

" plugin/compe-vlime.vim
if get(s:, 'compe_vlime_loaded', v:false)
	finish
endif
let s:compe_vlime_loaded = v:true


let s:source = {
	\ 'get_metadata': function('compe#vlime#get_metadata'),
	\ 'determine': function('compe#vlime#determine'),
	\ 'complete': function('compe#vlime#complete'),
\ }

call compe#register_source('vlime', s:source)

This gets called just fine

" autoload/compe/vlime.vim

function! compe#vlime#get_metadata(...) abort
	" Common Lisp is a Lisp-2, hence we allow duplicates
	return {'priority': 100, 'filetypes': ['lisp'], 'dup': v:true, 'menu': 'Vlime'}
endfunction

function! compe#vlime#determine(context)
	" I have no idea what this does, I'm just copying what others are doing.
	return compe#helper#determine(a:context)
endfunction

function! compe#vlime#complete(self, context)
	echom 'ping'
endfunction
" My plugin settings
Plug 'hrsh7th/nvim-compe'
Plug '~/Developer/vim/nvim-compe-vlime/'
set completeopt=menuone,noinsert,noselect

let g:compe = {
	\ 'enabled': v:true,
	\ 'source': {
		\ 'path': v:true,
		\ 'buffer': v:true,
		\ 'nvim_lsp': {'dup': v:true},
		\ 'vsnip': v:true,
		\ 'vlime': v:true,
		\ 'ultisnips': {'dup': v:true, 'priority': 2000},
	\}
\ }

Now when I try to complete something in a Lisp buffer there should be a ping message, but there is nothing. Maybe I am doing some order of instructions wrong?