From 3a994e6284e5ac8f20506563e82eabd52eb28776 Mon Sep 17 00:00:00 2001 From: Barrett Ruth Date: Tue, 10 Mar 2026 17:44:36 -0400 Subject: [PATCH] feat(complete): add forge shorthand omnifunc completions Problem: no completion support for `gh:`, `gl:`, or `cb:` tokens, requiring users to type owner/repo from memory. Solution: extend `omnifunc` to detect `gh:`/`gl:`/`cb:` prefixes and complete with `owner/repo#` candidates from existing forge refs in the store. --- lua/pending/complete.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lua/pending/complete.lua b/lua/pending/complete.lua index 6ee3320..135d1a4 100644 --- a/lua/pending/complete.lua +++ b/lua/pending/complete.lua @@ -128,6 +128,9 @@ function M.omnifunc(findstart, base) { vim.pesc(dk) .. ':([%S]*)$', dk }, { 'cat:([%S]*)$', 'cat' }, { vim.pesc(rk) .. ':([%S]*)$', rk }, + { 'gh:([%S]*)$', 'gh' }, + { 'gl:([%S]*)$', 'gl' }, + { 'cb:([%S]*)$', 'cb' }, } for _, check in ipairs(checks) do @@ -169,6 +172,24 @@ function M.omnifunc(findstart, base) table.insert(matches, { word = c.word, menu = '[' .. source .. ']', info = c.info }) end end + elseif source == 'gh' or source == 'gl' or source == 'cb' then + local s = require('pending.buffer').store() + if s then + local seen = {} + for _, task in ipairs(s:tasks()) do + if task._extra and task._extra._forge_ref then + local ref = task._extra._forge_ref + local key = ref.owner .. '/' .. ref.repo + if not seen[key] then + seen[key] = true + local word = key .. '#' + if base == '' or word:sub(1, #base) == base then + table.insert(matches, { word = word, menu = '[' .. source .. ']' }) + end + end + end + end + end end return matches