feat(forge): support bare repo-level forge refs (#135)
Problem: Forge refs required an issue/PR number (`gh:user/repo#42`). Users wanting to link a repo without a specific issue had no option. Solution: Accept `gh:user/repo` shorthand and `https://github.com/user/repo` URLs as `type='repo'` refs with `number=nil`. These conceal and render virtual text like numbered refs but skip all API calls (no validate, no fetch, no close). `format_label` strips `#%n` for bare refs. Omnifunc offers both `owner/repo#` and `owner/repo` completions. Closes #135
This commit is contained in:
parent
e76cbfe223
commit
53d8cb31ba
3 changed files with 261 additions and 88 deletions
|
|
@ -194,9 +194,15 @@ function M.omnifunc(findstart, base)
|
|||
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 .. ']' })
|
||||
local word_num = key .. '#'
|
||||
if base == '' or word_num:sub(1, #base) == base then
|
||||
table.insert(matches, { word = word_num, menu = '[' .. source .. ']' })
|
||||
end
|
||||
if base == '' or key:sub(1, #base) == base then
|
||||
table.insert(
|
||||
matches,
|
||||
{ word = key, menu = '[' .. source .. ']', info = 'Bare repo link' }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue