You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: partial_match suffix check uses virtual_suggestion (prefix only) instead of full suggestion #62
In lua/model_cmp/utils.lua:82, the partial_match function checks if the suffix (text after cursor) exists in the suggestion, but it searches inside virtual_suggestion instead of the full suggestion.
The problem
virtual_suggestion is only the prefix portion of the suggestion (first #prefix characters), so when there's any text after the cursor, the suffix can never be found there, and the function always returns nil — rejecting even perfectly compatible suggestions.
Example
Buffer line: return 1;, cursor after return , model suggests return 1;:
changed the title [-]bug: `partial_match` suffix check uses `virtual_suggestion` (prefix only) instead of full `suggestion`[/-][+][Bug]: `partial_match` suffix check uses `virtual_suggestion` (prefix only) instead of full `suggestion`[/+]on May 26, 2026
The reason why I am doing virtual_suggestion instead of full suggestion is because I want it to just search for the prefix instead of full suggestions otherwise it will show suggestions even for words like is or and in between the sentences.
Activity
PyDevC commentedon May 24, 2026
/oc can you describe this issue?
opencode-agent commentedon May 24, 2026
Here's the bug analysis:
The Bug
In
lua/model_cmp/utils.lua:82, thepartial_matchfunction checks if thesuffix(text after cursor) exists in the suggestion, but it searches insidevirtual_suggestioninstead of the fullsuggestion.The problem
virtual_suggestionis only the prefix portion of the suggestion (first#prefixcharacters), so when there's any text after the cursor, the suffix can never be found there, and the function always returnsnil— rejecting even perfectly compatible suggestions.Example
Buffer line:
return 1;, cursor afterreturn, model suggestsreturn 1;:prefix="return ",suffix="1;",suggestion="return 1;"virtual_suggestion="return "(only first 7 chars)string.find("return ", "1;")→nil→ incorrectly rejectedThe fix on line 82 is to change
virtual_suggestion→suggestion:Existing tests never hit this path because none of them have text after the cursor (
curr == prefixin all cases, sosuffixis alwaysnil).opencode session | github run
[-]bug: `partial_match` suffix check uses `virtual_suggestion` (prefix only) instead of full `suggestion`[/-][+][Bug]: `partial_match` suffix check uses `virtual_suggestion` (prefix only) instead of full `suggestion`[/+]PyDevC commentedon May 26, 2026
This doesn't seems right...
The reason why I am doing virtual_suggestion instead of full suggestion is because I want it to just search for the prefix instead of full suggestions otherwise it will show suggestions even for words like is or and in between the sentences.