Inline suggestion (ghost text) rendering primitive
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Beginnen Sie in CodeEditTextView und untersuchen Sie die Geometrie des Carets sowie den Layout-/Rendering-Pfad; das Issue nennt keine Datei und kein Testziel. Führen Sie die vorhandene xcodebuild clean test-Suite und SwiftLint aus und verifizieren Sie anschließend, dass die InlineSuggestion API einzeilige und mehrzeilige Overlays rendert, ohne textStorage oder den Bearbeitungszustand zu verändern.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- Swift
- Sterne
- 182
- Forks
- 57
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus CodeEditApp/CodeEditTextView
-
bug
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 48/100
CodeEditApp/CodeEditTextView#121 ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 28/100
CodeEditApp/CodeEditTextView#119 ·
-
enhancement
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
CodeEditApp/CodeEditTextView#106 ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
-
enhancement
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
Alle Issues in CodeEditApp/CodeEditTextView
Ähnliche Issues
-
area:dictation documentation P2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
uttrflow/uttrflow-swift#1180 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 84/100
OneBusAway/onebusaway-ios#1451 ·
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
-
type: docs
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 95/100
googleapis/google-cloud-swift#971 ·