Skip to content

bug: opencode_ask_cmp missing '@' triggerCharacter, textEdit range, and returns '@' items on non-'@' words #343

Open

Description

@george-tk

Prerequisites

  • I searched the docs
  • I searched existing issues

:checkhealth opencode output

opencode: OK
- Neovim: 0.11+
- opencode CLI: available
- snacks.nvim: enabled (with blink.cmp)

Describe the bug

In lua/opencode/ui/ask/cmp.lua, the in-process LSP server (opencode_ask_cmp) for the ask() input buffer has three completion issues when paired with completion engines like blink.cmp or nvim-cmp:

  1. Missing triggerCharacters = { "@" }:
    handlers[ms.initialize] only returns completionProvider = { resolveProvider = true }. Because @ is not a standard keyword character (iskeyword), typing @ in ask() does not automatically trigger the completion menu unless triggerCharacters = { "@" } is advertised.
  2. Unconditional @ items on every word / path:
    handlers[ms.textDocument_completion] returns all @ placeholders (@this, @buffer, @diagnostics, etc.) unconditionally on every completion request, even when the user is typing normal prose or a file path (e.g. ./lua/...), causing @ context items to rank above path or buffer completions.
  3. Missing textEdit replacement range covering @:
    Completion items set insertText = placeholder (e.g. "@buffer") without a textEdit range starting at the @ character. Because completion engines compute keyword bounds starting after @ (e.g. at b in @b), accepting @buffer after typing @b can produce @@buffer unless a textEdit range covering the leading @ is provided.

Steps To Reproduce

  1. Enable blink.cmp (with lsp, path, buffer sources) for opencode_ask.
  2. Open require("opencode").ask() and type @ — completion does not trigger automatically until a keyword character is typed or <Tab> is pressed.
  3. Type ./ to complete a file path — @this, @buffer, @diagnostics appear above the filesystem paths because opencode_ask_cmp returns them unconditionally.

Expected Behavior

  1. opencode_ask_cmp should advertise triggerCharacters = { "@" } in completionProvider.
  2. textDocument/completion should only return @ context items when the token before the cursor starts with @ (or when manually invoked on an empty token), and include a textEdit range starting at the @ column.

Activity

  1. nickjvandyke commented on Nov 2, 2026

    @nickjvandyke
    Owner

    Thanks for finding and reporting this!

    I don't experience any of these 🤔 but I'm still on blink.cmp v1. What version are you testing with?

    I did notice 3 when testing mini.input but couldn't diagnose it. Maybe this is the cause? Although I think that reads _G.opencode_completion, not the LSP. But could be the same idea.

    I used to report trigger chars but removed it here: fa0a495 Maybe that relied on undefined behavior or a bug in blink.cmp that they recently changed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions