How copilot.el architecture works
maincopilot.el is an Emacs client for GitHub Copilot that communicates with the @github/copilot-language-server via JSON-RPC. It is designed as a single global server instance (copilot--connection) shared across all buffers and projects in an Emacs session.
The architecture is modular, consisting of five primary components:
copilot.el(Core): Manages server lifecycle, document synchronization, authentication, and inline completions.copilot-chat.el: Provides a Chat UI usingconversation/*JSON-RPC methods.copilot-nes.el: Provides Next Edit Suggestions (NES) viatextDocument/copilotInlineEdit.copilot-balancer.el: A standalone Lisp parentheses post-processor for completions.copilot-menu.el: A Transient menu (copilot-menu) for interactive commands.
Chat and NES are self-contained modules that depend on the core for server connections but can be enabled or disabled independently.