feat: omnifunc completion for compose buffer metadata#53
Merged
barrettruth merged 1 commit intomainfrom Apr 4, 2026
Merged
Conversation
Add context-aware completion for compose buffers with two modes: Metadata fields (in <!-- --> comment block): - Draft: true/false - Labels, Assignees, Reviewers, Milestone from forge API Body triggers (in title/body text): - # → issue/PR number completion with titles shown in menu - @ → user mention completion from collaborators list The omnifunc detects context automatically: comment block lines get field-based completion, body text gets trigger-based completion on # and @. Results are cached for 5 minutes per forge per field. Works automatically with blink.cmp and nvim-cmp. Without a completion plugin, trigger via Ctrl-X Ctrl-O. Closes #45
ad479c2 to
e1c7b90
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds context-aware completion for metadata fields in compose buffers (PR create, PR edit, issue create). Closes #45.
When the cursor is on a
Labels:,Assignees:,Reviewers:, orMilestone:line inside the compose comment block, completion candidates are fetched from the forge API and offered via Neovim's built-inomnifunc.How it works
lua/forge/completion.lua— new module implementing the omnifuncf:completion_cmd(field)(newline-delimited output)completion_cmd(field)— new backend method on all 3 forges:gh label list --json name --jq .[].nameglab label listtea api /repos/:owner/:repo/labelsgh api repos/{nwo}/collaborators --jq .[].loginglab api projects/:id/members/alltea api /repos/:owner/:repo/collaboratorsgh api repos/{nwo}/milestones --jq .[].titleglab api projects/:id/milestones?state=activetea api /repos/:owner/:repo/milestones?state=opencompose.lua— setsomnifuncon all compose buffers viacreate_compose_buf()User experience
Ctrl-X Ctrl-O(standard Vim omni-completion)<!-- -->comment block — no interference with title/body editingFiles changed
lua/forge/completion.lua— new (omnifunc + cache)lua/forge/compose.lua— +1 line (set omnifunc)lua/forge/github.lua— +completion_cmd()lua/forge/gitlab.lua— +completion_cmd()lua/forge/codeberg.lua— +completion_cmd()lua/forge/config.lua— +type annotationTest plan