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 … endgenerateand generate blocks;- multi-line comments, shown as
/*...*/; - the code of an inactive
`ifdefbranch (see Conditional compilation), shown as...— the directives stay visible.
A collapsed scope keeps its header and end keyword visible:
always_ff @(posedge clk or negedge rst_n) begin : seq...end : seqEmpty bodies (only blank lines) do not fold.
Limitations
Section titled “Limitations”- Port and argument lists and
{ … }bodies (constraints, structs, coverpoint bins) do not fold.
Try it
Section titled “Try it”- Open
rtl/counter.svfrom the sample project. - Put the caret inside the
always_ffblock and press ⌘- (Ctrl+-). The body betweenbegin : seqandend : seqcollapses to.... - Press ⌘+ (Ctrl+=) to expand it again.