Inline suggestion (ghost text) rendering primitive
還沒有人認領這個 Issue。
評估
研究方向
從 CodeEditTextView 開始,檢查其 caret 幾何資訊以及佈局/渲染路徑;issue 未指定檔案或測試目標。執行現有的 xcodebuild clean test 測試套件和 SwiftLint,然後驗證 InlineSuggestion API 能夠渲染單行和多行 overlay,同時不改變 textStorage 或編輯狀態。
由索引模型根據 Issue 內容生成。
描述
Description
Add a low-level rendering primitive to CodeEditTextView for inline "ghost text" suggestions: text drawn after the caret that previews content the user has not typed yet (the same UI pattern as GitHub Copilot, Xcode predictive completion, and similar inline AI suggestions).
The proposed API is small and rendering-only:
- A
InlineSuggestionvalue type (a documentoffsetplus thetextto show, which may be multi-line). TextView.setInlineSuggestion(_:at:),TextView.setInlineSuggestion(_:)(anchored at the primary caret), andTextView.clearInlineSuggestion().
Key design point: a suggestion is purely a rendering hint. It is drawn as a sibling overlay anchored at the caret and never mutates textStorage or shifts real text layout, so it cannot corrupt the document or interfere with editing, undo, or selection. This keeps the primitive safe and makes it a clean foundation that higher layers can drive.
Alternatives Considered
- Inserting the suggestion as real (styled) text and removing it on reject. Rejected because it mutates the text storage, pollutes undo, and risks desyncing layout and selection.
- Building the feature entirely in a downstream package. Rejected because the caret geometry and layout information needed to position ghost text correctly live in
CodeEditTextView, so the rendering primitive belongs here. Higher-level packages should only decide what text to show and when.
Additional Context
This is intended as the foundation for native inline AI completions (for example GitHub Copilot) in the CodeEdit stack: CodeEditTextView provides the rendering primitive, CodeEditSourceEditor coordinates request/accept/dismiss, and CodeEdit wires up the provider. This issue covers only the CodeEditTextView rendering layer.
I have a working, documented implementation with unit tests (overlay rendering, multi-line suggestions, and a check that the suggestion never mutates text storage). It builds and tests pass via xcodebuild ... clean test, and SwiftLint is clean. I am happy to open it as a PR for review. Would the maintainers welcome this in CodeEditTextView?
Screenshots
This layer is a non-visual API primitive; the user-visible ghost text appears once a higher layer drives it. The rendered result can be shown in the downstream CodeEditSourceEditor / CodeEdit integration.
- 主要語言
- Swift
- 星號
- 182
- 分支
- 57
- PR 合併指標
- 30 天內沒有已合併 PR
貢獻指南
這個儲存庫沒有索引到貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
CodeEditApp/CodeEditTextView 的其他 Issue
-
bug
難度 3/5 1-2 天 新手友好度 48/100
CodeEditApp/CodeEditTextView#121 ·
-
enhancement
難度 5/5 一週以上 新手友好度 28/100
CodeEditApp/CodeEditTextView#119 ·
-
enhancement
難度 5/5 一週以上 新手友好度 35/100
CodeEditApp/CodeEditTextView#106 ·
-
難度 4/5 3-5 天 新手友好度 35/100
-
enhancement
難度 4/5 3-5 天 新手友好度 45/100
查看 CodeEditApp/CodeEditTextView 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 75/100
-
area:general bug P1 security
難度 2/5 1-3 小時 新手友好度 75/100
uttrflow/uttrflow-swift#1333 ·
-
難度 2/5 1-3 小時 新手友好度 75/100
-
難度 2/5 1-3 小時 新手友好度 75/100
maxgoedjen/secretive#840 ·
-
難度 2/5 1-3 小時 新手友好度 88/100
manaflow-ai/cmux#13763 ·