Reference Implementations

🚧

Please read the other sections first

The other sections on language tooling provide many smaller examples and fragments that can be used as a basis to build new language plugins. The plugins linked on this page are full language plugins used in Cloud9. They do not come with a full explanation of the API or the approach, but they may still be useful as a reference when building new plugins.

Server-side Completion & Linting for Python

The Python plugin provides a full example of a code completer and linter using the techniques of Using Existing Language Tools, and is available at https://github.com/c9/c9.ide.language.python. It has roughly the following structure:

└─ c9.ide.language.python
    ├─ server
    |    └─ jedi_server.py
    ├─ worker
    |    ├─ python_completer.js
    |    ├─ python_jsonalyzer.js
    |    └─ python_linter.js
    ├─ python.js

The main file of the plugin is python.js, which implements GUI settings and loads the language handlers. Linting is implemented in python_linter.js, calling pylint on the workspace. A simple outline view is at this time provided by python_jsonalyzer.js. Code completion is implemented using a Python daemon called jedi_server.py which runs in the workspace and listens to a port. The python_completer.js handler makes sure the daemon runs and uses curl to send requests for code completion to the daemon.

Note that the Go implementation below shares the same basic architecture. It doesn't show everything the Python implementation shows, but it is currently smaller and simpler. It invokes the GoCode daemon directly instead of running a custom server-side daemon.

Server-side Completion for Go

The Go plugin provides a simple example of a code completer the techniques of Using Existing Language Tools, and is available at https://github.com/c9/c9.ide.language.go. It has roughly the following structure:

└─ c9.ide.language.go
    ├─ worker
    |    ├─ go_completer.js
    ├─ go.js

The main file of the plugin is go.js, which implements GUI settings and loads the language handlers. Code completion is implemented uses the standard GoCode daemon The go_completer.js handler makes sure the daemon runs and calls it for code completion.

Comprehensive Support for JavaScript

For JavaScript we have sophisticated language tooling support provided for the most part by the following plugins:

Simple PHP & CSS Completions

See https://github.com/c9/c9.ide.language.generic/blob/a4023db/mode_completer.js.