feat: Allow completion for :Neogen command (#36)

This commit is contained in:
danymat
2022-01-11 11:00:03 +01:00
parent 96e29f9fc2
commit a6ea2c1718

View File

@@ -131,8 +131,19 @@ function neogen.jumpable(reverse)
return neogen.utilities.cursor.jumpable(reverse) return neogen.utilities.cursor.jumpable(reverse)
end end
function neogen.match_commands()
return { "func", "class", "type", "file" }
end
function neogen.generate_command() function neogen.generate_command()
vim.api.nvim_command('command! -nargs=? -range -bar Neogen lua require("neogen").generate({ type = <q-args>})') vim.api.nvim_command([[
function! s:match_commands(arg, line, pos)
return luaeval('require("neogen").match_commands("' .. a:arg .. '")')
endfunction
]])
vim.api.nvim_command(
'command! -nargs=? -complete=customlist,s:match_commands -range -bar Neogen lua require("neogen").generate({ type = <q-args>})'
)
end end
neogen.setup = function(opts) neogen.setup = function(opts)