Inline suggestion (ghost text) rendering primitive
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
Línea de trabajo
Comienza en CodeEditTextView e inspecciona la geometría del cursor y la ruta de layout/renderizado; el issue no especifica ningún archivo ni objetivo de prueba. Ejecuta la suite de pruebas existente de xcodebuild clean test y SwiftLint, y luego verifica que la InlineSuggestion API renderice overlays de una y varias líneas sin cambiar textStorage ni el estado de edición.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Swift
- Estrellas
- 182
- Forks
- 57
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de CodeEditApp/CodeEditTextView
-
bug
Dificultad 3/5 1-2 días Aptitud para principiantes 48/100
CodeEditApp/CodeEditTextView#121 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 28/100
CodeEditApp/CodeEditTextView#119 ·
-
enhancement
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
CodeEditApp/CodeEditTextView#106 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
-
enhancement
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Todos los issues de CodeEditApp/CodeEditTextView
Issues similares
-
The correction-threshold rationale says 17 restraint cases collide; the current corpus has 16 Abiertoarea:dictation documentation P2
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
uttrflow/uttrflow-swift#1180 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
OneBusAway/onebusaway-ios#1451 ·
-
enhancement
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
type: docs
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
googleapis/google-cloud-swift#971 ·