Home » Support » Index of All Documentation » Wing IDE Reference Manual » Source Code Editor »

The editor supports optional folding for Python, C, C++, Java, Javascript, HTML, Eiffel, Lisp, Ruby, and a number of other file formats. This allows you to visually collapse logical hierarchical sections of your code while you are working in other parts of the file.

You can turn folding on and off as a whole with the Enable Folding preference.

The Fold Line Mode preference can be used to determine whether or not a horizontal line is drawn at fold points, whether it is drawn above or below the fold point, and whether it is shown when the fold point is collapsed or expanded. Fold Indicator Style is used to select the look of the fold marks shown at fold points.

Once folding is turned on, an additional margin appears to the left of source files that can be folded. Left mouse click on one of the fold marks in this margin to collapse or expand that fold point. Right mouse clicking anywhere on the fold margin displays a context menu with the various folding operations.

You can also hold down the following key modifiers while left-clicking to modify the folding behavior:

  • Shift -- Clicking on any fold point while holding down the shift key will expand that point and all its children recursively so that the maximum level of expansion is increased by one.
  • Ctrl -- Clicking on any fold point while holding down the ctrl key will collapse that point and all its children recursively so that the maximum level of expansion is decreased by one.
  • Ctrl+Shift -- On a currently expanded fold point, this will collapse all child fold points recursively to maximum depth, as well as just the outer one. When the fold point is subsequently re-expanded with a regular click, its children will appear collapsed. Ctrl-shift-click on a collapsed fold point will force re-expansion of all children recursively to maximum depth.

Fold commands are also available in the Folding section of the Source menu, which indicates the key equivalents assigned to the operations:

  • Toggle Current Fold -- Like clicking on the fold margin, this operates on the first fold point found in the current selection or on the current line.
  • Collapse Current More -- Like ctrl-clicking, this collapses the current fold point one more level than it is now.
  • Expand Current More -- Like shift-clicking, this expands the current fold point one more level than it is now.
  • Collapse Current Completely -- Like shift-ctrl-clicking on an expanded node, this collapses all children recursively to maximum depth.
  • Expand Current Completely -- Like shift-ctrl-clicking on a collapsed node, this ensures that all children are expanded recursively to maximum depth.
  • Collapse All -- Unconditionally collapse the entire file recursively.
  • Expand All -- Unconditionally expand the entire file recursively.
  • Fold Python Methods -- Fold up all methods in all classes in the file.
  • Fold Python Classes -- Fold up all classes in the file.
  • Fold Python Classes and Defs -- Fold up all classes and any top-level function definitions in the file.

« 4.11.7. Indentation ManagerTable of Contents4.13. Brace Matching »

Folding