Skip to content

Commit

Permalink
fix command completion of Pckr
Browse files Browse the repository at this point in the history
  • Loading branch information
eph authored and eph committed Jul 17, 2024
1 parent c6ea98c commit d3f33b1
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions lua/pckr/cli.lua
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,20 @@ local log = require('pckr.log')

local M = {}

--- @param lead string
--- @return string[]
local function command_complete()
local function command_complete(lead)
local actions = require('pckr.actions')
return vim.tbl_keys(actions)
local completion_list = vim.tbl_filter(
--- @param name string
--- @return boolean
function(name)
return vim.startswith(name, lead)
end,
vim.tbl_keys(actions)
)
table.sort(completion_list)
return completion_list
end

-- Completion user plugins
Expand Down Expand Up @@ -36,7 +46,7 @@ function M.complete(arglead, line)

local matches = {}
if n == 2 then
matches = command_complete()
matches = command_complete(arglead)
elseif n > 2 then
matches = plugin_complete(arglead)
end
Expand Down

0 comments on commit d3f33b1

Please sign in to comment.