Skip to content

Folding

Click the fold marker in the gutter, or press ⌘- / ⌘+ (Ctrl+- / Ctrl+=), to collapse or expand the code at the caret. ⌘⇧- (Ctrl+Shift+-) collapses everything in the file.

These fold when they span more than one line:

  • the bodies of modules, interfaces, programs, packages, classes, interface classes, functions, tasks, constructors, covergroups, clocking blocks, properties, sequences, checkers and user-defined primitives;
  • begin … end (also with a label), fork … join, case … endcase, randcase, generate … endgenerate and generate blocks;
  • multi-line comments, shown as /*...*/;
  • the code of an inactive `ifdef branch (see Conditional compilation), shown as ... — the directives stay visible.

A collapsed scope keeps its header and end keyword visible:

Collapsed
always_ff @(posedge clk or negedge rst_n) begin : seq...end : seq

Empty bodies (only blank lines) do not fold.

  • Port and argument lists and { … } bodies (constraints, structs, coverpoint bins) do not fold.
  1. Open rtl/counter.sv from the sample project.
  2. Put the caret inside the always_ff block and press ⌘- (Ctrl+-). The body between begin : seq and end : seq collapses to ....
  3. Press ⌘+ (Ctrl+=) to expand it again.