Skip to content
Angelo edited this page May 14, 2015 · 9 revisions

Code Folding

CodeMirror-XQuery provides the addon/fold/autofolding.js which folds the code according a configuration (which depends of the mode (xquery, javascript, etc...) and fold type (comments, brace, xml tags, indent, etc).

You can play with XQuery folding with the online demo.

The addon/fold/auofolding-xquery.js configure the folding like this:

  • comments (starts with '(:' and ends with) are folded. On the xquery code loading, comments folding are collapsed.
  • brace ('{' and '}') are folded. On the xquery code loading, brace folding are elapsed.
  • xml tags are folded. On the xquery code loading, xml tags folding are elapsed.

So, it's very easy to create your own configuration to manage other mode (javascript, xml, etc).

Code Folding on the load

On the xquery code loading:

  • comments folding are collapsed:

Code Folding 1

  • brace ('{' and '}') folding are elapsed:

Code Folding 2

  • xml tags folding are elapsed:

Code Folding 3

Expand/Collapse code

When code folding is collapsed, you can elapse it with the left pulse gutter or right widget :

Code Folding 4

Once the code folding is elapsed, the pulse changes and you can re-collapse it :

Code Folding 5

Code Folding on change code

Code Folding works too when code editor changes. If you starts writing comments (with '(:'), the left pulse gutter appears :

Code Folding 6

If you remove starts of comments, the pulse disappears :

Code Folding 7

Clone this wiki locally