# Colouring and completion — explanation ## What is this about? The two features that make Turbo JS an editor *for JavaScript* rather than a text editor that happens to open `.js` files: syntax colouring, and completion from a language server. They work quite differently, and the difference is instructive. ## Colouring is ours; completion is not Colouring is done here, in about six hundred lines of hand-written Go. Completion is done by `typescript-language-server` — the same engine behind VS Code's JavaScript support — and Turbo JS only asks and draws. That split is not an accident of effort. Colouring has to be **instant and tolerant**: it runs on every keystroke, on text that is invalid most of the time it is being typed, and a highlighter that stops to think or gives up on broken input is worse than no highlighter. Completion has to be **correct**, which for JavaScript means parsing the file, following its `import` and `require` lines into `node_modules`, inferring types through a language that declares none, and knowing what every method of every global takes — and nothing that has to be instant can also be that. So the editor draws colours it computed itself, and shows completions somebody else computed. ## Why JavaScript is scanned here when the library already scans it turbo-core colours JavaScript for every editor in the family, because every editor meets it — in a README's code fence, in a web page's `