Skip to content

Latest commit

 

History

History
25 lines (20 loc) · 1.48 KB

ARCHITECTURE.md

File metadata and controls

25 lines (20 loc) · 1.48 KB

Architecture

This module requests autocompletions of code from Codeium, shows "ghost text" for them, and allows users to accept them by clicking or hitting Tab.

Ghost text

The way that this shows ghost text is quite different from how codemirror-copilot does it, and is derived from the code in modeling-app, which is then derived from the code in Cursor.

In codemirror-copilot, ghost text is based on widgets - displaying a CodeMirror widget inline with text. This is simple, but has the drawbacks of the ghost text being non-highlighted, and ghost text does not create additional line numbers in the line gutter, if there is one.

In this module, ghost text is added to the real text in the editor, but we use an addToHistory annotation to ensure that it is not added to history. This produces ghost text that looks more cohesive with the rest of the design of the editor, but it has the drawback of producing events that upstream consumers might confuse with user edits. We provide the copilotIgnore annotation and the shouldTakeUpdate method to help with this potential confusion.