[FEATURE]: TUI plugin API for inline prompt suggestions

オープン
#65,338 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
5/5
見積もり時間
1週間以上
初心者へのやさしさ
15/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
typescript

調査の方向性

Start from the plugin host's context.ui.prompt surface and the existing prompt/textarea renderer that the external opencode-autosuggestions plugin currently patches through renderer internals; read the prior art in #51209 (draft and cursor access) and #54197 (empty-composer suggestions) before designing the API. The proposal spans keybind handling (Tab, Ctrl+Right, Escape), trimming on typed prefix, and suppression rules for shell mode, open autocomplete/dialogs and non-end cursors, so it needs agreement on the contract first and tests against opencode-autosuggestions to be considered done. The author has stated they intend to implement it in a single PR, so coordinate before starting.

索引モデルが issue の本文から書いたものです。

説明

area/plugins type/feature version/v2
Feature hasn't been suggested before.
  • I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request

TUI plugins have no supported way to show an inline suggestion in the prompt. opencode-autosuggestions already completes drafts while typing and suggests follow-ups after each turn, but it finds the prompt textarea through renderer internals and draws the ghost text in an absolutely positioned overlay at the cursor's screen coordinates. Its source notes that an OpenCode update can break this.

Proposal: add a suggestion API to context.ui.prompt, next to the draft access requested in #51209.

context.ui.prompt.suggest({ sessionID, text }): () => void
  • The host draws text as muted ghost text right after the cursor, in an empty or non-empty draft, and handles wrapping.
  • Tab accepts the whole suggestion, Ctrl+Right accepts the next word, and Escape dismisses it. All three are configurable keybinds. Accepting inserts text into the draft and never submits.
  • When the user types characters that match the start of the suggestion, the host trims it. Any other edit, cursor move or session switch clears it.
  • Suggestions are ignored in shell mode, while autocomplete or a dialog is open, and when the cursor is not at the end of the draft.
  • Plugins also need to read the draft and cursor (#51209) and get a change event, so they can debounce their own requests.

This covers what #54197 did for the empty composer and extends it to drafts in progress. Model calls stay in plugins, so core sends no extra model requests.

I plan to implement this in a single PR and test it against opencode-autosuggestions.

主要言語
TypeScript
スター
227k
フォーク
30.7k
平均マージ
3時間 57分
マージ済み PR(30日)
484

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

anomalyco/opencode のほかの issue

anomalyco/opencode の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。