Introduction to Language Tooling

🚧

Adding New Languages

This section is about adding tooling to existing languages in Cloud9. Based on Ace, Cloud9 supports overΒ 100! These include CoffeeScript, Dart, the Dockerfile format, Go, Powershell, and many more. To add a completely new language, a new Ace Language Mode is needed first.

Plugins can extend Cloud9 with a custom outline view, code completion, hinting, and what not, for any custom language or framework. Getting some basic things working is actually very easy. In these docs we give examples and explain how to implement these different services for any language.

23922392

All language tooling is implemented using plugin components called Language Handlers. Language handlers have full control of implementing services like code completion or an outline view. Cloud9 provides technology-agnostic interfaces and fully allows the use of any custom parser, analysis, server-side communications, etc. To make it easy to implement language handlers, Cloud9 also provides outline definitions in the Cloud9 Bundle and the Jsonalyzer framework to implement specific kinds of language plugins.

Unlike most Cloud9 plugins, language handlers are components that can potentially do CPU-intensive work like parsing or analyzing a file. To make sure they don't slow down or block the Cloud9 UI, they don't run in the normal browser UI thread, but in a background thread called a web worker.

πŸ“˜

Caveats of Web Workers

Language handlers are written like a standard common.js plugin, and don't use the Architect plugin format used for normal Cloud9 plugins. As they lives in a web worker, language handlers also can't access any of the plugins that live in the UI directly, but instead can only use require() to access other modules that live in the web worker, like worker_util. Any communication with the UI is done using worker_util and events incoming from Cloud9 through the base_handler interface. See also Talking to the Outside World.

Debugging web workers can be tricky. In modern webkit browsers such as Chrome, web workers support breakpoint debugging. For other browsers, such as Firefox, you can launch Cloud9 with ?noworker=1 to run all language handlers in the UI thread to make debugging easier.

What's Next!

Related Pages