{"_id":"567ef29af9ffa20d008782ff","parentDoc":null,"user":"54d5c32a7e05890d006f150d","version":{"_id":"54d5635532d98b0d00384afb","project":"54d53c7b23010a0d001aca0c","__v":10,"forked_from":"54d53c7c23010a0d001aca0f","createdAt":"2015-02-07T00:59:01.934Z","releaseDate":"2015-02-07T00:59:01.934Z","categories":["54d5635632d98b0d00384afc","54d5635632d98b0d00384afd","54d5635632d98b0d00384afe","54d5635632d98b0d00384aff","54d5635632d98b0d00384b00","54d5635632d98b0d00384b01","54d5635632d98b0d00384b02","54d652097e05890d006f153e","54dd1315ca1e5219007e9daa","54e21e2b22de1c230094b147","54e68e62a43fe13500db3879","54fa1d3fe7a0ba2f00306309","551c453a23a1ee190034d19a","551df586e52a0b23000c62b6","551f39be6886f8230055f02a","55a6720751457325000e4d97"],"is_deprecated":false,"is_hidden":false,"is_beta":true,"is_stable":true,"codename":"","version_clean":"0.1.0","version":"0.1"},"category":{"_id":"54d5635632d98b0d00384b01","version":"54d5635532d98b0d00384afb","project":"54d53c7b23010a0d001aca0c","pages":["54d5635732d98b0d00384b10","54d5635732d98b0d00384b11","55104b632dd9010d0019e144","55104c802dd9010d0019e146","551bd2c50d209f21006cad92","552e6fcd5d4baa0d00783691","552e73705d4baa0d00783699","567be431ee052b1700dbda49","567ef29af9ffa20d008782ff","56a8dd2470a9440d00ef5fe4"],"__v":9,"sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-02-07T00:03:52.618Z","from_sync":false,"order":11,"slug":"language-tooling","title":"Language Tooling"},"project":"54d53c7b23010a0d001aca0c","__v":15,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-12-26T20:03:38.761Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"settings":"","auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"[block:callout]\n{\n  \"type\": \"warning\",\n  \"body\": \"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.\",\n  \"title\": \"Please read the other sections first\"\n}\n[/block]\n# Server-side Completion & Linting for Python\n\nThe Python plugin provides a full example of a code completer and linter using the techniques of [Using Existing Language Tools](doc:existing-tools), and is available at https://github.com/c9/c9.ide.language.python. It has roughly the following structure:\n\n```\n└─ c9.ide.language.python\n    ├─ server\n    |    └─ jedi_server.py\n    ├─ worker\n    |    ├─ python_completer.js\n    |    ├─ python_jsonalyzer.js\n    |    └─ python_linter.js\n    ├─ python.js\n```\n\nThe 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.\n\nNote 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.\n\n# Server-side Completion for Go\n\nThe Go plugin provides a simple example of a code completer the techniques of [Using Existing Language Tools](doc:existing-tools), and is available at https://github.com/c9/c9.ide.language.go. It has roughly the following structure:\n\n```\n└─ c9.ide.language.go\n    ├─ worker\n    |    ├─ go_completer.js\n    ├─ go.js\n```\n\nThe 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.\n\n# Comprehensive Support for JavaScript\n\nFor JavaScript we have sophisticated language tooling support provided for the most part by the following plugins:\n\n- See https://github.com/c9/c9.ide.language.javascript for parsing, linting and an outline view\n- See https://github.com/c9/c9.ide.language.javascript.eslint for the JavaScript [ESLint](https://eslint.org) integration.\n- See https://github.com/c9/c9.ide.language.javascript.tern for the JavaScript [Tern](https://github.com/ternjs/tern) integration.\n\n# Simple PHP & CSS Completions\n\nSee https://github.com/c9/c9.ide.language.generic/blob/a4023db/mode_completer.js.","excerpt":"","slug":"complete-examples","type":"basic","title":"Reference Implementations"}

Reference Implementations


[block:callout] { "type": "warning", "body": "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.", "title": "Please read the other sections first" } [/block] # 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](doc:existing-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](doc:existing-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: - See https://github.com/c9/c9.ide.language.javascript for parsing, linting and an outline view - See https://github.com/c9/c9.ide.language.javascript.eslint for the JavaScript [ESLint](https://eslint.org) integration. - See https://github.com/c9/c9.ide.language.javascript.tern for the JavaScript [Tern](https://github.com/ternjs/tern) integration. # Simple PHP & CSS Completions See https://github.com/c9/c9.ide.language.generic/blob/a4023db/mode_completer.js.