{"__v":30,"_id":"551df5f4a77fec1700f6f29a","category":{"__v":9,"_id":"551df586e52a0b23000c62b6","pages":["551df5bfa77fec1700f6f296","551df5c9fa7f722d00db21f0","551df5dfa77fec1700f6f298","551df5eca7e98017009e3ede","551df5f4a77fec1700f6f29a","551df5fdfa7f722d00db21f3","551df609a7e98017009e3ee0","551f3c0450a0fc210057968e","552836448962f339009a67ab"],"project":"54d53c7b23010a0d001aca0c","version":"54d5635532d98b0d00384afb","sync":{"url":"","isSync":false},"reference":false,"createdAt":"2015-04-03T02:05:58.352Z","from_sync":false,"order":3,"slug":"cloud9-bundle","title":"Cloud9 Bundle"},"parentDoc":null,"project":"54d53c7b23010a0d001aca0c","user":"54cfa8e1a8a4fd0d00b7fd1d","version":{"__v":10,"_id":"54d5635532d98b0d00384afb","forked_from":"54d53c7c23010a0d001aca0f","project":"54d53c7b23010a0d001aca0c","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"},"updates":[],"next":{"pages":[],"description":""},"createdAt":"2015-04-03T02:07:48.489Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"results":{"codes":[]},"auth":"required","params":[],"url":""},"isReference":false,"order":6,"body":"An outline definition is a declarative file that describes how to recognize symbols in a file that become nodes in the outline tree. Items are recognized by simple regular expressions as outlined below. You can include an outline in a [Cloud9 Bundle](doc:cloud9-bundle) to share on c9.io.\n\nOutline definitions are very powerful and can define a useful outline view with only a handful of regular expressions. Any outline items are also added automatically to the default list of code completions. Still, it is entirely possible to create a custom parser that does all the heavy lifting. See the [language guide](doc:language-plugins) for more information on that.\n[block:image]\n{\n  \"images\": [\n    {\n      \"image\": [\n        \"https://files.readme.io/3ME4kLTNGL8z4fetOFPA_2015-04-13_1730.png\",\n        \"2015-04-13_1730.png\",\n        \"2392\",\n        \"1018\",\n        \"#64abf7\",\n        \"\"\n      ]\n    }\n  ]\n}\n[/block]\n# Creating an Outline Definition\n\nAn outline definition is a simple JSON object with 5 supported properties; `languages`, `extensions`, `guess_fargs`, `extract_docs` and `tags`.\n\n## Languages & Extensions\n\nThese two arrays specify for which languages / extensions the outline document is used.\n\n```\n{\n    languages: [\"php\"],\n    extensions: [\"php\", \"php3\", \"php4\", \"php5\"]\n}\n```\n\n## Options\n\nThere are two options that can be set to true or false. \n\n- `guess_fargs` sets whether to guess function arguments when showing outline items in code completion.\n- `extract_docs` sets whether to extract documentation when showing outline items in code completion.\n    \n## Tags\n\nThe `tags` property is an array of rules that match symbols in the document. Each rule is an object with two fields; `regex` and `kind`. The `kind` determines the icon of the symbol and takes one of the following strings:\n\n- \"package\"\n- \"method\"\n- \"method2\"\n- \"property\"\n- \"property2\"\n- \"import\"\n\nThe `regex` property matches a symbol in a file and builds a tree based on that. Make sure to *only* capture the name of the symbol in the regular expressions. Use `(?:)` if you need to use parenthesis for any other reason.\n\nThe following tag finds a javascript function:\n\n```\n{ regex: /(?:^|\\n)\\s*function\\s+([^ \\(:]+)/g, kind: \"method\" },\n```\n\n## Full Example\n\nHere's a full example of the python outline definition.\n\n```javascript\n{\n    languages: [\"py\"],\n    extensions: [\"py\"],\n    \n    guess_fargs: true,\n    extract_docs: true,\n    \n    tags: [\n        { regex: /(?:^|\\n)\\s*class\\s+([^ \\(:]+)/g, kind: \"package\" },\n        { regex: /(?:^|\\n)\\s*def\\s+(?!_)([^ \\(:]+)/g, kind: \"method\" },\n        { regex: /(?:^|\\n)\\s*def\\s+(?!__[^ \\(:]+__)(_[^ \\(]*)/g, kind: \"method2\" },\n        { regex: /(?:^|\\n)\\s*def\\s+(__[^ \\(:]+__)/g, kind: \"property\" },\n        {\n            regex: new RegExp(\n                \"(?:^|\\\\n)\\\\s*import\\\\s+([^ \\\\(]+)\"\n            ),\n            kind: \"import\"\n        }\n    ]\n}\n```\n\n# Adding an Outline to a Bundle\n\nA bundle can contain one or more outline definitions. Each outline definitions *must* be placed in the `outline` directory. \n\nSuppose your outline definition is called `python.outline`. Your file structure will look something like this:\n\n```\n└─ your.plugin\n    ├─ outline\n    |    └─ python.outline\n    ├─ package.json\n    └─ README.md\n```","excerpt":"","slug":"outline","type":"basic","title":"Outline"}
An outline definition is a declarative file that describes how to recognize symbols in a file that become nodes in the outline tree. Items are recognized by simple regular expressions as outlined below. You can include an outline in a [Cloud9 Bundle](doc:cloud9-bundle) to share on c9.io. Outline definitions are very powerful and can define a useful outline view with only a handful of regular expressions. Any outline items are also added automatically to the default list of code completions. Still, it is entirely possible to create a custom parser that does all the heavy lifting. See the [language guide](doc:language-plugins) for more information on that. [block:image] { "images": [ { "image": [ "https://files.readme.io/3ME4kLTNGL8z4fetOFPA_2015-04-13_1730.png", "2015-04-13_1730.png", "2392", "1018", "#64abf7", "" ] } ] } [/block] # Creating an Outline Definition An outline definition is a simple JSON object with 5 supported properties; `languages`, `extensions`, `guess_fargs`, `extract_docs` and `tags`. ## Languages & Extensions These two arrays specify for which languages / extensions the outline document is used. ``` { languages: ["php"], extensions: ["php", "php3", "php4", "php5"] } ``` ## Options There are two options that can be set to true or false. - `guess_fargs` sets whether to guess function arguments when showing outline items in code completion. - `extract_docs` sets whether to extract documentation when showing outline items in code completion. ## Tags The `tags` property is an array of rules that match symbols in the document. Each rule is an object with two fields; `regex` and `kind`. The `kind` determines the icon of the symbol and takes one of the following strings: - "package" - "method" - "method2" - "property" - "property2" - "import" The `regex` property matches a symbol in a file and builds a tree based on that. Make sure to *only* capture the name of the symbol in the regular expressions. Use `(?:)` if you need to use parenthesis for any other reason. The following tag finds a javascript function: ``` { regex: /(?:^|\n)\s*function\s+([^ \(:]+)/g, kind: "method" }, ``` ## Full Example Here's a full example of the python outline definition. ```javascript { languages: ["py"], extensions: ["py"], guess_fargs: true, extract_docs: true, tags: [ { regex: /(?:^|\n)\s*class\s+([^ \(:]+)/g, kind: "package" }, { regex: /(?:^|\n)\s*def\s+(?!_)([^ \(:]+)/g, kind: "method" }, { regex: /(?:^|\n)\s*def\s+(?!__[^ \(:]+__)(_[^ \(]*)/g, kind: "method2" }, { regex: /(?:^|\n)\s*def\s+(__[^ \(:]+__)/g, kind: "property" }, { regex: new RegExp( "(?:^|\\n)\\s*import\\s+([^ \\(]+)" ), kind: "import" } ] } ``` # Adding an Outline to a Bundle A bundle can contain one or more outline definitions. Each outline definitions *must* be placed in the `outline` directory. Suppose your outline definition is called `python.outline`. Your file structure will look something like this: ``` └─ your.plugin ├─ outline | └─ python.outline ├─ package.json └─ README.md ```